diff options
author | EdGruberman <ed@rjump.com> | 2012-09-27 21:55:08 -0700 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-09-28 15:04:32 -0500 |
commit | 59d6b60c0abe28654cb344fe4a3008ab5f6f940a (patch) | |
tree | 2da03af0e8733c428b81c8475bd4e85663e5c98d /src/main | |
parent | 62a9b8815bc16971c2ea61f89f0f4d11f99a64ed (diff) | |
download | craftbukkit-59d6b60c0abe28654cb344fe4a3008ab5f6f940a.tar craftbukkit-59d6b60c0abe28654cb344fe4a3008ab5f6f940a.tar.gz craftbukkit-59d6b60c0abe28654cb344fe4a3008ab5f6f940a.tar.lz craftbukkit-59d6b60c0abe28654cb344fe4a3008ab5f6f940a.tar.xz craftbukkit-59d6b60c0abe28654cb344fe4a3008ab5f6f940a.zip |
Update entity target data to reflect current AI status. Fixes BUKKIT-2280
The new AI system introduced by Minecraft 1.2 no longer relies on the
target field in the entity so it is frequently out of sync with what the
entity is actually doing. This modifies the AI goal to update the target
so our API can return the correct information.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/PathfinderGoalTarget.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java index 2c59ef6d..bbb1cdfc 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java @@ -119,10 +119,12 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal { org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(this.d, entityliving, reason); if (event.isCancelled() || event.getTarget() == null) { + if (this.d instanceof EntityCreature) ((EntityCreature) this.d).target = null; return false; } else if (entityliving.getBukkitEntity() != event.getTarget()) { this.d.b((EntityLiving) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle()); } + if (this.d instanceof EntityCreature) ((EntityCreature) this.d).target = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); // CraftBukkit end return true; |