diff --git a/src/main/java/foxz/command/CmdClone.java b/src/main/java/foxz/command/CmdClone.java index 75627a9f1..9a6cd1923 100644 --- a/src/main/java/foxz/command/CmdClone.java +++ b/src/main/java/foxz/command/CmdClone.java @@ -172,7 +172,7 @@ public class CmdClone extends ChMcLogger { entity.setPosition(posX + 0.5, posY + 1, posZ + 0.5); if(entity instanceof EntityNPCInterface){ EntityNPCInterface npc = (EntityNPCInterface) entity; - npc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; + npc.ais.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; if(newname != null && !newname.isEmpty()) npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way } @@ -274,7 +274,7 @@ public class CmdClone extends ChMcLogger { entity.setPosition(posX + 0.5 + x, yy + 1, posZ + 0.5 + z); if(entity instanceof EntityNPCInterface){ EntityNPCInterface npc = (EntityNPCInterface) entity; - npc.ai.startPos = new int[]{xx, yy, zz}; + npc.ais.startPos = new int[]{xx, yy, zz}; if(newname != null && !newname.isEmpty()) npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way } diff --git a/src/main/java/foxz/command/CmdNpc.java b/src/main/java/foxz/command/CmdNpc.java index a4cffbc4e..aaec029a4 100644 --- a/src/main/java/foxz/command/CmdNpc.java +++ b/src/main/java/foxz/command/CmdNpc.java @@ -50,7 +50,7 @@ public class CmdNpc extends ChMcLogger { posZ = CommandBase.func_110666_a(pcParam, selectedNpc.posZ, args[2]); } - selectedNpc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; + selectedNpc.ais.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; } @SubCommand( @@ -144,7 +144,7 @@ public class CmdNpc extends ChMcLogger { if(args.length > 0) npc.display.name = args[0]; npc.setPositionAndRotation(player.posX, player.posY, player.posZ, player.cameraYaw, player.cameraPitch); - npc.ai.startPos = new int[]{MathHelper.floor_double(player.posX),MathHelper.floor_double(player.posY),MathHelper.floor_double(player.posZ)}; + npc.ais.startPos = new int[]{MathHelper.floor_double(player.posX),MathHelper.floor_double(player.posY),MathHelper.floor_double(player.posZ)}; pw.spawnEntityInWorld(npc); npc.setHealth(npc.getMaxHealth()); NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, npc); diff --git a/src/main/java/kamkeel/npcs/command/CloneCommand.java b/src/main/java/kamkeel/npcs/command/CloneCommand.java index fc6e26817..b62308d30 100644 --- a/src/main/java/kamkeel/npcs/command/CloneCommand.java +++ b/src/main/java/kamkeel/npcs/command/CloneCommand.java @@ -203,7 +203,7 @@ public class CloneCommand extends CommandKamkeelBase { entity.setPosition(posX + 0.5, posY + 1, posZ + 0.5); if(entity instanceof EntityNPCInterface){ EntityNPCInterface npc = (EntityNPCInterface) entity; - npc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; + npc.ais.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; if(newname != null && !newname.isEmpty()) npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way } @@ -309,7 +309,7 @@ public class CloneCommand extends CommandKamkeelBase { entity.setPosition(posX + 0.5 + x, yy + 1, posZ + 0.5 + z); if(entity instanceof EntityNPCInterface){ EntityNPCInterface npc = (EntityNPCInterface) entity; - npc.ai.startPos = new int[]{xx, yy, zz}; + npc.ais.startPos = new int[]{xx, yy, zz}; if(newname != null && !newname.isEmpty()) npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way } diff --git a/src/main/java/kamkeel/npcs/command/NpcCommand.java b/src/main/java/kamkeel/npcs/command/NpcCommand.java index 18d3fb730..fe775928c 100644 --- a/src/main/java/kamkeel/npcs/command/NpcCommand.java +++ b/src/main/java/kamkeel/npcs/command/NpcCommand.java @@ -93,7 +93,7 @@ public class NpcCommand extends CommandKamkeelBase { posZ = CommandBase.func_110666_a(sender, selectedNpc.posZ, args[2]); } - selectedNpc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; + selectedNpc.ais.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; sendResult(sender, String.format("Set NPC \u00A7e%s\u00A77 Home to \u00A7b[%.1f] [%.1f] [%.1f]\u00A77", selectedNpc.display.name, posX, posY, posZ)); } @@ -199,7 +199,7 @@ public class NpcCommand extends CommandKamkeelBase { if(args.length > 0) npc.display.name = args[0]; npc.setPositionAndRotation(player.posX, player.posY, player.posZ, player.cameraYaw, player.cameraPitch); - npc.ai.startPos = new int[]{MathHelper.floor_double(player.posX),MathHelper.floor_double(player.posY),MathHelper.floor_double(player.posZ)}; + npc.ais.startPos = new int[]{MathHelper.floor_double(player.posX),MathHelper.floor_double(player.posY),MathHelper.floor_double(player.posZ)}; pw.spawnEntityInWorld(npc); npc.setHealth(npc.getMaxHealth()); NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, npc); diff --git a/src/main/java/kamkeel/npcs/network/packets/request/mainmenu/MainmenuAIGetPacket.java b/src/main/java/kamkeel/npcs/network/packets/request/mainmenu/MainmenuAIGetPacket.java index 363d194fc..875d9c762 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/mainmenu/MainmenuAIGetPacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/mainmenu/MainmenuAIGetPacket.java @@ -48,6 +48,6 @@ public final class MainmenuAIGetPacket extends AbstractPacket { if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return; - GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.ai.writeToNBT(new NBTTagCompound())); + GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.ais.writeToNBT(new NBTTagCompound())); } } diff --git a/src/main/java/kamkeel/npcs/network/packets/request/mainmenu/MainmenuAISavePacket.java b/src/main/java/kamkeel/npcs/network/packets/request/mainmenu/MainmenuAISavePacket.java index b17f93d35..d08e9e056 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/mainmenu/MainmenuAISavePacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/mainmenu/MainmenuAISavePacket.java @@ -62,7 +62,7 @@ public final class MainmenuAISavePacket extends AbstractPacket { if (!PacketUtil.verifyItemPacket(EnumItemPacketType.WAND, player)) return; - npc.ai.readToNBT(ByteBufUtils.readNBT(in)); + npc.ais.readToNBT(ByteBufUtils.readNBT(in)); npc.setHealth(npc.getMaxHealth()); npc.updateAI = true; npc.updateClient = true; diff --git a/src/main/java/kamkeel/npcs/network/packets/request/pather/MovingPathGetPacket.java b/src/main/java/kamkeel/npcs/network/packets/request/pather/MovingPathGetPacket.java index db1f45d42..e87b3c52b 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/pather/MovingPathGetPacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/pather/MovingPathGetPacket.java @@ -10,12 +10,9 @@ import kamkeel.npcs.network.PacketUtil; import kamkeel.npcs.network.enums.EnumItemPacketType; import kamkeel.npcs.network.enums.EnumRequestPacket; import kamkeel.npcs.network.packets.data.large.GuiDataPacket; -import kamkeel.npcs.util.ByteBufUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; -import noppes.npcs.CustomNpcsPermissions; -import noppes.npcs.NBTTags; import java.io.IOException; @@ -51,6 +48,6 @@ public final class MovingPathGetPacket extends AbstractPacket { if (!PacketUtil.verifyItemPacket(EnumItemPacketType.PATHER, player)) return; - GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.ai.writeToNBT(new NBTTagCompound())); + GuiDataPacket.sendGuiData((EntityPlayerMP) player, npc.ais.writeToNBT(new NBTTagCompound())); } } diff --git a/src/main/java/kamkeel/npcs/network/packets/request/pather/MovingPathSavePacket.java b/src/main/java/kamkeel/npcs/network/packets/request/pather/MovingPathSavePacket.java index 64dad666c..c96564bba 100644 --- a/src/main/java/kamkeel/npcs/network/packets/request/pather/MovingPathSavePacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/request/pather/MovingPathSavePacket.java @@ -9,16 +9,12 @@ import kamkeel.npcs.network.PacketHandler; import kamkeel.npcs.network.PacketUtil; import kamkeel.npcs.network.enums.EnumItemPacketType; import kamkeel.npcs.network.enums.EnumRequestPacket; -import kamkeel.npcs.network.packets.data.large.GuiDataPacket; import kamkeel.npcs.util.ByteBufUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import noppes.npcs.CustomNpcsPermissions; import noppes.npcs.NBTTags; -import noppes.npcs.NoppesUtilServer; -import noppes.npcs.controllers.FactionController; -import noppes.npcs.controllers.data.Faction; import java.io.IOException; @@ -68,6 +64,6 @@ public final class MovingPathSavePacket extends AbstractPacket { if (!PacketUtil.verifyItemPacket(EnumItemPacketType.PATHER, player)) return; - npc.ai.setMovingPath(NBTTags.getIntegerArraySet(ByteBufUtils.readNBT(in).getTagList("MovingPathNew",10))); + npc.ais.setMovingPath(NBTTags.getIntegerArraySet(ByteBufUtils.readNBT(in).getTagList("MovingPathNew",10))); } } diff --git a/src/main/java/noppes/npcs/NPCSpawning.java b/src/main/java/noppes/npcs/NPCSpawning.java index e95622242..aa7eff574 100644 --- a/src/main/java/noppes/npcs/NPCSpawning.java +++ b/src/main/java/noppes/npcs/NPCSpawning.java @@ -181,8 +181,8 @@ public class NPCSpawning { if(spawnEntity instanceof EntityCustomNpc){ EntityCustomNpc npc = (EntityCustomNpc) spawnEntity; npc.stats.spawnCycle = 3; - npc.ai.returnToStart = false; - npc.ai.startPos = new int[]{x,y, z}; + npc.ais.returnToStart = false; + npc.ais.startPos = new int[]{x,y, z}; npc.updateAI = true; npc.updateClient = true; npc.getNavigator().clearPathEntity(); diff --git a/src/main/java/noppes/npcs/NoppesUtilServer.java b/src/main/java/noppes/npcs/NoppesUtilServer.java index 19ec78efa..5111262b6 100644 --- a/src/main/java/noppes/npcs/NoppesUtilServer.java +++ b/src/main/java/noppes/npcs/NoppesUtilServer.java @@ -812,7 +812,7 @@ public class NoppesUtilServer { entity.setPosition((double) x + 0.5, (double) y, (double) z + 0.5); if(entity instanceof EntityNPCInterface){ EntityNPCInterface npc = (EntityNPCInterface) entity; - npc.ai.startPos = new int[]{MathHelper.floor_double(npc.posX),MathHelper.floor_double(npc.posY),MathHelper.floor_double(npc.posZ)}; + npc.ais.startPos = new int[]{MathHelper.floor_double(npc.posX),MathHelper.floor_double(npc.posY),MathHelper.floor_double(npc.posZ)}; npc.ticksExisted = 0; npc.totalTicksAlive = 0; } @@ -831,7 +831,7 @@ public class NoppesUtilServer { } if(entity instanceof EntityNPCInterface){ EntityNPCInterface npc = (EntityNPCInterface) entity; - npc.ai.startPos = new int[]{MathHelper.floor_double(npc.posX),MathHelper.floor_double(npc.posY),MathHelper.floor_double(npc.posZ)}; + npc.ais.startPos = new int[]{MathHelper.floor_double(npc.posX),MathHelper.floor_double(npc.posY),MathHelper.floor_double(npc.posZ)}; npc.ticksExisted = 0; npc.totalTicksAlive = 0; } diff --git a/src/main/java/noppes/npcs/VersionCompatibility.java b/src/main/java/noppes/npcs/VersionCompatibility.java index 23445f625..afa205d16 100644 --- a/src/main/java/noppes/npcs/VersionCompatibility.java +++ b/src/main/java/noppes/npcs/VersionCompatibility.java @@ -46,7 +46,7 @@ public class VersionCompatibility { } if(npc.npcVersion < 12){ CompatabilityFix(compound, npc.advanced.writeToNBT(new NBTTagCompound())); - CompatabilityFix(compound, npc.ai.writeToNBT(new NBTTagCompound())); + CompatabilityFix(compound, npc.ais.writeToNBT(new NBTTagCompound())); CompatabilityFix(compound, npc.stats.writeToNBT(new NBTTagCompound())); CompatabilityFix(compound, npc.display.writeToNBT(new NBTTagCompound())); CompatabilityFix(compound, npc.inventory.writeEntityToNBT(new NBTTagCompound())); @@ -101,7 +101,7 @@ public class VersionCompatibility { int z = ((NBTTagInt) list.removeTag(2)).func_150287_d(); int y = ((NBTTagInt) list.removeTag(1)).func_150287_d(); int x = ((NBTTagInt) list.removeTag(0)).func_150287_d(); - + compound.setIntArray("StartPosNew", new int[]{x,y,z}); } } @@ -112,7 +112,7 @@ public class VersionCompatibility { bo = comp.getBoolean("HealthRegen"); comp.setInteger("HealthRegen", bo?1:0); compound.setTag("TransformStats", comp); - + } npc.npcVersion = ModRev; } @@ -200,7 +200,7 @@ public class VersionCompatibility { if(compatibilty.getVersion() == ModRev) return; CompatabilityFix(compound, compatibilty.writeToNBT(new NBTTagCompound())); - + compatibilty.setVersion(ModRev); } private static void CompatabilityFix(NBTTagCompound compound, diff --git a/src/main/java/noppes/npcs/ai/EntityAIAmbushTarget.java b/src/main/java/noppes/npcs/ai/EntityAIAmbushTarget.java index 592647238..46f3825ca 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIAmbushTarget.java +++ b/src/main/java/noppes/npcs/ai/EntityAIAmbushTarget.java @@ -80,7 +80,7 @@ public class EntityAIAmbushTarget extends EntityAIBase { boolean shouldHide = this.targetEntity.getDistanceSqToEntity(this.theEntity) > this.distance; boolean isSeen = this.theEntity.canSee(targetEntity); - return (!this.theEntity.getNavigator().noPath() && shouldHide) || (!isSeen && (shouldHide || this.theEntity.ai.directLOS)); + return (!this.theEntity.getNavigator().noPath() && shouldHide) || (!isSeen && (shouldHide || this.theEntity.ais.directLOS)); } /** @@ -90,7 +90,7 @@ public class EntityAIAmbushTarget extends EntityAIBase { this.theEntity.getNavigator().tryMoveToXYZ(this.shelterX, this.shelterY, this.shelterZ, this.movementSpeed); } - + /** * Resets the task */ @@ -114,9 +114,9 @@ public class EntityAIAmbushTarget extends EntityAIBase { this.theEntity.getLookHelper().setLookPositionWithEntity(targetEntity, 30.0F, 30.0F); } - + private Vec3 findHidingSpot() - { + { Random random = this.theEntity.getRNG(); Vec3 idealPos = null; @@ -131,7 +131,7 @@ public class EntityAIAmbushTarget extends EntityAIBase double j = MathHelper.floor_double(this.theEntity.posX + x) + 0.5D; double k = MathHelper.floor_double(this.theEntity.boundingBox.minY + y); double l = MathHelper.floor_double(this.theEntity.posZ + z) + 0.5D; - + if (this.theWorld.getBlock((int)j, (int)k, (int)l).isOpaqueCube() && !this.theWorld.getBlock((int)j, (int)k + 1, (int)l).isOpaqueCube() && !this.theWorld.getBlock((int)j, (int)k + 2, (int)l).isOpaqueCube()) { Vec3 vec1 = Vec3.createVectorHelper(this.targetEntity.posX, this.targetEntity.posY + (double)this.targetEntity.getEyeHeight(), this.targetEntity.posZ); @@ -148,7 +148,7 @@ public class EntityAIAmbushTarget extends EntityAIBase } } } - + if (idealPos != null) { return idealPos; diff --git a/src/main/java/noppes/npcs/ai/EntityAIAnimation.java b/src/main/java/noppes/npcs/ai/EntityAIAnimation.java index dfdf8c648..3cd3a2300 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIAnimation.java +++ b/src/main/java/noppes/npcs/ai/EntityAIAnimation.java @@ -24,21 +24,21 @@ public class EntityAIAnimation extends EntityAIBase isDead = !npc.isEntityAlive(); if(isDead) return npc.currentAnimation != EnumAnimation.LYING; - + if(npc.stats.aimWhileShooting && npc.isAttacking()) return npc.currentAnimation != EnumAnimation.AIMING; - if(npc.ai.animationType == EnumAnimation.NONE) + if(npc.ais.animationType == EnumAnimation.NONE) return npc.currentAnimation != EnumAnimation.NONE; isAttacking = npc.isAttacking(); - if(npc.ai.returnToStart) + if(npc.ais.returnToStart) isAtStartpoint = npc.isVeryNearAssignedPlace(); hasPath = !npc.getNavigator().noPath(); - - if(npc.ai.movingType == EnumMovingType.Standing && hasNavigation() && npc.currentAnimation.getWalkingAnimation() == 0){ + + if(npc.ais.movingType == EnumMovingType.Standing && hasNavigation() && npc.currentAnimation.getWalkingAnimation() == 0){ return npc.currentAnimation != EnumAnimation.NONE; } - - return npc.currentAnimation != npc.ai.animationType; + + return npc.currentAnimation != npc.ais.animationType; } @Override @@ -47,21 +47,21 @@ public class EntityAIAnimation extends EntityAIBase setAnimation(EnumAnimation.AIMING); return; } - EnumAnimation type = npc.ai.animationType; + EnumAnimation type = npc.ais.animationType; if(isDead) type = EnumAnimation.LYING; - else if(npc.ai.movingType == EnumMovingType.Standing && npc.ai.animationType.getWalkingAnimation() == 0 && hasNavigation()) + else if(npc.ais.movingType == EnumMovingType.Standing && npc.ais.animationType.getWalkingAnimation() == 0 && hasNavigation()) type = EnumAnimation.NONE; setAnimation(type); } - + private void setAnimation(EnumAnimation animation){ npc.setCurrentAnimation(animation); npc.updateHitbox(); npc.setPosition(npc.posX, npc.posY, npc.posZ); } - + private boolean hasNavigation() { - return (isAttacking || npc.ai.returnToStart && !isAtStartpoint && !npc.isFollower() || hasPath); + return (isAttacking || npc.ais.returnToStart && !isAtStartpoint && !npc.isFollower() || hasPath); } } diff --git a/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java b/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java index d9cae376f..73e9f7ea3 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java +++ b/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java @@ -47,14 +47,14 @@ public class EntityAIAttackTarget extends EntityAIBase else if (!entitylivingbase.isEntityAlive()){ return false; } - else if (this.npc.inventory.getProjectile() != null && this.npc.ai.useRangeMelee == 0){ + else if (this.npc.inventory.getProjectile() != null && this.npc.ais.useRangeMelee == 0){ return false; } double var2 = this.npc.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ); - double var3 = this.npc.ai.distanceToMelee * this.npc.ai.distanceToMelee; + double var3 = this.npc.ais.distanceToMelee * this.npc.ais.distanceToMelee; - if (this.npc.ai.useRangeMelee == 1 && var2 > var3){ + if (this.npc.ais.useRangeMelee == 1 && var2 > var3){ return false; } else{ @@ -81,7 +81,7 @@ public class EntityAIAttackTarget extends EntityAIBase if(npc.getDistanceToEntity(entityTarget) > npc.stats.aggroRange) return false; - if (this.npc.ai.useRangeMelee == 1 && npc.getDistanceSqToEntity(entityTarget) > (this.npc.ai.distanceToMelee * this.npc.ai.distanceToMelee)) + if (this.npc.ais.useRangeMelee == 1 && npc.getDistanceSqToEntity(entityTarget) > (this.npc.ais.distanceToMelee * this.npc.ais.distanceToMelee)) return false; return this.npc.isWithinHomeDistance(MathHelper.floor_double(entityTarget.posX), MathHelper.floor_double(entityTarget.posY), MathHelper.floor_double(entityTarget.posZ)); @@ -94,7 +94,7 @@ public class EntityAIAttackTarget extends EntityAIBase if(!navOverride) this.npc.getNavigator().setPath(this.entityPathEntity, 1.3D); this.field_75445_i = 0; - if (this.npc.getRangedTask() != null && this.npc.ai.useRangeMelee == 2) + if (this.npc.getRangedTask() != null && this.npc.ais.useRangeMelee == 2) { this.npc.getRangedTask().navOverride(true); } @@ -109,7 +109,7 @@ public class EntityAIAttackTarget extends EntityAIBase this.entityTarget = null; this.npc.setAttackTarget(null); this.npc.getNavigator().clearPathEntity(); - if (this.npc.getRangedTask() != null && this.npc.ai.useRangeMelee == 2) + if (this.npc.getRangedTask() != null && this.npc.ais.useRangeMelee == 2) { this.npc.getRangedTask().navOverride(false); } diff --git a/src/main/java/noppes/npcs/ai/EntityAIAvoidTarget.java b/src/main/java/noppes/npcs/ai/EntityAIAvoidTarget.java index 2ae0724a0..bb88bdd5d 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIAvoidTarget.java +++ b/src/main/java/noppes/npcs/ai/EntityAIAvoidTarget.java @@ -19,7 +19,7 @@ public class EntityAIAvoidTarget extends EntityAIBase private EntityNPCInterface theEntity; private Entity closestLivingEntity; private float distanceFromEntity; - + private float health; /** The PathEntity of our entity */ @@ -27,7 +27,7 @@ public class EntityAIAvoidTarget extends EntityAIBase /** The PathNavigate of our entity */ private PathNavigate entityPathNavigate; - + /** The class of the entity we should avoid */ private Class targetEntityClass; @@ -46,14 +46,14 @@ public class EntityAIAvoidTarget extends EntityAIBase public boolean shouldExecute() { EntityLivingBase target = this.theEntity.getAttackTarget(); - + if (target == null) { return false; } - + targetEntityClass = target.getClass(); - + if (this.targetEntityClass == EntityPlayer.class) { this.closestLivingEntity = this.theEntity.worldObj.getClosestPlayerToEntity(this.theEntity, (double)this.distanceFromEntity); @@ -75,7 +75,7 @@ public class EntityAIAvoidTarget extends EntityAIBase this.closestLivingEntity = (Entity)var1.get(0); } - if (!this.theEntity.getEntitySenses().canSee(this.closestLivingEntity) && this.theEntity.ai.directLOS) + if (!this.theEntity.getEntitySenses().canSee(this.closestLivingEntity) && this.theEntity.ais.directLOS) { return false; } @@ -83,10 +83,10 @@ public class EntityAIAvoidTarget extends EntityAIBase { Vec3 var2 = RandomPositionGeneratorAlt.findRandomTargetBlockAwayFrom(this.theEntity, 16, 7, Vec3.createVectorHelper(this.closestLivingEntity.posX, this.closestLivingEntity.posY, this.closestLivingEntity.posZ)); - boolean var3 = this.theEntity.inventory.getProjectile() == null || this.theEntity.ai.useRangeMelee == 2; - + boolean var3 = this.theEntity.inventory.getProjectile() == null || this.theEntity.ais.useRangeMelee == 2; + boolean var4 = var3 ? this.health == this.theEntity.getHealth() : this.theEntity.getRangedTask() != null && !this.theEntity.getRangedTask().hasFired(); - + if (var2 == null) { return false; @@ -95,7 +95,7 @@ public class EntityAIAvoidTarget extends EntityAIBase { return false; } - else if (this.theEntity.ai.tacticalVariant == EnumNavType.HitNRun && var4) + else if (this.theEntity.ais.tacticalVariant == EnumNavType.HitNRun && var4) { return false; } @@ -145,13 +145,13 @@ public class EntityAIAvoidTarget extends EntityAIBase { this.theEntity.getNavigator().setSpeed(1.0D); } - if (this.theEntity.ai.tacticalVariant == EnumNavType.HitNRun) + if (this.theEntity.ais.tacticalVariant == EnumNavType.HitNRun) { float dist = this.theEntity.getDistanceToEntity(this.closestLivingEntity); - if (dist > this.distanceFromEntity || dist < this.theEntity.ai.tacticalRadius) + if (dist > this.distanceFromEntity || dist < this.theEntity.ais.tacticalRadius) { this.health = this.theEntity.getHealth(); } } } -} \ No newline at end of file +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIFollow.java b/src/main/java/noppes/npcs/ai/EntityAIFollow.java index 173af0224..e1034c182 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIFollow.java +++ b/src/main/java/noppes/npcs/ai/EntityAIFollow.java @@ -26,9 +26,9 @@ public class EntityAIFollow extends EntityAIBase return false; return distance > npc.followRange(); } - + public boolean excute(){ - if(!npc.isEntityAlive() || !npc.isFollower() || npc.isAttacking() || (owner = npc.getOwner()) == null || npc.ai.animationType == EnumAnimation.SITTING) + if(!npc.isEntityAlive() || !npc.isFollower() || npc.isAttacking() || (owner = npc.getOwner()) == null || npc.ais.animationType == EnumAnimation.SITTING) return false; distance = npc.getDistanceSqToEntity(owner); return true; @@ -62,7 +62,7 @@ public class EntityAIFollow extends EntityAIBase speed = 3; if (this.npc.getNavigator().tryMoveToEntityLiving(owner, speed) || distance < 225.0D) return; - + int i = MathHelper.floor_double(this.owner.posX) - 2; int j = MathHelper.floor_double(this.owner.posZ) - 2; int k = MathHelper.floor_double(this.owner.boundingBox.minY); diff --git a/src/main/java/noppes/npcs/ai/EntityAILook.java b/src/main/java/noppes/npcs/ai/EntityAILook.java index 9151ee625..938c8816b 100644 --- a/src/main/java/noppes/npcs/ai/EntityAILook.java +++ b/src/main/java/noppes/npcs/ai/EntityAILook.java @@ -28,15 +28,15 @@ public class EntityAILook extends EntityAIBase{ public boolean shouldExecute(){ return !npc.isAttacking() && npc.getNavigator().noPath() && !npc.isPlayerSleeping() && npc.isEntityAlive(); } - + /** * Execute a one shot task or start executing a continuous task */ @Override public void startExecuting(){ - rotatebody = npc.ai.standingType == EnumStandingType.RotateBody || npc.ai.standingType == EnumStandingType.HeadRotation; + rotatebody = npc.ais.standingType == EnumStandingType.RotateBody || npc.ais.standingType == EnumStandingType.HeadRotation; } - + /** * Resets the task */ @@ -44,13 +44,13 @@ public class EntityAILook extends EntityAIBase{ public void resetTask(){ rotatebody = false; } - + /** * Updates the task */ @Override - public void updateTask(){ - if(npc.ai.standingType == EnumStandingType.Stalking){ + public void updateTask(){ + if(npc.ais.standingType == EnumStandingType.Stalking){ EntityPlayer player = npc.worldObj.getClosestPlayerToEntity(npc, 16); if(player == null) rotatebody = true; @@ -75,14 +75,14 @@ public class EntityAILook extends EntityAIBase{ npc.getLookHelper().setLookPositionWithEntity(closest, 10F, npc.getVerticalFaceSpeed()); return; } - + } - + if(rotatebody){ if(idle == 0 && npc.getRNG().nextFloat() < 0.02F){ double var1 = (Math.PI * 2D) * this.npc.getRNG().nextDouble(); - if(npc.ai.standingType == EnumStandingType.HeadRotation) - var1 = Math.PI / 180 * npc.ai.orientation + Math.PI * 0.2 + Math.PI * 0.6 * this.npc.getRNG().nextDouble(); + if(npc.ais.standingType == EnumStandingType.HeadRotation) + var1 = Math.PI / 180 * npc.ais.orientation + Math.PI * 0.2 + Math.PI * 0.6 * this.npc.getRNG().nextDouble(); this.lookX = Math.cos(var1); this.lookZ = Math.sin(var1); this.idle = 20 + this.npc.getRNG().nextInt(20); @@ -92,9 +92,9 @@ public class EntityAILook extends EntityAIBase{ npc.getLookHelper().setLookPosition(npc.posX + lookX, npc.posY + npc.getEyeHeight(), npc.posZ + lookZ, 10F, npc.getVerticalFaceSpeed()); } } - - if(npc.ai.standingType == EnumStandingType.NoRotation){ - npc.rotationYawHead = npc.rotationYaw = npc.renderYawOffset = npc.ai.orientation; + + if(npc.ais.standingType == EnumStandingType.NoRotation){ + npc.rotationYawHead = npc.rotationYaw = npc.renderYawOffset = npc.ais.orientation; } } } diff --git a/src/main/java/noppes/npcs/ai/EntityAIMovingPath.java b/src/main/java/noppes/npcs/ai/EntityAIMovingPath.java index 37cfe103a..ae7a7db85 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIMovingPath.java +++ b/src/main/java/noppes/npcs/ai/EntityAIMovingPath.java @@ -21,16 +21,16 @@ public class EntityAIMovingPath extends EntityAIBase */ @Override public boolean shouldExecute(){ - if (npc.isAttacking() || npc.isInteracting() || npc.getRNG().nextInt(40) != 0 && npc.ai.movingPause || !npc.getNavigator().noPath() || npc.isInteracting()) + if (npc.isAttacking() || npc.isInteracting() || npc.getRNG().nextInt(40) != 0 && npc.ais.movingPause || !npc.getNavigator().noPath() || npc.isInteracting()) return false; - - List list = npc.ai.getMovingPath(); + + List list = npc.ais.getMovingPath(); if(list.size() < 2) return false; - - npc.ai.incrementMovingPath(); - pos = npc.ai.getCurrentMovingPath(); - + + npc.ais.incrementMovingPath(); + pos = npc.ais.getCurrentMovingPath(); + return true; } @@ -40,7 +40,7 @@ public class EntityAIMovingPath extends EntityAIBase @Override public boolean continueExecuting(){ if(npc.isAttacking() || npc.isInteracting()){ - npc.ai.decreaseMovingPath(); + npc.ais.decreaseMovingPath(); return false; } return !this.npc.getNavigator().noPath(); diff --git a/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java b/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java index 7e7aa75d3..0595872dd 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java +++ b/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java @@ -54,16 +54,16 @@ public class EntityAIRangedAttack extends EntityAIBase EntityLivingBase var1 = this.entityHost.getAttackTarget(); if (var1 == null || !var1.isEntityAlive()) return false; - + if(entityHost.getDistanceToEntity(var1) > entityHost.stats.aggroRange) return false; - + if (this.entityHost.inventory.getProjectile() == null) return false; - + double var2 = this.entityHost.getDistanceSq(var1.posX, var1.boundingBox.minY, var1.posZ); - double var3 = this.entityHost.ai.distanceToMelee * this.entityHost.ai.distanceToMelee; - - if (this.entityHost.ai.useRangeMelee >= 1 && var2 <= var3) return false; - + double var3 = this.entityHost.ais.distanceToMelee * this.entityHost.ais.distanceToMelee; + + if (this.entityHost.ais.useRangeMelee >= 1 && var2 <= var3) return false; + else { this.attackTarget = var1; @@ -91,7 +91,7 @@ public class EntityAIRangedAttack extends EntityAIBase this.hasFired = false; this.rangedAttackTime = this.entityHost.stats.minDelay / 2; } - + /** * Updates the task */ @@ -101,7 +101,7 @@ public class EntityAIRangedAttack extends EntityAIBase double var1 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ); float field_82642_h = this.entityHost.stats.rangedRange * this.entityHost.stats.rangedRange; - if (!navOverride && this.entityHost.ai.directLOS) + if (!navOverride && this.entityHost.ais.directLOS) { if (this.entityHost.getEntitySenses().canSee(this.attackTarget)) { @@ -111,7 +111,7 @@ public class EntityAIRangedAttack extends EntityAIBase { this.field_75318_f = 0; } - int v = this.entityHost.ai.tacticalVariant == EnumNavType.Default ? 20 : 5; + int v = this.entityHost.ais.tacticalVariant == EnumNavType.Default ? 20 : 5; if (var1 <= (double)field_82642_h && this.field_75318_f >= v) { this.entityHost.getNavigator().clearPathEntity(); @@ -123,10 +123,10 @@ public class EntityAIRangedAttack extends EntityAIBase } this.rangedAttackTime = Math.max(this.rangedAttackTime - 1, 0); - + if (this.rangedAttackTime <= 0) { - if (var1 <= (double)field_82642_h && (this.entityHost.getEntitySenses().canSee(this.attackTarget) || this.entityHost.ai.canFireIndirect == 2)) + if (var1 <= (double)field_82642_h && (this.entityHost.getEntitySenses().canSee(this.attackTarget) || this.entityHost.ais.canFireIndirect == 2)) { if (this.field_70846_g++ <= this.entityHost.stats.burstCount) { @@ -138,34 +138,34 @@ public class EntityAIRangedAttack extends EntityAIBase this.hasFired = true; this.rangedAttackTime = (this.entityHost.stats.maxDelay - MathHelper.floor_float(this.entityHost.getRNG().nextFloat() * (this.entityHost.stats.maxDelay - this.entityHost.stats.minDelay))); } - + if (this.field_70846_g > 1) { boolean indirect = false; - - switch(this.entityHost.ai.canFireIndirect) + + switch(this.entityHost.ais.canFireIndirect) { case 1 : indirect = var1 > (double)field_82642_h / 2; break; case 2 : indirect = !this.entityHost.getEntitySenses().canSee(this.attackTarget); } - + this.rangedAttackEntityHost.attackEntityWithRangedAttack(this.attackTarget, indirect ? 1 : 0); if (this.entityHost.currentAnimation != EnumAnimation.AIMING) { this.entityHost.swingItem(); } } - } + } } } - + public boolean hasFired() { return this.hasFired; } - + public void navOverride(boolean nav){ this.navOverride = nav; this.setMutexBits(this.navOverride ? AiMutex.PATHING : AiMutex.LOOK + AiMutex.PASSIVE); } -} \ No newline at end of file +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIReturn.java b/src/main/java/noppes/npcs/ai/EntityAIReturn.java index d3c42e426..936c2eb4c 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIReturn.java +++ b/src/main/java/noppes/npcs/ai/EntityAIReturn.java @@ -29,25 +29,25 @@ public class EntityAIReturn extends EntityAIBase * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { - if (!npc.ai.returnToStart){ + if (!npc.ais.returnToStart){ return false; } if(npc.hasOwner() || npc.isKilled() || npc.isInteracting()){ return false; } - - if (npc.ai.findShelter == 0 && (!npc.worldObj.isDaytime() || npc.worldObj.isRaining()) && !npc.worldObj.provider.hasNoSky){ + + if (npc.ais.findShelter == 0 && (!npc.worldObj.isDaytime() || npc.worldObj.isRaining()) && !npc.worldObj.provider.hasNoSky){ if (npc.worldObj.canBlockSeeTheSky((int)npc.getStartXPos(), (int)npc.getStartYPos(), (int)npc.getStartZPos()) || npc.worldObj.getFullBlockLightValue((int)npc.getStartXPos(), (int)npc.getStartYPos(), (int)npc.getStartZPos()) <= 8){ return false; } } - else if (npc.ai.findShelter == 1 && npc.worldObj.isDaytime()){ + else if (npc.ais.findShelter == 1 && npc.worldObj.isDaytime()){ if (npc.worldObj.canBlockSeeTheSky((int)npc.getStartXPos(), (int)npc.getStartYPos(), (int)npc.getStartZPos())){ return false; } } - + if(npc.isAttacking()){ if(!wasAttacked){ wasAttacked = true; @@ -56,33 +56,33 @@ public class EntityAIReturn extends EntityAIBase return false; } - if(npc.ai.movingType == EnumMovingType.MovingPath && npc.ai.getDistanceSqToPathPoint() < ConfigMain.NpcNavRange * ConfigMain.NpcNavRange) + if(npc.ais.movingType == EnumMovingType.MovingPath && npc.ais.getDistanceSqToPathPoint() < ConfigMain.NpcNavRange * ConfigMain.NpcNavRange) return false; if (npc.getNavigator().noPath() || (!npc.isAttacking() && wasAttacked)) { return true; } - if(npc.ai.movingType == EnumMovingType.Wandering) - return this.npc.getDistanceSq(npc.getStartXPos(), npc.getStartYPos(), npc.getStartZPos()) > npc.ai.walkingRange * npc.ai.walkingRange; + if(npc.ais.movingType == EnumMovingType.Wandering) + return this.npc.getDistanceSq(npc.getStartXPos(), npc.getStartYPos(), npc.getStartZPos()) > npc.ais.walkingRange * npc.ais.walkingRange; - if(npc.ai.movingType == EnumMovingType.Standing) + if(npc.ais.movingType == EnumMovingType.Standing) return !this.npc.isVeryNearAssignedPlace(); - + return false; } public boolean continueExecuting(){ return !npc.isFollower() && !npc.isKilled() && !npc.isAttacking() && !npc.isVeryNearAssignedPlace() && totalTicks <= MaxTotalTicks && !npc.isInteracting(); } - + public void updateTask(){ totalTicks++; if(totalTicks > MaxTotalTicks){ npc.setPosition(endPosX, endPosY, endPosZ); npc.getNavigator().clearPathEntity(); return; - } - + } + if(stuckTicks > 0){ stuckTicks--; } @@ -95,19 +95,19 @@ public class EntityAIReturn extends EntityAIBase } else navigate(stuckCount % 2 == 1); - } + } else{ stuckCount = 0; } } private boolean isTooFar(){ int allowedDistance = npc.stats.aggroRange * 2; - if(npc.ai.movingType == EnumMovingType.Wandering) - allowedDistance += npc.ai.walkingRange; + if(npc.ais.movingType == EnumMovingType.Wandering) + allowedDistance += npc.ais.walkingRange; return npc.getDistanceSq(endPosX, endPosY, endPosZ) > allowedDistance * allowedDistance; } - - public void startExecuting() + + public void startExecuting() { stuckTicks = 0; totalTicks = 0; @@ -133,7 +133,7 @@ public class EntityAIReturn extends EntityAIBase int distance = (int) range; if(distance > ConfigMain.NpcNavRange) distance = ConfigMain.NpcNavRange / 2; - else + else distance /= 2; if(distance > 2){ Vec3 start = Vec3.createVectorHelper(posX, posY, posZ); diff --git a/src/main/java/noppes/npcs/ai/EntityAISprintToTarget.java b/src/main/java/noppes/npcs/ai/EntityAISprintToTarget.java index 5449ba6a5..08a7b3337 100644 --- a/src/main/java/noppes/npcs/ai/EntityAISprintToTarget.java +++ b/src/main/java/noppes/npcs/ai/EntityAISprintToTarget.java @@ -22,7 +22,7 @@ public class EntityAISprintToTarget extends EntityAIBase return false; } - switch(this.npc.ai.onAttack){ + switch(this.npc.ais.onAttack){ case 0 : return !this.npc.isInRange(runTarget, 8)? (!this.npc.onGround ? false : true) : false; case 2 : return this.npc.isInRange(runTarget, 7)? (!this.npc.onGround ? false : true) : false; default : return false; diff --git a/src/main/java/noppes/npcs/ai/EntityAIWander.java b/src/main/java/noppes/npcs/ai/EntityAIWander.java index ee6ebbbcc..82e0aef0d 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIWander.java +++ b/src/main/java/noppes/npcs/ai/EntityAIWander.java @@ -33,9 +33,9 @@ public class EntityAIWander extends EntityAIBase if (this.entity.getAge() >= 100 || !entity.getNavigator().noPath() || entity.isInteracting() || this.entity.getRNG().nextInt(80) != 0){ return false; } - if(entity.ai.npcInteracting && entity.getRNG().nextInt(4) == 1) + if(entity.ais.npcInteracting && entity.getRNG().nextInt(4) == 1) nearbyNPC = getNearbyNPC(); - + if(nearbyNPC != null){ this.xPosition = MathHelper.floor_double(nearbyNPC.posX); this.yPosition = MathHelper.floor_double(nearbyNPC.posY); @@ -52,7 +52,7 @@ public class EntityAIWander extends EntityAIBase this.yPosition = vec.yCoord; if(entity.canFly()) - this.yPosition = entity.getStartYPos() + entity.getRNG().nextFloat() * 0.75 * entity.ai.walkingRange; + this.yPosition = entity.getStartYPos() + entity.getRNG().nextFloat() * 0.75 * entity.ais.walkingRange; this.zPosition = vec.zCoord; } } @@ -66,28 +66,28 @@ public class EntityAIWander extends EntityAIBase } } private EntityNPCInterface getNearbyNPC() { - List list = entity.worldObj.getEntitiesWithinAABBExcludingEntity(entity, entity.boundingBox.expand(entity.ai.walkingRange, entity.ai.walkingRange > 7?7:entity.ai.walkingRange, entity.ai.walkingRange), selector); + List list = entity.worldObj.getEntitiesWithinAABBExcludingEntity(entity, entity.boundingBox.expand(entity.ais.walkingRange, entity.ais.walkingRange > 7?7:entity.ais.walkingRange, entity.ais.walkingRange), selector); Iterator ita = list.iterator(); while(ita.hasNext()){ EntityNPCInterface npc = ita.next(); - if(!npc.ai.stopAndInteract || npc.isAttacking() || !npc.isEntityAlive() || entity.faction.isAggressiveToNpc(npc)) + if(!npc.ais.stopAndInteract || npc.isAttacking() || !npc.isEntityAlive() || entity.faction.isAggressiveToNpc(npc)) ita.remove(); } - + if(list.isEmpty()) return null; - + return list.get(entity.getRNG().nextInt(list.size())); } private Vec3 getVec(){ - if(entity.ai.walkingRange > 0){ + if(entity.ais.walkingRange > 0){ double distance = this.entity.getDistanceSq(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos()); - int range = (int) MathHelper.sqrt_double(this.entity.ai.walkingRange * this.entity.ai.walkingRange - distance); + int range = (int) MathHelper.sqrt_double(this.entity.ais.walkingRange * this.entity.ais.walkingRange - distance); if(range > ConfigMain.NpcNavRange) range = ConfigMain.NpcNavRange; if(range < 3){ - range = this.entity.ai.walkingRange; + range = this.entity.ais.walkingRange; if(range > ConfigMain.NpcNavRange) range = ConfigMain.NpcNavRange; Vec3 start = Vec3.createVectorHelper(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos()); @@ -121,7 +121,7 @@ public class EntityAIWander extends EntityAIBase entity.saySurrounding(line); else nearbyNPC.saySurrounding(line); - + entity.addInteract(nearbyNPC); nearbyNPC.addInteract(entity); } diff --git a/src/main/java/noppes/npcs/ai/EntityAIWaterNav.java b/src/main/java/noppes/npcs/ai/EntityAIWaterNav.java index 42e34b43e..d11a02e80 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIWaterNav.java +++ b/src/main/java/noppes/npcs/ai/EntityAIWaterNav.java @@ -20,7 +20,7 @@ public class EntityAIWaterNav extends EntityAIBase { if (this.theEntity.isInWater() || this.theEntity.handleLavaMovement()) { - if (this.theEntity.ai.canSwim) + if (this.theEntity.ais.canSwim) { return true; } @@ -28,7 +28,7 @@ public class EntityAIWaterNav extends EntityAIBase { return true; } - + } return false; } diff --git a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java index c9bca0579..3cb10e62b 100644 --- a/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java +++ b/src/main/java/noppes/npcs/ai/pathfinder/FlyPathFinder.java @@ -92,7 +92,7 @@ public class FlyPathFinder extends PathFinder { int i; - if (((EntityNPCInterface)theEntity).ai.canSwim && this.theEntity.isInWater()) + if (((EntityNPCInterface)theEntity).ais.canSwim && this.theEntity.isInWater()) { i = (int)this.theEntity.boundingBox.minY; BlockPos.MutableBlockPos muteBlock = new BlockPos.MutableBlockPos(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ)); @@ -132,7 +132,7 @@ public class FlyPathFinder extends PathFinder return openPoint(blockpos1.getX(), i, blockpos1.getZ()); } - + public NPCPathPoint getPathPointToCoords(Entity entityIn, double x, double y, double z) { @@ -661,7 +661,7 @@ public class FlyPathFinder extends PathFinder int entitySizeX = MathHelper.floor_double(this.theEntity.width + 1.0F); int entitySizeY = MathHelper.floor_double(this.theEntity.height + 1.0F); int entitySizeZ = MathHelper.floor_double(this.theEntity.width + 1.0F); - return this.getPathNodeType(this.worldMap, p_192558_2_, p_192558_3_, p_192558_4_, p_192558_1_, entitySizeX, entitySizeY, entitySizeZ, ((EntityCustomNpc)this.theEntity).ai.doorInteract == 0, ((EntityCustomNpc)this.theEntity).ai.doorInteract == 1); + return this.getPathNodeType(this.worldMap, p_192558_2_, p_192558_3_, p_192558_4_, p_192558_1_, entitySizeX, entitySizeY, entitySizeZ, ((EntityCustomNpc)this.theEntity).ais.doorInteract == 0, ((EntityCustomNpc)this.theEntity).ais.doorInteract == 1); } public PathNodeType checkNeighborBlocks(IBlockAccess worldmap, int x, int y, int z, PathNodeType type) @@ -735,7 +735,7 @@ public class FlyPathFinder extends PathFinder { if (material == Material.water) { - return ((EntityNPCInterface)this.theEntity).ai.canSwim ? PathNodeType.OPEN : PathNodeType.WATER; + return ((EntityNPCInterface)this.theEntity).ais.canSwim ? PathNodeType.OPEN : PathNodeType.WATER; } else if (material == Material.lava) { diff --git a/src/main/java/noppes/npcs/ai/pathfinder/FlyingMoveHelper.java b/src/main/java/noppes/npcs/ai/pathfinder/FlyingMoveHelper.java index 59e4273bc..292b8158c 100644 --- a/src/main/java/noppes/npcs/ai/pathfinder/FlyingMoveHelper.java +++ b/src/main/java/noppes/npcs/ai/pathfinder/FlyingMoveHelper.java @@ -28,7 +28,7 @@ public class FlyingMoveHelper extends EntityMoveHelper{ this.update = false; double speed = this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); - double verticalSpeed = this.speed * this.entity.ai.flySpeed/8.0D; + double verticalSpeed = this.speed * this.entity.ais.flySpeed/8.0D; this.entity.setAIMoveSpeed((float)speed); double d0 = this.posX - this.entity.posX; @@ -45,7 +45,7 @@ public class FlyingMoveHelper extends EntityMoveHelper{ this.entity.motionX += (speed * (d0 / d5) - this.entity.motionX) * speed; this.entity.motionZ += (speed * (d2 / d5) - this.entity.motionZ) * speed; - if (((EntityNPCFlying)this.entity).flyLimitAllow || !this.entity.ai.hasFlyLimit) { + if (((EntityNPCFlying)this.entity).flyLimitAllow || !this.entity.ais.hasFlyLimit) { this.entity.motionY = verticalSpeed * (d1 / d5); if (this.entity.motionY > 0) { this.entity.motionY += 0.1D; diff --git a/src/main/java/noppes/npcs/ai/selector/NPCAttackSelector.java b/src/main/java/noppes/npcs/ai/selector/NPCAttackSelector.java index fbc215f11..ea355009c 100644 --- a/src/main/java/noppes/npcs/ai/selector/NPCAttackSelector.java +++ b/src/main/java/noppes/npcs/ai/selector/NPCAttackSelector.java @@ -31,20 +31,20 @@ public class NPCAttackSelector implements IEntitySelector public boolean isEntityApplicable(Entity entity){ if(!entity.isEntityAlive() || entity == npc || npc.getDistanceToEntity(entity) > npc.stats.aggroRange || !(entity instanceof EntityLivingBase) || ((EntityLivingBase)entity).getHealth() < 1) return false; - if (this.npc.ai.directLOS && !this.npc.getEntitySenses().canSee(entity)) + if (this.npc.ais.directLOS && !this.npc.getEntitySenses().canSee(entity)) return false; if(!npc.stats.attackInvisible &&((EntityLivingBase)entity).isPotionActive(Potion.invisibility) && npc.getDistanceSqToEntity(entity) < 9) return false; //prevent the npc from going on an endless killing spree - if(!npc.isFollower() && npc.ai.returnToStart){ + if(!npc.isFollower() && npc.ais.returnToStart){ int allowedDistance = npc.stats.aggroRange * 2; - if(npc.ai.movingType == EnumMovingType.Wandering) - allowedDistance += npc.ai.walkingRange; + if(npc.ais.movingType == EnumMovingType.Wandering) + allowedDistance += npc.ais.walkingRange; double distance = entity.getDistanceSq(npc.getStartXPos(), npc.getStartYPos(), npc.getStartZPos()); - if(npc.ai.movingType == EnumMovingType.MovingPath){ - int[] arr = npc.ai.getCurrentMovingPath(); + if(npc.ais.movingType == EnumMovingType.MovingPath){ + int[] arr = npc.ais.getCurrentMovingPath(); distance = entity.getDistanceSq(arr[0], arr[1], arr[2]); } diff --git a/src/main/java/noppes/npcs/ai/selector/NPCInteractSelector.java b/src/main/java/noppes/npcs/ai/selector/NPCInteractSelector.java index 5b4387b5f..a23c5e8b9 100644 --- a/src/main/java/noppes/npcs/ai/selector/NPCInteractSelector.java +++ b/src/main/java/noppes/npcs/ai/selector/NPCInteractSelector.java @@ -14,7 +14,7 @@ public class NPCInteractSelector implements IEntitySelector { if(entity == npc || !(entity instanceof EntityNPCInterface) || !npc.isEntityAlive()) return false; EntityNPCInterface selected = (EntityNPCInterface) entity; - if(selected.isAttacking() || npc.getFaction().isAggressiveToNpc(selected) || !npc.ai.stopAndInteract) + if(selected.isAttacking() || npc.getFaction().isAggressiveToNpc(selected) || !npc.ais.stopAndInteract) return false; return true; } diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcPather.java b/src/main/java/noppes/npcs/client/gui/GuiNpcPather.java index 1421a17b2..916748f08 100644 --- a/src/main/java/noppes/npcs/client/gui/GuiNpcPather.java +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcPather.java @@ -31,7 +31,7 @@ public class GuiNpcPather extends GuiNPCInterface implements IGuiData{ xSize = 176; title = "Npc Pather"; setBackground("smallbg.png"); - ai = npc.ai; + ai = npc.ais; PacketClient.sendClient(new MovingPathGetPacket()); } @Override diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAI.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAI.java index bf3fefef4..dafe8f50d 100644 --- a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAI.java +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAI.java @@ -18,7 +18,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG private DataAI ai; public GuiNpcAI(EntityNPCInterface npc) { super(npc,6); - ai = npc.ai; + ai = npc.ais; PacketClient.sendClient(new MainmenuAIGetPacket()); } @@ -26,24 +26,24 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG { super.initGui(); addLabel(new GuiNpcLabel(0,"ai.enemyresponse", guiLeft + 5, guiTop + 17)); - addButton(new GuiNpcButton(0,guiLeft + 86, guiTop + 10, 60, 20, new String[]{"gui.retaliate","gui.panic","gui.retreat","gui.nothing"} ,npc.ai.onAttack)); + addButton(new GuiNpcButton(0,guiLeft + 86, guiTop + 10, 60, 20, new String[]{"gui.retaliate","gui.panic","gui.retreat","gui.nothing"} ,npc.ais.onAttack)); addLabel(new GuiNpcLabel(1,"ai.door", guiLeft + 5, guiTop + 40)); - addButton(new GuiNpcButton(1,guiLeft + 86, guiTop + 35, 60, 20, new String[]{"gui.break","gui.open","gui.disabled"} ,npc.ai.doorInteract)); + addButton(new GuiNpcButton(1,guiLeft + 86, guiTop + 35, 60, 20, new String[]{"gui.break","gui.open","gui.disabled"} ,npc.ais.doorInteract)); addLabel(new GuiNpcLabel(12,"ai.swim", guiLeft + 5, guiTop + 65)); - addButton(new GuiNpcButton(7,guiLeft + 86, guiTop + 60, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.canSwim ? 1:0)); + addButton(new GuiNpcButton(7,guiLeft + 86, guiTop + 60, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ais.canSwim ? 1:0)); addLabel(new GuiNpcLabel(13,"ai.shelter", guiLeft + 5, guiTop + 90)); - addButton(new GuiNpcButton(9,guiLeft + 86, guiTop + 85, 60, 20, new String[]{"gui.darkness","gui.sunlight","gui.disabled"} ,npc.ai.findShelter)); + addButton(new GuiNpcButton(9,guiLeft + 86, guiTop + 85, 60, 20, new String[]{"gui.darkness","gui.sunlight","gui.disabled"} ,npc.ais.findShelter)); addLabel(new GuiNpcLabel(14,"ai.clearlos", guiLeft + 5, guiTop + 115)); - addButton(new GuiNpcButton(10,guiLeft + 86, guiTop + 110, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.directLOS ? 1:0)); + addButton(new GuiNpcButton(10,guiLeft + 86, guiTop + 110, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ais.directLOS ? 1:0)); addLabel(new GuiNpcLabel(18,"ai.sprint", guiLeft + 5, guiTop + 140)); - addButton(new GuiNpcButton(16,guiLeft + 86, guiTop + 135, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.canSprint ? 1:0)); + addButton(new GuiNpcButton(16,guiLeft + 86, guiTop + 135, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ais.canSprint ? 1:0)); addLabel(new GuiNpcLabel(10,"ai.avoidwater", guiLeft + 150, guiTop + 17)); - addButton(new GuiNpcButton(5, guiLeft + 230, guiTop + 10, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ai.avoidsWater ? 1:0)); + addButton(new GuiNpcButton(5, guiLeft + 230, guiTop + 10, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ais.avoidsWater ? 1:0)); addLabel(new GuiNpcLabel(11,"ai.return", guiLeft + 150, guiTop + 40)); - addButton(new GuiNpcButton(6, guiLeft + 230, guiTop + 35, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ai.returnToStart ? 1:0)); + addButton(new GuiNpcButton(6, guiLeft + 230, guiTop + 35, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ais.returnToStart ? 1:0)); addLabel(new GuiNpcLabel(17,"ai.leapattarget", guiLeft + 150, guiTop + 65)); - addButton(new GuiNpcButton(15,guiLeft + 230, guiTop + 60, 60, 20, new String[]{"gui.no", "ai.jump", "ai.pounce"} ,npc.ai.leapType)); + addButton(new GuiNpcButton(15,guiLeft + 230, guiTop + 60, 60, 20, new String[]{"gui.no", "ai.jump", "ai.pounce"} ,npc.ais.leapType)); addLabel(new GuiNpcLabel(15, "ai.indirect", guiLeft + 150, guiTop + 90)); addButton(new GuiNpcButton(13, guiLeft + 230, guiTop + 85, 60, 20, new String[]{"gui.no", "gui.whendistant", "gui.whenhidden"}, ai.canFireIndirect)); addLabel(new GuiNpcLabel(16, "ai.rangemelee", guiLeft + 150, guiTop + 115)); @@ -85,7 +85,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG } else if (ai.combatPolicy == EnumCombatPolicy.Tactical) { - addButton(new GuiNpcButton(40, guiLeft + 295, guiTop + 160, 60, 20, new String[]{"stats.normal","stats.reverse"}, npc.ai.tacticalChance > 50 ? 1:0)); + addButton(new GuiNpcButton(40, guiLeft + 295, guiTop + 160, 60, 20, new String[]{"stats.normal","stats.reverse"}, npc.ais.tacticalChance > 50 ? 1:0)); } getButton(17).setEnabled(this.ai.onAttack == 0); diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java b/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java index 9161db30a..43c998667 100644 --- a/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java +++ b/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java @@ -15,7 +15,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IChatComponent; import net.minecraft.util.ResourceLocation; import noppes.npcs.NoppesStringUtils; -import noppes.npcs.NoppesUtilPlayer; import noppes.npcs.api.handler.data.IDialogImage; import noppes.npcs.client.ClientProxy; import noppes.npcs.client.NoppesUtil; @@ -25,7 +24,6 @@ import noppes.npcs.client.gui.util.GuiNPCInterface; import noppes.npcs.client.gui.util.IGuiClose; import noppes.npcs.config.ConfigClient; import noppes.npcs.constants.EnumOptionType; -import noppes.npcs.constants.EnumPlayerPacket; import noppes.npcs.controllers.data.Dialog; import noppes.npcs.controllers.data.DialogImage; import noppes.npcs.controllers.data.DialogOption; @@ -137,8 +135,8 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose float f7 = npc.rotationYawHead; float f5 = (float)(l) - i; float f6 = (float)(i1 - 50) - j; - int rotation = npc.ai.orientation; - npc.ai.orientation = 0; + int rotation = npc.ais.orientation; + npc.ais.orientation = 0; GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(-135F, 0.0F, 1.0F, 0.0F); @@ -155,7 +153,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose RenderManager.instance.renderEntityWithPosYaw(npc, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); } catch(Exception ignored){} - npc.ai.orientation = rotation; + npc.ais.orientation = rotation; npc.renderYawOffset = f2; npc.rotationYaw = f3; npc.rotationPitch = f4; diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface.java b/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface.java index 27b0f55e1..a8a3c7731 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface.java @@ -261,9 +261,9 @@ public abstract class GuiContainerNPCInterface extends GuiContainer float f6 = (float) ((guiTop + y) - 50) - mouseY; int orientation = 0; if(npc != null){ - if(npc.ai != null){ - orientation = npc.ai.orientation; - npc.ai.orientation = 0; + if(npc.ais != null){ + orientation = npc.ais.orientation; + npc.ais.orientation = 0; } } GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F); @@ -282,8 +282,8 @@ public abstract class GuiContainerNPCInterface extends GuiContainer npc.rotationPitch = f4; npc.rotationYawHead = f7; if(npc != null){ - if(npc.ai != null){ - npc.ai.orientation = orientation; + if(npc.ais != null){ + npc.ais.orientation = orientation; } } npc.isDrawn = false; diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java b/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java index 8cf1a20d0..65835fa6b 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java @@ -426,8 +426,8 @@ public abstract class GuiNPCInterface extends GuiScreen { float f6 = (float) ((guiTop + y) - 50 * scale * zoomed) - mouseY; int orientation = 0; if (npc != null) { - orientation = npc.ai.orientation; - npc.ai.orientation = rotation; + orientation = npc.ais.orientation; + npc.ais.orientation = rotation; } GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F); @@ -446,7 +446,7 @@ public abstract class GuiNPCInterface extends GuiScreen { entity.prevRotationPitch = entity.rotationPitch = f4; entity.prevRotationYawHead = entity.rotationYawHead = f7; if (npc != null) { - npc.ai.orientation = orientation; + npc.ais.orientation = orientation; } GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java index baa3d1720..19e9ce232 100644 --- a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java @@ -153,13 +153,13 @@ public class RenderNPCInterface extends RenderLiving{ shadowSize = npc.display.modelSize / 10f; float xOffset = 0; - float yOffset = npc.currentAnimation == EnumAnimation.NONE?npc.ai.bodyOffsetY / 10 - 0.5f:0; + float yOffset = npc.currentAnimation == EnumAnimation.NONE?npc.ais.bodyOffsetY / 10 - 0.5f:0; float zOffset = 0; if(npc.isEntityAlive()){ if(npc.isPlayerSleeping()){ - xOffset = (float) -Math.cos(Math.toRadians(180 - npc.ai.orientation)); - zOffset = (float) -Math.sin(Math.toRadians(npc.ai.orientation)); + xOffset = (float) -Math.cos(Math.toRadians(180 - npc.ais.orientation)); + zOffset = (float) -Math.sin(Math.toRadians(npc.ais.orientation)); yOffset += 0.14f; } else if(npc.isRiding()){ @@ -180,7 +180,7 @@ public class RenderNPCInterface extends RenderLiving{ EntityNPCInterface npc = (EntityNPCInterface) entity; if(npc.isEntityAlive() && npc.isPlayerSleeping()) { - GL11.glRotatef(npc.ai.orientation, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(npc.ais.orientation, 0.0F, 1.0F, 0.0F); GL11.glRotatef(getDeathMaxRotation(npc), 0.0F, 0.0F, 1.0F); GL11.glRotatef(270F, 0.0F, 1.0F, 0.0F); } @@ -216,8 +216,8 @@ public class RenderNPCInterface extends RenderLiving{ if((npc.display.showBossBar == 1 || npc.display.showBossBar == 2 && npc.isAttacking()) && !npc.isKilled() && npc.deathTime <= 20 && npc.canSee(Minecraft.getMinecraft().thePlayer)) BossStatus.setBossStatus(npc, true); - if(npc.ai.standingType == EnumStandingType.HeadRotation && !npc.isWalking() && !npc.isInteracting()){ - npc.prevRenderYawOffset = npc.renderYawOffset = npc.ai.orientation; + if(npc.ais.standingType == EnumStandingType.HeadRotation && !npc.isWalking() && !npc.isInteracting()){ + npc.prevRenderYawOffset = npc.renderYawOffset = npc.ais.orientation; } staticRenderManager = this.renderManager; diff --git a/src/main/java/noppes/npcs/controllers/LinkedNpcController.java b/src/main/java/noppes/npcs/controllers/LinkedNpcController.java index 3685affd6..35cc8ae9b 100644 --- a/src/main/java/noppes/npcs/controllers/LinkedNpcController.java +++ b/src/main/java/noppes/npcs/controllers/LinkedNpcController.java @@ -18,7 +18,7 @@ import java.util.List; public class LinkedNpcController { public static LinkedNpcController Instance; public List list = new ArrayList(); - + public LinkedNpcController(){ Instance = this; load(); @@ -30,14 +30,14 @@ public class LinkedNpcController { LogWriter.except(e); } } - + public File getDir(){ File dir = new File(CustomNpcs.getWorldSaveDirectory(), "linkednpcs"); if(!dir.exists()) dir.mkdir(); return dir; } - + private void loadNpcs(){ LogWriter.info("Loading Linked Npcs"); File dir = getDir(); @@ -56,12 +56,12 @@ public class LinkedNpcController { } } } - + this.list = list; } LogWriter.info("Done loading Linked Npcs"); } - + public void save(){ for(LinkedData npc : list){ try { @@ -71,17 +71,17 @@ public class LinkedNpcController { } } } - + private void saveNpc(LinkedData npc) throws IOException { File file = new File(getDir(), npc.name + ".json_new"); - File file1 = new File(getDir(), npc.name + ".json"); + File file1 = new File(getDir(), npc.name + ".json"); try{ NBTJsonUtil.SaveFile(file, npc.getNBT()); if(file1.exists()){ file1.delete(); } file.renameTo(file1); - + } catch (JsonException e) { LogWriter.except(e); } @@ -91,16 +91,16 @@ public class LinkedNpcController { public String name = "LinkedNpc"; public long time = 0; public NBTTagCompound data = new NBTTagCompound(); - + public LinkedData(){ time = System.currentTimeMillis(); } - + public void setNBT(NBTTagCompound compound){ name = compound.getString("LinkedName"); data = compound.getCompoundTag("NPCData"); } - + public NBTTagCompound getNBT(){ NBTTagCompound compound = new NBTTagCompound(); compound.setString("LinkedName", name); @@ -123,29 +123,29 @@ public class LinkedNpcController { if(npc.posX == 0 && npc.posY == 0 && npc.posX == 0) return; npc.linkedLast = data.time; - List points = npc.ai.getMovingPath(); + List points = npc.ais.getMovingPath(); NBTTagCompound compound = NBTTags.NBTMerge(readNpcData(npc), data.data); - + npc.display.readToNBT(compound); npc.stats.readToNBT(compound); npc.advanced.readToNBT(compound); npc.inventory.readEntityFromNBT(compound); if(compound.hasKey("ModelData")) ((EntityCustomNpc)npc).modelData.readFromNBT(compound.getCompoundTag("ModelData")); - - npc.ai.readToNBT(compound); + + npc.ais.readToNBT(compound); npc.transform.readToNBT(compound); - npc.ai.setMovingPath(points); - + npc.ais.setMovingPath(points); + npc.updateClient = true; } } - + private void cleanTags(NBTTagCompound compound){ compound.removeTag("MovingPathNew"); } - + public LinkedData getData(String name){ for(LinkedData data : list){ if(data.name.equalsIgnoreCase(name)) @@ -153,26 +153,26 @@ public class LinkedNpcController { } return null; } - + private NBTTagCompound readNpcData(EntityNPCInterface npc){ NBTTagCompound compound = new NBTTagCompound(); npc.display.writeToNBT(compound); npc.inventory.writeEntityToNBT(compound); npc.stats.writeToNBT(compound); - npc.ai.writeToNBT(compound); + npc.ais.writeToNBT(compound); npc.advanced.writeToNBT(compound); npc.transform.writeToNBT(compound); compound.setTag("ModelData", ((EntityCustomNpc)npc).modelData.writeToNBT()); return compound; } - + public void saveNpcData(EntityNPCInterface npc) { NBTTagCompound compound = readNpcData(npc); cleanTags(compound); - + if(npc.linkedData.data.equals(compound)) return; - + npc.linkedData.data = compound; npc.linkedData.time = System.currentTimeMillis(); save(); @@ -185,11 +185,11 @@ public class LinkedNpcController { } save(); } - + public void addData(String name){ if(getData(name) != null || name.isEmpty()) return; - + LinkedData data = new LinkedData(); data.name = name; list.add(data); diff --git a/src/main/java/noppes/npcs/controllers/data/DataTransform.java b/src/main/java/noppes/npcs/controllers/data/DataTransform.java index f4f1a08e5..37a0571f0 100644 --- a/src/main/java/noppes/npcs/controllers/data/DataTransform.java +++ b/src/main/java/noppes/npcs/controllers/data/DataTransform.java @@ -68,7 +68,7 @@ public class DataTransform { isActive = compound.getBoolean("TransformIsActive"); readOptions(compound); display = hasDisplay?compound.getCompoundTag("TransformDisplay"): getDisplay(); - ai = hasAi?compound.getCompoundTag("TransformAI"): npc.ai.writeToNBT(new NBTTagCompound()); + ai = hasAi?compound.getCompoundTag("TransformAI"): npc.ais.writeToNBT(new NBTTagCompound()); advanced = hasAdvanced?compound.getCompoundTag("TransformAdvanced"): getAdvanced(); inv = hasInv?compound.getCompoundTag("TransformInv"): npc.inventory.writeEntityToNBT(new NBTTagCompound()); stats = hasStats?compound.getCompoundTag("TransformStats"): npc.stats.writeToNBT(new NBTTagCompound()); @@ -146,7 +146,7 @@ public class DataTransform { display = getDisplay(); } if(hasAi && !hadAI) - ai = npc.ai.writeToNBT(new NBTTagCompound()); + ai = npc.ais.writeToNBT(new NBTTagCompound()); if(hasStats && !hadStats) stats = npc.stats.writeToNBT(new NBTTagCompound()); if(hasInv && !hadInv) @@ -221,8 +221,8 @@ public class DataTransform { job = compoundJob; } if(hasAi){ - NBTTagCompound compound = npc.ai.writeToNBT(new NBTTagCompound()); - npc.ai.readToNBT(NBTTags.NBTMerge(compound, ai)); + NBTTagCompound compound = npc.ais.writeToNBT(new NBTTagCompound()); + npc.ais.readToNBT(NBTTags.NBTMerge(compound, ai)); ai = compound; npc.setCurrentAnimation(EnumAnimation.NONE); } diff --git a/src/main/java/noppes/npcs/entity/EntityNPCFlying.java b/src/main/java/noppes/npcs/entity/EntityNPCFlying.java index 58d5c0c67..580e646e0 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCFlying.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCFlying.java @@ -15,7 +15,7 @@ public abstract class EntityNPCFlying extends EntityNPCInterface { @Override public boolean canFly(){ - return ai.movementType == 1; + return ais.movementType == 1; } @Override @@ -46,15 +46,15 @@ public abstract class EntityNPCFlying extends EntityNPCInterface { double heightOffGround = this.posY - this.worldObj.getTopSolidOrLiquidBlock((int) this.posX, (int) this.posZ); if (heightOffGround < 0) { Vec3 pos = Vec3.createVectorHelper(this.posX,this.posY,this.posZ); - Vec3 posLimit = Vec3.createVectorHelper(this.posX,this.posY - this.ai.flyHeightLimit,this.posZ); + Vec3 posLimit = Vec3.createVectorHelper(this.posX,this.posY - this.ais.flyHeightLimit,this.posZ); MovingObjectPosition mob = this.worldObj.rayTraceBlocks(pos,posLimit,true); if (mob == null || mob.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { aboveLimit = true; } - } else if (heightOffGround > this.ai.flyHeightLimit) { + } else if (heightOffGround > this.ais.flyHeightLimit) { aboveLimit = true; } - if (aboveLimit && this.ai.hasFlyLimit || (heightOffGround < Math.ceil(this.height) && this.motionY == 0)) { + if (aboveLimit && this.ais.hasFlyLimit || (heightOffGround < Math.ceil(this.height) && this.motionY == 0)) { this.flyLimitAllow = false; if (!this.getNavigator().noPath() && this.motionY > 0) { this.motionY = 0; @@ -70,7 +70,7 @@ public abstract class EntityNPCFlying extends EntityNPCInterface { this.motionY = d3; if (this.getNavigator().noPath()) { - this.motionY = -Math.abs(this.ai.flyGravity); + this.motionY = -Math.abs(this.ais.flyGravity); } this.updateLimbSwing(); diff --git a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java index 6d5adbd45..9b826bdd2 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java @@ -88,7 +88,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti public static FakePlayer chateventPlayer; public DataDisplay display; public DataStats stats; - public DataAI ai; + public DataAI ais; public DataAdvanced advanced; public DataInventory inventory; public DataScript script; @@ -172,7 +172,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti display = new DataDisplay(this); stats = new DataStats(this); - ai = new DataAI(this); + ais = new DataAI(this); advanced = new DataAdvanced(this); inventory = new DataInventory(this); transform = new DataTransform(this); @@ -509,7 +509,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti } public void addInteract(EntityLivingBase entity){ - if( !ai.stopAndInteract || isAttacking() || !entity.isEntityAlive()) + if( !ais.stopAndInteract || isAttacking() || !entity.isEntityAlive()) return; if((ticksExisted - lastInteract) < 180) interactingEntities.clear(); @@ -522,7 +522,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti public boolean isInteracting(){ if((ticksExisted - lastInteract) < 40 || isRemote() && getBoolFlag(2)) return true; - return ai.stopAndInteract && !interactingEntities.isEmpty() && (ticksExisted - lastInteract) < 180; + return ais.stopAndInteract && !interactingEntities.isEmpty() && (ticksExisted - lastInteract) < 180; } private Dialog getDialog(EntityPlayer player) { @@ -582,21 +582,21 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti try{ if (isAttacking()){ if (getAttackTarget() != null) { - if (ai.combatPolicy != EnumCombatPolicy.Brute) { + if (ais.combatPolicy != EnumCombatPolicy.Brute) { boolean closerTargetFound = this.getDistanceSqToEntity(getAttackTarget()) > this.getDistanceSqToEntity(attackingEntity); - switch (ai.combatPolicy) { + switch (ais.combatPolicy) { case Flip: if (closerTargetFound) { setAttackTarget(attackingEntity); } break; case Stubborn: - if (closerTargetFound && combatHandler.shouldChangeTarget(ai.tacticalChance)) { + if (closerTargetFound && combatHandler.shouldChangeTarget(ais.tacticalChance)) { setAttackTarget(attackingEntity); } break; case Tactical: - if (attackingEntity != getAttackTarget() && combatHandler.shouldSwitchTactically(getAttackTarget(), attackingEntity, ai.tacticalChance > 50)) { + if (attackingEntity != getAttackTarget() && combatHandler.shouldSwitchTactically(getAttackTarget(), attackingEntity, ais.tacticalChance > 50)) { setAttackTarget(attackingEntity); } break; @@ -613,7 +613,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti if (npc.isKilled() || !npc.advanced.defendFaction || npc.faction.id != faction.id) continue; - if (npc.canSee(this) || npc.ai.directLOS || npc.canSee(attackingEntity)) + if (npc.canSee(this) || npc.ais.directLOS || npc.canSee(attackingEntity)) npc.onAttack(attackingEntity); } setAttackTarget(attackingEntity); @@ -628,7 +628,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti } } public void onAttack(EntityLivingBase entity) { - if (entity == null || entity == this || isAttacking() || ai.onAttack == 3 || entity == getOwner()) + if (entity == null || entity == this || isAttacking() || ais.onAttack == 3 || entity == getOwner()) return; super.setAttackTarget(entity); } @@ -653,7 +653,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti if(EventHooks.onNPCTargetLost(this, getAttackTarget(), entity)) return; } - if (entity != null && entity != this && ai.onAttack != 3 && !isAttacking()) { + if (entity != null && entity != this && ais.onAttack != 3 && !isAttacking()) { Line line = advanced.getAttackLine(); if (line != null) saySurrounding(line.formatTarget(entity)); @@ -726,7 +726,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti IEntitySelector attackEntitySelector = new NPCAttackSelector(this); this.targetTasks.addTask(0, new EntityAIClearTarget(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); - this.targetTasks.addTask(2, new EntityAIClosestTarget(this, EntityLivingBase.class, 4, this.ai.directLOS, false, attackEntitySelector)); + this.targetTasks.addTask(2, new EntityAIClosestTarget(this, EntityLivingBase.class, 4, this.ais.directLOS, false, attackEntitySelector)); this.targetTasks.addTask(3, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(4, new EntityAIOwnerHurtTarget(this)); @@ -760,49 +760,49 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti removeTask(aiRange); aiLeap = aiAttackTarget = aiResponse = aiSprint = aiRange = null; - if (this.ai.canSprint) + if (this.ais.canSprint) this.tasks.addTask(this.taskCount++, new EntityAISprintToTarget(this)); - if (this.ai.onAttack == 1) + if (this.ais.onAttack == 1) this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIPanic(this, 1.2F)); - else if (this.ai.onAttack == 2) { + else if (this.ais.onAttack == 2) { this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAvoidTarget(this)); } - else if (this.ai.onAttack == 0) { + else if (this.ais.onAttack == 0) { this.setLeapTask(); - if (this.inventory.getProjectile() == null || this.ai.useRangeMelee == 2) + if (this.inventory.getProjectile() == null || this.ais.useRangeMelee == 2) { - switch(this.ai.tacticalVariant) + switch(this.ais.tacticalVariant) { - case Dodge : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIZigZagTarget(this, 1.2D, this.ai.tacticalRadius)); break; - case Surround : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIOrbitTarget(this, 1.2D, this.ai.tacticalRadius, true)); break; + case Dodge : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIZigZagTarget(this, 1.2D, this.ais.tacticalRadius)); break; + case Surround : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIOrbitTarget(this, 1.2D, this.ais.tacticalRadius, true)); break; case HitNRun : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAvoidTarget(this)); break; - case Ambush : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAmbushTarget(this, 1.2D, this.ai.tacticalRadius, false)); break; - case Stalk : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIStalkTarget(this, this.ai.tacticalRadius)); break; + case Ambush : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAmbushTarget(this, 1.2D, this.ais.tacticalRadius, false)); break; + case Stalk : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIStalkTarget(this, this.ais.tacticalRadius)); break; default : } } else { - switch(this.ai.tacticalVariant) + switch(this.ais.tacticalVariant) { case Dodge : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIDodgeShoot(this)); break; case Surround : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIOrbitTarget(this, 1.2D, stats.rangedRange, false)); break; case HitNRun : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAvoidTarget(this)); break; - case Ambush : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAmbushTarget(this, 1.2D, this.ai.tacticalRadius, false)); break; - case Stalk : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIStalkTarget(this, this.ai.tacticalRadius)); break; + case Ambush : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAmbushTarget(this, 1.2D, this.ais.tacticalRadius, false)); break; + case Stalk : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIStalkTarget(this, this.ais.tacticalRadius)); break; default : } } this.tasks.addTask(this.taskCount, aiAttackTarget = new EntityAIAttackTarget(this)); - ((EntityAIAttackTarget)aiAttackTarget).navOverride(ai.tacticalVariant == EnumNavType.None); + ((EntityAIAttackTarget)aiAttackTarget).navOverride(ais.tacticalVariant == EnumNavType.None); if(this.inventory.getProjectile() != null){ this.tasks.addTask(this.taskCount++, aiRange = new EntityAIRangedAttack(this)); - aiRange.navOverride(ai.tacticalVariant == EnumNavType.None); + aiRange.navOverride(ais.tacticalVariant == EnumNavType.None); } } - else if (this.ai.onAttack == 3) { + else if (this.ais.onAttack == 3) { //do nothing } } @@ -811,10 +811,10 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti * Branch task function for setting if an NPC wanders or not */ public void setMoveType(){ - if (ai.movingType == EnumMovingType.Wandering){ + if (ais.movingType == EnumMovingType.Wandering){ this.tasks.addTask(this.taskCount++, new EntityAIWander(this)); } - if (ai.movingType == EnumMovingType.MovingPath){ + if (ais.movingType == EnumMovingType.MovingPath){ this.tasks.addTask(this.taskCount++, new EntityAIMovingPath(this)); } } @@ -825,11 +825,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti if(canFly()) //currently flying does not support opening doors return; EntityAIBase aiDoor = null; - if (this.ai.doorInteract == 1) + if (this.ais.doorInteract == 1) { this.tasks.addTask(this.taskCount++, aiDoor = new EntityAIOpenDoor(this, true)); } - else if (this.ai.doorInteract == 0) + else if (this.ais.doorInteract == 0) { this.tasks.addTask(this.taskCount++, aiDoor = new EntityAIBustDoor(this)); } @@ -840,11 +840,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti * Branch task function for finding shelter under the appropriate conditions */ public void seekShelter() { - if (this.ai.findShelter == 0) + if (this.ais.findShelter == 0) { this.tasks.addTask(this.taskCount++, new EntityAIMoveIndoors(this)); } - else if (this.ai.findShelter == 1) + else if (this.ais.findShelter == 1) { if(!canFly()) // doesnt work when flying this.tasks.addTask(this.taskCount++, new EntityAIRestrictSun(this)); @@ -856,9 +856,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti * Branch task function for leaping */ public void setLeapTask() { - if (this.ai.leapType == 1) + if (this.ais.leapType == 1) this.tasks.addTask(this.taskCount++, aiLeap = new EntityAILeapAtTarget(this, 0.4F)); - if (this.ai.leapType == 2) + if (this.ais.leapType == 2) this.tasks.addTask(this.taskCount++, aiLeap = new EntityAIPounceTarget(this)); } @@ -868,7 +868,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti public void addRegularEntries() { this.tasks.addTask(this.taskCount++, new EntityAIFollow(this)); this.tasks.addTask(this.taskCount++, new EntityAIReturn(this)); - if (this.ai.standingType != EnumStandingType.NoRotation && this.ai.standingType != EnumStandingType.HeadRotation) + if (this.ais.standingType != EnumStandingType.NoRotation && this.ais.standingType != EnumStandingType.HeadRotation) this.tasks.addTask(this.taskCount++, new EntityAIWatchClosest(this, EntityLivingBase.class, 5.0F)); this.tasks.addTask(this.taskCount++, new EntityAILook(this)); this.tasks.addTask(this.taskCount++, new EntityAIWorldLines(this)); @@ -883,7 +883,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti * Function for getting proper move speeds. This way we don't have to modify them every time we use them. */ public float getSpeed() { - return (float)ai.getWalkingSpeed() / 20.0F; + return (float) ais.getWalkingSpeed() / 20.0F; } @Override @@ -1042,7 +1042,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti display.readToNBT(compound); stats.readToNBT(compound); - ai.readToNBT(compound); + ais.readToNBT(compound); script.readFromNBT(compound); script.readEventsFromNBT(compound); timers.readFromNBT(compound); @@ -1076,7 +1076,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti super.writeEntityToNBT(compound); display.writeToNBT(compound); stats.writeToNBT(compound); - ai.writeToNBT(compound); + ais.writeToNBT(compound); script.writeToNBT(compound); script.writeEventsToNBT(compound); timers.writeToNBT(compound); @@ -1160,7 +1160,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti this.setRevengeTarget(null); this.deathTime = 0; //fleeingTick = 0; - if(ai.returnToStart && !hasOwner() && !this.isRemote()) + if(ais.returnToStart && !hasOwner() && !this.isRemote()) setLocationAndAngles(getStartXPos(), getStartYPos(), getStartZPos(), rotationYaw, rotationPitch); killedtime = 0; extinguish(); @@ -1176,7 +1176,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti currentAnimation = EnumAnimation.NONE; updateHitbox(); updateAI = true; - ai.movingPos = 0; + ais.movingPos = 0; if(getOwner() != null){ getOwner().setLastAttacker(null); } @@ -1399,20 +1399,20 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti public float getStartXPos(){ - return getStartPos()[0] + ai.bodyOffsetX / 10; + return getStartPos()[0] + ais.bodyOffsetX / 10; } public float getStartZPos(){ - return getStartPos()[2] + ai.bodyOffsetZ / 10; + return getStartPos()[2] + ais.bodyOffsetZ / 10; } public int[] getStartPos(){ - if(ai.startPos == null || ai.startPos.length != 3) - ai.startPos = new int[] { + if(ais.startPos == null || ais.startPos.length != 3) + ais.startPos = new int[] { MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ) }; - return ai.startPos; + return ais.startPos; } public boolean isVeryNearAssignedPlace() { @@ -1513,7 +1513,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti } public boolean isWalking() { - return ai.movingType != EnumMovingType.Standing || isAttacking() || isFollower() || getBoolFlag(1); + return ais.movingType != EnumMovingType.Standing || isAttacking() || isFollower() || getBoolFlag(1); } public void setBoolFlag(boolean bo, int id){ @@ -1636,12 +1636,12 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti compound.setDouble("MaxHealth", stats.maxHealth); compound.setTag("Armor", NBTTags.nbtItemStackList(inventory.getArmor())); compound.setTag("Weapons", NBTTags.nbtItemStackList(inventory.getWeapons())); - compound.setInteger("Speed", ai.getWalkingSpeed()); + compound.setInteger("Speed", ais.getWalkingSpeed()); compound.setBoolean("DeadBody", stats.hideKilledBody); - compound.setInteger("StandingState", ai.standingType.ordinal()); - compound.setInteger("MovingState", ai.movingType.ordinal()); - compound.setInteger("Orientation", ai.orientation); - compound.setFloat("OffsetY",ai.bodyOffsetY); + compound.setInteger("StandingState", ais.standingType.ordinal()); + compound.setInteger("MovingState", ais.movingType.ordinal()); + compound.setInteger("Orientation", ais.orientation); + compound.setFloat("OffsetY", ais.bodyOffsetY); compound.setInteger("Role", advanced.role.ordinal()); compound.setInteger("Job", advanced.job.ordinal()); if(advanced.job == EnumJobType.Bard){ @@ -1669,12 +1669,12 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti } public void readSpawnData(NBTTagCompound compound) { stats.maxHealth = compound.getDouble("MaxHealth"); - ai.setWalkingSpeed(compound.getInteger("Speed")); + ais.setWalkingSpeed(compound.getInteger("Speed")); stats.hideKilledBody = compound.getBoolean("DeadBody"); - ai.standingType = EnumStandingType.values()[compound.getInteger("StandingState") % EnumStandingType.values().length]; - ai.movingType = EnumMovingType.values()[compound.getInteger("MovingState") % EnumMovingType.values().length]; - ai.orientation = compound.getInteger("Orientation"); - ai.bodyOffsetY=compound.getFloat("OffsetY"); + ais.standingType = EnumStandingType.values()[compound.getInteger("StandingState") % EnumStandingType.values().length]; + ais.movingType = EnumMovingType.values()[compound.getInteger("MovingState") % EnumMovingType.values().length]; + ais.orientation = compound.getInteger("Orientation"); + ais.bodyOffsetY=compound.getFloat("OffsetY"); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(stats.maxHealth); inventory.setArmor(NBTTags.getItemStackList(compound.getTagList("Armor", 10))); @@ -1750,7 +1750,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti public void setAvoidWater(boolean avoidWater) { this.getNavigator().setAvoidsWater(avoidWater); - ai.avoidsWater = avoidWater; + ais.avoidsWater = avoidWater; } @Override protected void fall(float par1) { @@ -1947,7 +1947,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti @Override public void setHomeArea(int x, int y, int z, int range){ super.setHomeArea(x, y, z, range); - ai.startPos = new int[]{x, y, z}; + ais.startPos = new int[]{x, y, z}; } @Override diff --git a/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterFemale.java b/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterFemale.java index a41398172..e66c806b8 100644 --- a/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterFemale.java +++ b/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterFemale.java @@ -39,7 +39,7 @@ public class EntityNpcMonsterFemale extends EntityNPCInterface data.modelScale.legs.setScale(0.92f,0.92f); data.modelScale.arms.setScale(0.80f,0.92f); data.modelScale.body.setScale(0.92f, 0.92f); - npc.ai.animationType = EnumAnimation.HUG; + npc.ais.animationType = EnumAnimation.HUG; worldObj.spawnEntityInWorld(npc); } super.onUpdate(); diff --git a/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterMale.java b/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterMale.java index f01bf1cb3..2a81ac253 100644 --- a/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterMale.java +++ b/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterMale.java @@ -1,6 +1,6 @@ // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html -// Decompiler options: packimports(3) braces deadcode fieldsfirst +// Decompiler options: packimports(3) braces deadcode fieldsfirst package noppes.npcs.entity.old; @@ -11,7 +11,7 @@ import noppes.npcs.entity.EntityCustomNpc; import noppes.npcs.entity.EntityNPCInterface; // Referenced classes of package net.minecraft.src: -// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, // ItemStack, World, NBTTagCompound public class EntityNpcMonsterMale extends EntityNPCInterface @@ -21,17 +21,17 @@ public class EntityNpcMonsterMale extends EntityNPCInterface super(world); display.texture = "customnpcs:textures/entity/monstermale/ZombieSteve.png"; } - + public void onUpdate(){ isDead = true; if(!worldObj.isRemote){ NBTTagCompound compound = new NBTTagCompound(); - + writeToNBT(compound); EntityCustomNpc npc = new EntityCustomNpc(worldObj); npc.readFromNBT(compound); - npc.ai.animationType = EnumAnimation.HUG; + npc.ais.animationType = EnumAnimation.HUG; worldObj.spawnEntityInWorld(npc); } super.onUpdate(); diff --git a/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java b/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java index eaf5eab05..bb758e178 100644 --- a/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java +++ b/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java @@ -46,7 +46,7 @@ public class ItemNpcMovingPath extends Item{ EntityNPCInterface npc = getNpc(par1ItemStack, par3World); if(npc == null) return false; - List list = npc.ai.getMovingPath(); + List list = npc.ais.getMovingPath(); int[] pos = list.get(list.size() - 1); list.add(new int[]{x,y,z}); diff --git a/src/main/java/noppes/npcs/items/ItemNpcWand.java b/src/main/java/noppes/npcs/items/ItemNpcWand.java index 7a12585dd..6d6477f5a 100644 --- a/src/main/java/noppes/npcs/items/ItemNpcWand.java +++ b/src/main/java/noppes/npcs/items/ItemNpcWand.java @@ -49,7 +49,7 @@ public class ItemNpcWand extends Item{ } else if(CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.NPC_CREATE)){ EntityCustomNpc npc = new EntityCustomNpc(par3World); - npc.ai.startPos = new int[]{par4,par5,par6}; + npc.ais.startPos = new int[]{par4,par5,par6}; npc.setLocationAndAngles((float)par4 + 0.5F, npc.getStartYPos(), (float)par6 + 0.5F, player.rotationYaw, player.rotationPitch); diff --git a/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java b/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java index 686f52a86..6e3480040 100644 --- a/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java +++ b/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java @@ -41,7 +41,7 @@ public class ItemSoulstoneFilled extends Item { if(stack.stackTagCompound == null || !stack.stackTagCompound.hasKey("Entity", 10)){ list.add(EnumChatFormatting.RED + "Error"); return; - } + } String name = StatCollector.translateToLocal(stack.stackTagCompound.getString("Name")); if(stack.stackTagCompound.hasKey("DisplayName")) name = stack.stackTagCompound.getString("DisplayName") + " (" + name + ")"; @@ -55,17 +55,17 @@ public class ItemSoulstoneFilled extends Item { list.add(text); } } - + @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){ if(!spawn(player, stack, world, x, y, z)) return false; - + if(!player.capabilities.isCreativeMode) stack.splitStack(1); return true; } - + public boolean spawn(EntityPlayer player, ItemStack stack, World world, int x, int y, int z){ if(world.isRemote) return true; @@ -86,7 +86,7 @@ public class ItemSoulstoneFilled extends Item { } if(entity instanceof EntityNPCInterface){ EntityNPCInterface npc = (EntityNPCInterface) entity; - npc.ai.startPos = new int[]{x, y, z}; + npc.ais.startPos = new int[]{x, y, z}; npc.setHealth(npc.getMaxHealth()); npc.setPosition((float)x + 0.5F, npc.getStartYPos(), (float)z + 0.5F); npc.advanced.soulStonePlayerName = sourceName; diff --git a/src/main/java/noppes/npcs/roles/JobSpawner.java b/src/main/java/noppes/npcs/roles/JobSpawner.java index e5aca69e1..ae1099d38 100644 --- a/src/main/java/noppes/npcs/roles/JobSpawner.java +++ b/src/main/java/noppes/npcs/roles/JobSpawner.java @@ -388,7 +388,7 @@ public class JobSpawner extends JobInterface{ if (living instanceof EntityNPCInterface) { EntityNPCInterface snpc = (EntityNPCInterface) living; snpc.stats.spawnCycle = 3; - snpc.ai.returnToStart = false; + snpc.ais.returnToStart = false; snpc.stats.canDespawn = true; snpc.stats.playerSetCanDespawn = true; } diff --git a/src/main/java/noppes/npcs/roles/RoleCompanion.java b/src/main/java/noppes/npcs/roles/RoleCompanion.java index f1a3d5c9d..7e5a904a9 100644 --- a/src/main/java/noppes/npcs/roles/RoleCompanion.java +++ b/src/main/java/noppes/npcs/roles/RoleCompanion.java @@ -36,23 +36,23 @@ public class RoleCompanion extends RoleInterface { public boolean canAge = true; public long ticksActive = 0; public EnumCompanionStage stage = EnumCompanionStage.FULLGROWN; - + public EntityPlayer owner = null; public int companionID; - + public EnumCompanionJobs job = EnumCompanionJobs.NONE; public CompanionJobInterface jobInterface = null; - - public boolean hasInv = true; + + public boolean hasInv = true; public boolean defendOwner = true; - + public CompanionFoodStats foodstats = new CompanionFoodStats(); private int eatingTicks = 20; private ItemStack eating = null; private int eatingDelay = 00; - + public int currentExp = 0; - + public RoleCompanion(EntityNPCInterface npc) { super(npc); inventory = new NpcMiscInventory(12); @@ -91,29 +91,29 @@ public class RoleCompanion extends RoleInterface { eatingDelay--; return; } - + ItemStack prev = eating; eating = getFood(); - + if(prev != null && eating == null) npc.setRoleDataWatcher(""); - + if(prev == null && eating != null){ npc.setRoleDataWatcher("eating"); eatingTicks = 20; } - + if(isEating()){ doEating(); } - + } else if(eating != null && !isSitting()){ eating = null; eatingDelay = 20; npc.setRoleDataWatcher(""); } - + ticksActive++; if(canAge && stage != EnumCompanionStage.FULLGROWN){ if(stage == EnumCompanionStage.BABY && ticksActive > EnumCompanionStage.CHILD.matureAge){ @@ -134,7 +134,7 @@ public class RoleCompanion extends RoleInterface { public void clientUpdate() { if(npc.getRoleDataWatcher().equals("eating")){ eating = getFood(); - + if(isEating()){ doEating(); } @@ -142,7 +142,7 @@ public class RoleCompanion extends RoleInterface { else if(eating != null){ eating = null; } - + } private void doEating(){ if(npc.worldObj.isRemote){ @@ -164,9 +164,9 @@ public class RoleCompanion extends RoleInterface { npc.worldObj.spawnParticle(s, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.0D, vec3.zCoord); } } - else{ + else{ eatingTicks--; - + if(eatingTicks <= 0){ if(inventory.decrStackSize(eating, 1)){ ItemFood food = (ItemFood) eating.getItem(); @@ -183,19 +183,19 @@ public class RoleCompanion extends RoleInterface { } } } - + public void matureTo(EnumCompanionStage stage){ this.stage = stage; EntityCustomNpc npc = (EntityCustomNpc) this.npc; - npc.ai.animationType = stage.animation; + npc.ais.animationType = stage.animation; if(stage == EnumCompanionStage.BABY){ npc.modelData.modelScale.arms.setScale(0.5f, 0.5f, 0.5f); npc.modelData.modelScale.legs.setScale(0.5f, 0.5f, 0.5f); npc.modelData.modelScale.body.setScale(0.5f, 0.5f, 0.5f); npc.modelData.modelScale.head.setScale(0.7f, 0.7f, 0.7f); - - npc.ai.onAttack = 1; - npc.ai.setWalkingSpeed(3); + + npc.ais.onAttack = 1; + npc.ais.setWalkingSpeed(3); if(!talents.containsKey(EnumCompanionTalent.INVENTORY)) talents.put(EnumCompanionTalent.INVENTORY, 0); } @@ -205,8 +205,8 @@ public class RoleCompanion extends RoleInterface { npc.modelData.modelScale.body.setScale(0.6f, 0.6f, 0.6f); npc.modelData.modelScale.head.setScale(0.8f, 0.8f, 0.8f); - npc.ai.onAttack = 0; - npc.ai.setWalkingSpeed(4); + npc.ais.onAttack = 0; + npc.ais.setWalkingSpeed(4); if(!talents.containsKey(EnumCompanionTalent.SWORD)) talents.put(EnumCompanionTalent.SWORD, 0); } @@ -216,10 +216,10 @@ public class RoleCompanion extends RoleInterface { npc.modelData.modelScale.body.setScale(0.8f, 0.8f, 0.8f); npc.modelData.modelScale.head.setScale(0.9f, 0.9f, 0.9f); - npc.ai.onAttack = 0; - npc.ai.setWalkingSpeed(5); + npc.ais.onAttack = 0; + npc.ais.setWalkingSpeed(5); if(!talents.containsKey(EnumCompanionTalent.ARMOR)) - talents.put(EnumCompanionTalent.ARMOR, 0); + talents.put(EnumCompanionTalent.ARMOR, 0); } if(stage == EnumCompanionStage.ADULT || stage == EnumCompanionStage.FULLGROWN){ npc.modelData.modelScale.arms.setScale(1f, 1f, 1f); @@ -227,8 +227,8 @@ public class RoleCompanion extends RoleInterface { npc.modelData.modelScale.body.setScale(1f, 1f, 1f); npc.modelData.modelScale.head.setScale(1f, 1f, 1f); - npc.ai.onAttack = 0; - npc.ai.setWalkingSpeed(5); + npc.ais.onAttack = 0; + npc.ais.setWalkingSpeed(5); } } @@ -246,13 +246,13 @@ public class RoleCompanion extends RoleInterface { compound.setBoolean("CompanionHasInv", hasInv); compound.setBoolean("CompanionDefendOwner", defendOwner); - + foodstats.writeNBT(compound); - + compound.setInteger("CompanionJob", job.ordinal()); if(jobInterface != null) compound.setTag("CompanionJobData", jobInterface.getNBT()); - + NBTTagList list = new NBTTagList(); for(EnumCompanionTalent talent : talents.keySet()){ NBTTagCompound c = new NBTTagCompound(); @@ -275,12 +275,12 @@ public class RoleCompanion extends RoleInterface { currentExp = compound.getInteger("CompanionExp"); canAge = compound.getBoolean("CompanionCanAge"); ticksActive = compound.getLong("CompanionAge"); - + hasInv = compound.getBoolean("CompanionHasInv"); defendOwner = compound.getBoolean("CompanionDefendOwner"); - + foodstats.readNBT(compound); - + NBTTagList list = compound.getTagList("CompanionTalents", 10); Map talents = new TreeMap(); for(int i = 0; i < list.tagCount(); i++){ @@ -289,7 +289,7 @@ public class RoleCompanion extends RoleInterface { talents.put(talent, c.getInteger("Exp")); } this.talents = talents; - + setJob(compound.getInteger("CompanionJob")); if(jobInterface != null) jobInterface.setNBT(compound.getCompoundTag("CompanionJobData")); @@ -306,7 +306,7 @@ public class RoleCompanion extends RoleInterface { jobInterface = new CompanionGuard(); else jobInterface = null; - + if(jobInterface != null) jobInterface.npc = npc; } @@ -324,37 +324,37 @@ public class RoleCompanion extends RoleInterface { setSitting(!isSitting()); } } - + public int getTotalLevel(){ int level = 0; for(EnumCompanionTalent talent : talents.keySet()) level += this.getTalentLevel(talent); return level; } - + public int getMaxExp(){ return 500 + getTotalLevel() * 200; } - + public void addExp(int exp){ if(canAddExp(exp)) this.currentExp += exp; } - + public boolean canAddExp(int exp){ int newExp = this.currentExp + exp; return newExp >= 0 && newExp < getMaxExp(); } - + public void gainExp(int chance){ if(npc.getRNG().nextInt(chance) == 0) addExp(1); } - + private void openGui(EntityPlayer player){ NoppesUtilServer.sendOpenGui(player, EnumGuiType.Companion, npc); } - + public EntityPlayer getOwner(){ if(uuid == null || uuid.isEmpty()) return null; @@ -365,7 +365,7 @@ public class RoleCompanion extends RoleInterface { } } catch(IllegalArgumentException ex){ - + } return null; } @@ -379,11 +379,11 @@ public class RoleCompanion extends RoleInterface { public boolean hasTalent(EnumCompanionTalent talent) { return getTalentLevel(talent) > 0; } - + public int getTalentLevel(EnumCompanionTalent talent){ if(!talents.containsKey(talent)) return 0; - + int exp = talents.get(talent); if(exp >= 5000) return 5; @@ -409,10 +409,10 @@ public class RoleCompanion extends RoleInterface { if(exp < 1700) return 1700; if(exp < 3000) - return 3000; + return 3000; return 5000; } - + public void levelSword(){ if(!talents.containsKey(EnumCompanionTalent.SWORD)) return; @@ -432,11 +432,11 @@ public class RoleCompanion extends RoleInterface { public void setExp(EnumCompanionTalent talent, int exp) { talents.put(talent, exp); } - + private boolean isWeapon(ItemStack item) { if(item == null || item.getItem() == null) return false; - return item.getItem() instanceof ItemSword || + return item.getItem() instanceof ItemSword || item.getItem() instanceof ItemBow || item.getItem() == Item.getItemFromBlock(Blocks.cobblestone); } @@ -450,21 +450,21 @@ public class RoleCompanion extends RoleInterface { if(item.getItem() instanceof ItemBow) return this.getTalentLevel(EnumCompanionTalent.RANGED) > 2; - + if(item.getItem() == Item.getItemFromBlock(Blocks.cobblestone)) return this.getTalentLevel(EnumCompanionTalent.RANGED) > 1; - + return false; } - + public boolean canWearArmor(ItemStack item){ int level = getTalentLevel(EnumCompanionTalent.ARMOR); if(item == null || !(item.getItem() instanceof ItemArmor) || level <= 0) return false; - + if(level >= 5) return true; - + ItemArmor armor = (ItemArmor) item.getItem(); int reduction = ObfuscationReflectionHelper.getPrivateValue(ArmorMaterial.class, armor.getArmorMaterial(), 5); if(reduction <= 5 && level >= 1) @@ -476,7 +476,7 @@ public class RoleCompanion extends RoleInterface { if(reduction <= 33 && level >= 4) return true; return false; - } + } public boolean canWearSword(ItemStack item){ int level = getTalentLevel(EnumCompanionTalent.SWORD); if(item == null || !(item.getItem() instanceof ItemSword) || level <= 0) @@ -485,7 +485,7 @@ public class RoleCompanion extends RoleInterface { return true; return getSwordDamage(item) - level < 4; } - + private double getSwordDamage(ItemStack item){ if(item == null || !(item.getItem() instanceof ItemSword)) return 0; @@ -501,8 +501,8 @@ public class RoleCompanion extends RoleInterface { } return 0; } - - public void setStats(){ + + public void setStats(){ ItemStack weapon = npc.inventory.getWeapon(); npc.stats.setAttackStrength((float) (1 + getSwordDamage(weapon))); npc.stats.healthRegen = 0; @@ -516,10 +516,10 @@ public class RoleCompanion extends RoleInterface { npc.inventory.setProjectile(new ItemStack(Items.arrow)); } } - + inventory.setSize(2 + getTalentLevel(EnumCompanionTalent.INVENTORY) * 2); } - + public void setSelfsuficient(boolean bo){ if(owner == null || jobInterface != null && bo == jobInterface.isSelfSufficient()) return; @@ -531,27 +531,27 @@ public class RoleCompanion extends RoleInterface { ((CompanionGuard)jobInterface).isStanding = bo; else if(job == EnumCompanionJobs.FARMER) ((CompanionFarmer)jobInterface).isStanding = bo; - + } - + public void setSitting(boolean sit){ if(sit){ - npc.ai.animationType = EnumAnimation.SITTING; - npc.ai.onAttack = 3; - npc.ai.startPos = new int[]{MathHelper.floor_double(npc.posX), + npc.ais.animationType = EnumAnimation.SITTING; + npc.ais.onAttack = 3; + npc.ais.startPos = new int[]{MathHelper.floor_double(npc.posX), MathHelper.floor_double(npc.posY), MathHelper.floor_double(npc.posZ)}; npc.getNavigator().clearPathEntity(); - npc.setPositionAndUpdate(npc.ai.startPos[0] + 0.5, npc.posY, npc.ai.startPos[2] + 0.5); + npc.setPositionAndUpdate(npc.ais.startPos[0] + 0.5, npc.posY, npc.ais.startPos[2] + 0.5); } else{ - npc.ai.animationType = stage.animation; - npc.ai.onAttack = 0; + npc.ais.animationType = stage.animation; + npc.ais.onAttack = 0; } npc.setResponse(); } - + public boolean isSitting(){ - return npc.ai.animationType == EnumAnimation.SITTING; + return npc.ais.animationType == EnumAnimation.SITTING; } public float applyArmorCalculations(DamageSource source, float damage) { @@ -565,7 +565,7 @@ public class RoleCompanion extends RoleInterface { } return damage; } - + private void damageArmor(float damage){ damage /= 4.0F; @@ -586,7 +586,7 @@ public class RoleCompanion extends RoleInterface { } this.gainExp(hasArmor?4:8); } - + public int getTotalArmorValue(){ int armorValue = 0; for(ItemStack armor : npc.inventory.getArmor().values()){ @@ -601,7 +601,7 @@ public class RoleCompanion extends RoleInterface { return false; return owner != null && !isSitting(); } - + @Override public boolean defendOwner() { if(!defendOwner || owner == null || stage == EnumCompanionStage.BABY || jobInterface != null && jobInterface.isSelfSufficient()) @@ -611,7 +611,7 @@ public class RoleCompanion extends RoleInterface { public int followRange() { return 9 + 12 * stage.ordinal(); - + } public boolean hasOwner() { diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptLiving.java b/src/main/java/noppes/npcs/scripted/entity/ScriptLiving.java index 828803ed0..2d7f904e4 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptLiving.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptLiving.java @@ -149,4 +149,16 @@ public class ScriptLiving extends ScriptLivingBase im public boolean canBeSteered() { return this.entity.canBeSteered(); } + + @Override + public void setRotation(float rotation){ + super.setRotation(rotation); + entity.getLookHelper().setLookPosition(getX(), getY(), getZ(), rotation, getPitch()); + } + + @Override + public void setPitch(float rotation){ + super.setPitch(rotation); + entity.getLookHelper().setLookPosition(getX(), getY(), getZ(), getRotation(), rotation); + } } diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java index 987326092..45694f845 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java @@ -95,23 +95,26 @@ public class ScriptNpc extends ScriptLiving imp public void setRotation(float rotation){ super.setRotation(rotation); int r = (int) rotation; - if(entity.ai.orientation != r) { - entity.ai.orientation = r; - entity.updateClient = true; + if(npc.ais.orientation != r) { + npc.updateClient = true; + npc.rotationYawHead = npc.rotationYaw = npc.renderYawOffset = npc.ais.orientation = r; + npc.prevRenderYawOffset = r; + npc.prevRotationYaw = r; + npc.prevRotationYawHead = r; } } public void setRotationType(int rotationType){ for (EnumStandingType e : EnumStandingType.values()) { if (e.ordinal() == rotationType) { - npc.ai.standingType = e; + npc.ais.standingType = e; break; } } } public int getRotationType(){ - return npc.ai.standingType.ordinal(); + return npc.ais.standingType.ordinal(); } /** @@ -120,7 +123,7 @@ public class ScriptNpc extends ScriptLiving imp public void setMovingType(int movingType){ for(EnumMovingType e : EnumMovingType.values()) { if (e.ordinal() == movingType) { - npc.ai.movingType = e; + npc.ais.movingType = e; break; } } @@ -130,7 +133,7 @@ public class ScriptNpc extends ScriptLiving imp * @return The moving type of the npc. 0 = standing, 1 = wandering, 2 = moving path */ public int getMovingType(){ - return npc.ai.movingType.ordinal(); + return npc.ais.movingType.ordinal(); } /** @@ -174,7 +177,7 @@ public class ScriptNpc extends ScriptLiving imp } public IPos getHome() { - return NpcAPI.Instance().getIPos(npc.ai.startPos[0],npc.ai.startPos[1],npc.ai.startPos[2]); + return NpcAPI.Instance().getIPos(npc.ais.startPos[0],npc.ais.startPos[1],npc.ais.startPos[2]); } /** @@ -188,7 +191,7 @@ public class ScriptNpc extends ScriptLiving imp * @param x The home x position */ public void setHomeX(int x){ - npc.ai.startPos[0] = x; + npc.ais.startPos[0] = x; } /** @@ -202,7 +205,7 @@ public class ScriptNpc extends ScriptLiving imp * @param y The home y position */ public void setHomeY(int y){ - npc.ai.startPos[1] = y; + npc.ais.startPos[1] = y; } /** @@ -216,7 +219,7 @@ public class ScriptNpc extends ScriptLiving imp * @param z The home x position */ public void setHomeZ(int z){ - npc.ai.startPos[2] = z; + npc.ais.startPos[2] = z; } /** @@ -225,11 +228,11 @@ public class ScriptNpc extends ScriptLiving imp * @param z The home z position */ public void setHome(int x, int y, int z){ - npc.ai.startPos = new int[]{x, y, z}; + npc.ais.startPos = new int[]{x, y, z}; } public void setHome(IPos pos){ - npc.ai.startPos = new int[]{pos.getX(), pos.getY(), pos.getZ()}; + npc.ais.startPos = new int[]{pos.getX(), pos.getY(), pos.getZ()}; } /** @@ -244,14 +247,14 @@ public class ScriptNpc extends ScriptLiving imp * @param bo Whether or not the npc will try to return to his home position */ public void setReturnToHome(boolean bo){ - npc.ai.returnToStart = bo; + npc.ais.returnToStart = bo; } /** * @return Whether or not the npc returns home */ public boolean getReturnToHome(){ - return npc.ai.returnToStart; + return npc.ais.returnToStart; } /** @@ -701,29 +704,29 @@ public class ScriptNpc extends ScriptLiving imp */ public void setAnimation(int type){ if(type == AnimationType.NORMAL) - npc.ai.animationType = EnumAnimation.NONE; + npc.ais.animationType = EnumAnimation.NONE; else if(type == AnimationType.SITTING) - npc.ai.animationType = EnumAnimation.SITTING; + npc.ais.animationType = EnumAnimation.SITTING; else if(type == AnimationType.DANCING) - npc.ai.animationType = EnumAnimation.DANCING; + npc.ais.animationType = EnumAnimation.DANCING; else if(type == AnimationType.SNEAKING) - npc.ai.animationType = EnumAnimation.SNEAKING; + npc.ais.animationType = EnumAnimation.SNEAKING; else if(type == AnimationType.LYING) - npc.ai.animationType = EnumAnimation.LYING; + npc.ais.animationType = EnumAnimation.LYING; else if(type == AnimationType.HUGGING) - npc.ai.animationType = EnumAnimation.HUG; + npc.ais.animationType = EnumAnimation.HUG; } public void setTacticalVariant(int variant){ if(variant > EnumNavType.values().length-1 || variant < 0) return; - npc.ai.tacticalVariant = EnumNavType.values()[variant]; - npc.ai.directLOS = EnumNavType.values()[variant] != EnumNavType.Stalk && npc.ai.directLOS; + npc.ais.tacticalVariant = EnumNavType.values()[variant]; + npc.ais.directLOS = EnumNavType.values()[variant] != EnumNavType.Stalk && npc.ais.directLOS; } public int getTacticalVariant(){ - return npc.ai.tacticalVariant.ordinal(); + return npc.ais.tacticalVariant.ordinal(); } public void setTacticalVariant(String variant){ @@ -736,22 +739,22 @@ public class ScriptNpc extends ScriptLiving imp if(!found) return; - npc.ai.tacticalVariant = EnumNavType.valueOf(variant); + npc.ais.tacticalVariant = EnumNavType.valueOf(variant); } public String getTacticalVariantName(){ - return npc.ai.tacticalVariant.name(); + return npc.ais.tacticalVariant.name(); } public void setCombatPolicy(int variant){ if(variant > EnumCombatPolicy.values().length-1 || variant < 0) return; - npc.ai.combatPolicy = EnumCombatPolicy.values()[variant]; + npc.ais.combatPolicy = EnumCombatPolicy.values()[variant]; } public int getCombatPolicy(){ - return npc.ai.combatPolicy.ordinal(); + return npc.ais.combatPolicy.ordinal(); } public void setCombatPolicy(String variant){ @@ -764,22 +767,22 @@ public class ScriptNpc extends ScriptLiving imp if(!found) return; - npc.ai.combatPolicy = EnumCombatPolicy.valueOf(variant); + npc.ais.combatPolicy = EnumCombatPolicy.valueOf(variant); } public String getCombatPolicyName(){ - return npc.ai.combatPolicy.name(); + return npc.ais.combatPolicy.name(); } public void setTacticalRadius(int tacticalRadius){ if(tacticalRadius < 0) tacticalRadius = 0; - npc.ai.tacticalRadius = tacticalRadius; + npc.ais.tacticalRadius = tacticalRadius; } public int getTacticalRadius(){ - return npc.ai.tacticalRadius; + return npc.ais.tacticalRadius; } public void setIgnoreCobweb(boolean ignore){ @@ -793,21 +796,21 @@ public class ScriptNpc extends ScriptLiving imp public void setOnFoundEnemy(int onAttack){ if(onAttack < 0 || onAttack > 3) return; - npc.ai.onAttack = onAttack; + npc.ais.onAttack = onAttack; } public int onFoundEnemy(){ - return npc.ai.onAttack; + return npc.ais.onAttack; } public void setShelterFrom(int shelterFrom){ if(shelterFrom < 0 || shelterFrom > 2) return; - npc.ai.findShelter = shelterFrom; + npc.ais.findShelter = shelterFrom; } public int getShelterFrom(){ - return npc.ai.findShelter; + return npc.ais.findShelter; } public boolean hasLivingAnimation() { @@ -1192,7 +1195,7 @@ public class ScriptNpc extends ScriptLiving imp if (type > 3) type = 3; - npc.ai.onAttack = type; + npc.ais.onAttack = type; npc.updateTasks(); } @@ -1258,22 +1261,22 @@ public class ScriptNpc extends ScriptLiving imp fly = 1; else fly = 0; - npc.ai.movementType = fly; + npc.ais.movementType = fly; } public boolean canFly(){ - return npc.ai.movementType == 1; + return npc.ais.movementType == 1; } public void setFlySpeed(double flySpeed){ if(flySpeed < 0.0D) flySpeed = 0.0D; - npc.ai.flySpeed = flySpeed; + npc.ais.flySpeed = flySpeed; } public double getFlySpeed(double flySpeed){ - return npc.ai.flySpeed; + return npc.ais.flySpeed; } public void setFlyGravity(double flyGravity){ @@ -1282,36 +1285,36 @@ public class ScriptNpc extends ScriptLiving imp if(flyGravity > 1.0D) flyGravity = 1.0D; - npc.ai.flyGravity = flyGravity; + npc.ais.flyGravity = flyGravity; } public double getFlyGravity(double flySpeed){ - return npc.ai.flyGravity; + return npc.ais.flyGravity; } public void setFlyHeightLimit(int flyHeightLimit){ if(flyHeightLimit < 0) flyHeightLimit = 0; - this.npc.ai.flyHeightLimit = flyHeightLimit; + this.npc.ais.flyHeightLimit = flyHeightLimit; } public int getFlyHeightLimit(int flyHeightLimit){ - return this.npc.ai.flyHeightLimit; + return this.npc.ais.flyHeightLimit; } public void limitFlyHeight(boolean limit){ - this.npc.ai.hasFlyLimit = limit; + this.npc.ais.hasFlyLimit = limit; } public boolean isFlyHeightLimited(boolean limit){ - return this.npc.ai.hasFlyLimit; + return this.npc.ais.hasFlyLimit; } public void setSpeed(double speed) { - npc.ai.setWalkingSpeed(speed); + npc.ais.setWalkingSpeed(speed); } public double getSpeed() { - return npc.ai.getWalkingSpeed(); + return npc.ais.getWalkingSpeed(); } public void setSkinType(byte type) {