This commit is contained in:
fullwall 2012-10-31 14:46:24 +08:00
parent 43e218be05
commit 0c2a689793
3 changed files with 10 additions and 3 deletions

View File

@ -34,8 +34,9 @@ public class CitizensHumanNPC extends CitizensNPC implements Equipable {
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
@Override @Override
public void run() { public void run() {
handle.yaw = loc.getYaw();
NMS.setHeadYaw(handle, loc.getYaw() % 360); NMS.setHeadYaw(handle, loc.getYaw() % 360);
// set the head yaw in another tick - if done immediately, // set the yaw in another tick - if done immediately,
// minecraft will not update it. // minecraft will not update it.
boolean removeFromPlayerList = Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean(); boolean removeFromPlayerList = Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean();
NMS.addOrRemoveFromPlayerList(getBukkitEntity(), NMS.addOrRemoveFromPlayerList(getBukkitEntity(),

View File

@ -129,12 +129,13 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
super.j_(); super.j_();
if (npc == null) if (npc == null)
return; return;
updateEquipment(); updateEquipment();
NMS.updateAI(this);
Navigation navigation = getNavigation(); Navigation navigation = getNavigation();
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON) if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
motX = motY = motZ = 0; motX = motY = motZ = 0;
NMS.updateSenses(this);
if (!navigation.f()) { if (!navigation.f()) {
navigation.e(); navigation.e();
moveOnCurrentHeading(); moveOnCurrentHeading();
@ -148,6 +149,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
} }
private void moveOnCurrentHeading() { private void moveOnCurrentHeading() {
NMS.updateAI(this);
// taken from EntityLiving update method // taken from EntityLiving update method
if (bG) { if (bG) {
/* boolean inLiquid = H() || J(); /* boolean inLiquid = H() || J();

View File

@ -282,7 +282,7 @@ public class NMS {
} }
public static void updateAI(EntityLiving entity) { public static void updateAI(EntityLiving entity) {
entity.az().a(); updateSenses(entity);
entity.getNavigation().e(); entity.getNavigation().e();
entity.getControllerMove().c(); entity.getControllerMove().c();
entity.getControllerLook().a(); entity.getControllerLook().a();
@ -354,4 +354,8 @@ public class NMS {
STAIR_MATERIALS.add(material.getId()); STAIR_MATERIALS.add(material.getId());
} }
} }
public static void updateSenses(EntityLiving entity) {
entity.az().a();
}
} }