mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 04:57:27 +00:00
Complete Some Todos and Remove Some
This commit is contained in:
1 parent
598491fe8c
commit
79955f549e
6 files changed
+33
-29
No files matched your search
@@ -42,10 +42,10 @@ public class AssetsBrowser {
|
||||
private void getFiles() {
|
||||
folders.clear();
|
||||
files.clear();
|
||||
|
||||
|
||||
ResourcePackRepository repos = Minecraft.getMinecraft().getResourcePackRepository();
|
||||
SimpleReloadableResourceManager simplemanager = (SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
|
||||
|
||||
Map<String, IResourceManager> map = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, simplemanager, 2);
|
||||
HashSet<String> set = new HashSet<String>();
|
||||
for(String name: map.keySet()){
|
||||
@@ -62,7 +62,7 @@ public class AssetsBrowser {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(String file : set){
|
||||
progressFile(new File(file));
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class AssetsBrowser {
|
||||
ZipEntry zipentry = entries.nextElement();
|
||||
String entryName = zipentry.getName();
|
||||
checkFile(entryName);
|
||||
|
||||
|
||||
}
|
||||
zip.close();
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class AssetsBrowser {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void checkFolder(File file, int length){
|
||||
File[] files = file.listFiles();
|
||||
if(files == null){
|
||||
@@ -128,7 +128,7 @@ public class AssetsBrowser {
|
||||
checkFile(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void checkFile(String name){
|
||||
if(!name.startsWith("/"))
|
||||
name = "/" + name;
|
||||
|
||||
@@ -105,7 +105,6 @@ public class GuiScriptEffect extends GuiNPCInterface implements GuiYesNoCallback
|
||||
this.addButton(new GuiNpcButton(105, left1 + 61, this.guiTop + 21 + yoffset, 60, 20, "gui.remove"));
|
||||
|
||||
this.addButton(new GuiNpcButton(107, left1, this.guiTop + 66 + yoffset, 80, 20, "script.loadscript"));
|
||||
// TODO Uncomment if script lists ever get added
|
||||
this.getButton(107).enabled = false;
|
||||
|
||||
GuiCustomScroll scroll = (new GuiCustomScroll(this, 0)).setUnselectable();
|
||||
|
||||
@@ -116,7 +116,6 @@ public class GuiScriptLinkedItem extends GuiNPCInterface implements GuiYesNoCall
|
||||
this.addButton(new GuiNpcButton(105, left1 + 61, this.guiTop + 21 + yoffset, 60, 20, "gui.remove"));
|
||||
|
||||
this.addButton(new GuiNpcButton(107, left1, this.guiTop + 66 + yoffset, 80, 20, "script.loadscript"));
|
||||
// TODO Uncomment if script lists ever get added
|
||||
this.getButton(107).enabled = false;
|
||||
|
||||
GuiCustomScroll scroll = (new GuiCustomScroll(this, 0)).setUnselectable();
|
||||
|
||||
@@ -192,9 +192,7 @@ public class BlockScriptedRenderer extends BlockRendererInterface{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
//TODO
|
||||
}
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
|
||||
@@ -687,17 +687,26 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
|
||||
public EntityProjectile shoot(double x, double y, double z, int accuracy, ItemStack proj, boolean indirect){
|
||||
EntityProjectile projectile = new EntityProjectile(this.worldObj, this, proj.copy(), true);
|
||||
//TODO calculate height of the thrower
|
||||
double varX = x - this.posX;
|
||||
double varY = y - (this.posY + this.getEyeHeight());
|
||||
double varZ = z - this.posZ;
|
||||
float varF = projectile.hasGravity() ? MathHelper.sqrt_double(varX * varX + varZ * varZ) : 0.0F;
|
||||
float angle = projectile.getAngleForXYZ(varX, varY, varZ, varF, indirect);
|
||||
float acc = 20.0F - MathHelper.floor_float(accuracy / 5.0F);
|
||||
projectile.setThrowableHeading(varX, varY, varZ, angle, acc);
|
||||
worldObj.spawnEntityInWorld(projectile);
|
||||
return projectile;
|
||||
EntityProjectile projectile = new EntityProjectile(this.worldObj, this, proj.copy(), true);
|
||||
|
||||
double throwerHeight = this.getEyeHeight(); // default eye height
|
||||
if (this.currentAnimation == EnumAnimation.LYING || this.currentAnimation == EnumAnimation.CRAWLING) {
|
||||
// When lying or crawling, assume the effective throw point is roughly halfway up the entity
|
||||
throwerHeight = this.height * 0.5;
|
||||
} else if (this.currentAnimation == EnumAnimation.SITTING) {
|
||||
// When sitting, adjust accordingly (example factor)
|
||||
throwerHeight = this.height * 0.7;
|
||||
}
|
||||
|
||||
double varX = x - this.posX;
|
||||
double varY = y - (this.posY + throwerHeight);
|
||||
double varZ = z - this.posZ;
|
||||
float varF = projectile.hasGravity() ? MathHelper.sqrt_double(varX * varX + varZ * varZ) : 0.0F;
|
||||
float angle = projectile.getAngleForXYZ(varX, varY, varZ, varF, indirect);
|
||||
float acc = 20.0F - MathHelper.floor_float(accuracy / 5.0F);
|
||||
projectile.setThrowableHeading(varX, varY, varZ, angle, acc);
|
||||
worldObj.spawnEntityInWorld(projectile);
|
||||
return projectile;
|
||||
}
|
||||
|
||||
private void clearTasks(EntityAITasks tasks){
|
||||
|
||||
@@ -31,16 +31,15 @@ public class JobHealer extends JobInterface{
|
||||
speed = nbttagcompound.getInteger("HealerSpeed");
|
||||
}
|
||||
private List<EntityLivingBase> toHeal = new ArrayList<EntityLivingBase>();
|
||||
|
||||
//TODO heal food, heal potion effects, heal more types of entities besides just the player and npcs
|
||||
|
||||
public boolean aiShouldExecute() {
|
||||
healTicks++;
|
||||
if (healTicks < speed * 10)
|
||||
if (healTicks < speed * 10)
|
||||
return false;
|
||||
|
||||
|
||||
for(Object plObj: npc.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, npc.boundingBox.expand(range, range/2, range))){
|
||||
EntityLivingBase entity = (EntityLivingBase) plObj;
|
||||
|
||||
|
||||
if(entity instanceof EntityPlayer){
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
if(player.getHealth() < player.getMaxHealth() && !npc.faction.isAggressiveToPlayer(player))
|
||||
@@ -51,7 +50,7 @@ public class JobHealer extends JobInterface{
|
||||
if(npc.getHealth() < npc.getMaxHealth() && !this.npc.faction.isAggressiveToNpc(npc))
|
||||
toHeal.add(npc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
healTicks = 0;
|
||||
@@ -65,7 +64,7 @@ public class JobHealer extends JobInterface{
|
||||
}
|
||||
toHeal.clear();
|
||||
}
|
||||
|
||||
|
||||
public void heal(EntityLivingBase entity, float amount){
|
||||
entity.heal(amount);
|
||||
NoppesUtilServer.spawnParticle(entity, "heal",entity.dimension);
|
||||
|
||||
Reference in new issue
Block a user