Archiviert
13
0

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.
Dieser Commit ist enthalten in:
EdGruberman 2012-09-27 21:55:08 -07:00 committet von Travis Watkins
Ursprung 62a9b8815b
Commit 59d6b60c0a

Datei anzeigen

@ -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); org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(this.d, entityliving, reason);
if (event.isCancelled() || event.getTarget() == null) { if (event.isCancelled() || event.getTarget() == null) {
if (this.d instanceof EntityCreature) ((EntityCreature) this.d).target = null;
return false; return false;
} else if (entityliving.getBukkitEntity() != event.getTarget()) { } else if (entityliving.getBukkitEntity() != event.getTarget()) {
this.d.b((EntityLiving) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle()); 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 // CraftBukkit end
return true; return true;