diff --git a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java index 5bd045e85..85f71d8bb 100644 --- a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java +++ b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java @@ -47,6 +47,7 @@ import net.citizensnpcs.trait.ScoreboardTrait; import net.citizensnpcs.util.ChunkCoord; import net.citizensnpcs.util.Messages; import net.citizensnpcs.util.NMS; +import net.citizensnpcs.util.PlayerUpdateTask; import net.citizensnpcs.util.Util; public class CitizensNPC extends AbstractNPC { @@ -87,6 +88,9 @@ public class CitizensNPC extends AbstractNPC { if (!keepSelected) { data().remove("selectors"); } + if (getEntity() instanceof Player) { + PlayerUpdateTask.deregisterPlayer(getEntity()); + } navigator.onDespawn(); if (reason == DespawnReason.RELOAD) { unloadEvents(); @@ -304,6 +308,10 @@ public class CitizensNPC extends AbstractNPC { } } + if (getEntity() instanceof Player) { + PlayerUpdateTask.registerPlayer(getEntity()); + } + updateFlyableState(); return true; diff --git a/main/src/main/java/net/citizensnpcs/util/NMS.java b/main/src/main/java/net/citizensnpcs/util/NMS.java index f27ffe552..cb9b1a95f 100644 --- a/main/src/main/java/net/citizensnpcs/util/NMS.java +++ b/main/src/main/java/net/citizensnpcs/util/NMS.java @@ -318,6 +318,10 @@ public class NMS { BRIDGE.playAnimation(animation, player, radius); } + public static void playerTick(Player entity) { + BRIDGE.playerTick(entity); + } + public static void registerEntityClass(Class clazz) { BRIDGE.registerEntityClass(clazz); } diff --git a/main/src/main/java/net/citizensnpcs/util/NMSBridge.java b/main/src/main/java/net/citizensnpcs/util/NMSBridge.java index b22880732..6507f63ca 100644 --- a/main/src/main/java/net/citizensnpcs/util/NMSBridge.java +++ b/main/src/main/java/net/citizensnpcs/util/NMSBridge.java @@ -95,6 +95,8 @@ public interface NMSBridge { public void playAnimation(PlayerAnimation animation, Player player, int radius); + public void playerTick(Player entity); + public void registerEntityClass(Class clazz); public void remove(Entity entity); diff --git a/main/src/main/java/net/citizensnpcs/util/PlayerUpdateTask.java b/main/src/main/java/net/citizensnpcs/util/PlayerUpdateTask.java index c939b4e73..260b7802a 100644 --- a/main/src/main/java/net/citizensnpcs/util/PlayerUpdateTask.java +++ b/main/src/main/java/net/citizensnpcs/util/PlayerUpdateTask.java @@ -8,6 +8,7 @@ import java.util.Map; import java.util.UUID; import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; public class PlayerUpdateTask extends BukkitRunnable { @@ -37,6 +38,11 @@ public class PlayerUpdateTask extends BukkitRunnable { itr.remove(); } } + for (Player entity : PLAYERS.values()) { + if (entity.isValid()) { + NMS.playerTick(entity); + } + } } public static void addOrRemove(org.bukkit.entity.Entity entity, boolean remove) { @@ -50,6 +56,15 @@ public class PlayerUpdateTask extends BukkitRunnable { } } + public static void deregisterPlayer(org.bukkit.entity.Entity entity) { + PLAYERS.remove(entity.getUniqueId()); + } + + public static void registerPlayer(org.bukkit.entity.Entity entity) { + PLAYERS.put(entity.getUniqueId(), (Player) entity); + } + + private static Map PLAYERS = new HashMap(); private static Map TICKERS = new HashMap(); private static List TICKERS_PENDING_ADD = new ArrayList(); private static List TICKERS_PENDING_REMOVE = new ArrayList(); diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EntityHumanNPC.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EntityHumanNPC.java index 86fd54ffb..87e4451c8 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EntityHumanNPC.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EntityHumanNPC.java @@ -281,7 +281,12 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable return npc.getNavigator().isNavigating(); } - public void livingEntityBaseTick() { + @Override + public void k_() { + if (npc == null) { + super.k_(); + return; + } this.aD = this.aE; this.aK = this.aL; if (this.hurtTicks > 0) { @@ -305,7 +310,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable } this.noclip = isSpectator(); Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", bukkitEntity); - livingEntityBaseTick(); boolean navigating = npc.getNavigator().isNavigating(); updatePackets(navigating); diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/NMSImpl.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/NMSImpl.java index 749f78803..d4c99947a 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/NMSImpl.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/NMSImpl.java @@ -744,6 +744,11 @@ public class NMSImpl implements NMSBridge { PlayerAnimationImpl.play(animation, player, radius); } + @Override + public void playerTick(Player entity) { + ((EntityPlayer) getHandle(entity)).k_(); + } + @Override public void registerEntityClass(Class clazz) { if (ENTITY_CLASS_TO_INT == null || ENTITY_CLASS_TO_INT.containsKey(clazz)) diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EntityHumanNPC.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EntityHumanNPC.java index 2525b5018..b7970d1e6 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EntityHumanNPC.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EntityHumanNPC.java @@ -124,7 +124,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable updateEffects = true; } Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", bukkitEntity); - livingEntityBaseTick(); boolean navigating = npc.getNavigator().isNavigating(); updatePackets(navigating); @@ -327,21 +326,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable return npc.getNavigator().isNavigating(); } - public void livingEntityBaseTick() { - cA(); - this.aC = this.aD; - this.aJ = this.aK; - if (this.hurtTicks > 0) { - this.hurtTicks -= 1; - } - tickPotionEffects(); - this.aZ = this.aY; - this.aO = this.aN; - this.aQ = this.aP; - this.lastYaw = this.yaw; - this.lastPitch = this.pitch; - } - @Override public boolean m_() { if (npc == null || !npc.isFlyable()) { @@ -370,6 +354,26 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable } } + @Override + public void playerTick() { + if (npc == null) { + super.playerTick(); + return; + } + cA(); + this.aC = this.aD; + this.aJ = this.aK; + if (this.hurtTicks > 0) { + this.hurtTicks -= 1; + } + tickPotionEffects(); + this.aZ = this.aY; + this.aO = this.aN; + this.aQ = this.aP; + this.lastYaw = this.yaw; + this.lastPitch = this.pitch; + } + public void setMoveDestination(double x, double y, double z, double speed) { controllerMove.a(x, y, z, speed); } diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/NMSImpl.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/NMSImpl.java index 8f61b818c..eb8001e5b 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/NMSImpl.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/NMSImpl.java @@ -799,6 +799,11 @@ public class NMSImpl implements NMSBridge { PlayerAnimationImpl.play(animation, player, radius); } + @Override + public void playerTick(Player entity) { + ((EntityPlayer) getHandle(entity)).playerTick(); + } + @Override public void registerEntityClass(Class clazz) { if (ENTITY_REGISTRY == null) diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java index 292a83377..3f89f2377 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java @@ -135,7 +135,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable updateEffects = true; } Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", bukkitEntity); - livingEntityBaseTick(); boolean navigating = npc.getNavigator().isNavigating(); updatePackets(navigating); @@ -344,21 +343,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable return npc.getNavigator().isNavigating(); } - public void livingEntityBaseTick() { - Y(); - this.aC = this.aD; - this.aJ = this.aK; - if (this.hurtTicks > 0) { - this.hurtTicks -= 1; - } - tickPotionEffects(); - this.aZ = this.aY; - this.aO = this.aN; - this.aQ = this.aP; - this.lastYaw = this.yaw; - this.lastPitch = this.pitch; - } - @Override public boolean m_() { if (npc == null || !npc.isFlyable()) { @@ -387,6 +371,26 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable } } + @Override + public void playerTick() { + if (npc == null) { + super.playerTick(); + return; + } + Y(); + this.aC = this.aD; + this.aJ = this.aK; + if (this.hurtTicks > 0) { + this.hurtTicks -= 1; + } + tickPotionEffects(); + this.aZ = this.aY; + this.aO = this.aN; + this.aQ = this.aP; + this.lastYaw = this.yaw; + this.lastPitch = this.pitch; + } + public void setMoveDestination(double x, double y, double z, double speed) { controllerMove.a(x, y, z, speed); } diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java index bb848406c..df1aa1757 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java @@ -807,6 +807,11 @@ public class NMSImpl implements NMSBridge { PlayerAnimationImpl.play(animation, player, radius); } + @Override + public void playerTick(Player entity) { + ((EntityPlayer) getHandle(entity)).playerTick(); + } + @Override public void registerEntityClass(Class clazz) { if (ENTITY_REGISTRY == null) diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EntityHumanNPC.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EntityHumanNPC.java index 6a6a5dbe2..b53dcc9b2 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EntityHumanNPC.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EntityHumanNPC.java @@ -308,21 +308,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable return npc.getNavigator().isNavigating(); } - public void livingEntityBaseTick() { - W(); - this.aF = this.aG; - this.aM = this.aN; - if (this.hurtTicks > 0) { - this.hurtTicks -= 1; - } - tickPotionEffects(); - this.bc = this.bb; - this.aR = this.aQ; - this.aT = this.aS; - this.lastYaw = this.yaw; - this.lastPitch = this.pitch; - } - private void moveOnCurrentHeading() { if (bg) { if (onGround && jumpTicks == 0) { @@ -342,6 +327,26 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable } } + @Override + public void playerTick() { + if (npc == null) { + super.playerTick(); + return; + } + W(); + this.aF = this.aG; + this.aM = this.aN; + if (this.hurtTicks > 0) { + this.hurtTicks -= 1; + } + tickPotionEffects(); + this.bc = this.bb; + this.aR = this.aQ; + this.aT = this.aS; + this.lastYaw = this.yaw; + this.lastPitch = this.pitch; + } + public void setMoveDestination(double x, double y, double z, double speed) { controllerMove.a(x, y, z, speed); } @@ -393,7 +398,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable updateEffects = true; } Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", bukkitEntity); - livingEntityBaseTick(); boolean navigating = npc.getNavigator().isNavigating(); updatePackets(navigating); diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java index 41df33b5d..a3fd9bce1 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java @@ -841,6 +841,11 @@ public class NMSImpl implements NMSBridge { PlayerAnimationImpl.play(animation, player, radius); } + @Override + public void playerTick(Player entity) { + ((EntityPlayer) getHandle(entity)).playerTick(); + } + @Override public void registerEntityClass(Class clazz) { if (ENTITY_REGISTRY == null) diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EntityHumanNPC.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EntityHumanNPC.java index 429796827..ef2039eef 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EntityHumanNPC.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EntityHumanNPC.java @@ -313,20 +313,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable return npc.getNavigator().isNavigating(); } - public void livingEntityBaseTick() { - entityBaseTick(); - this.aB = this.aC; - if (this.hurtTicks > 0) { - this.hurtTicks -= 1; - } - tickPotionEffects(); - this.aW = this.aV; - this.aL = this.aK; - this.aN = this.aM; - this.lastYaw = this.yaw; - this.lastPitch = this.pitch; - } - private void moveOnCurrentHeading() { if (jumping) { if (onGround && jumpTicks == 0) { @@ -346,6 +332,25 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable } } + @Override + public void playerTick() { + if (npc == null) { + super.playerTick(); + return; + } + entityBaseTick(); + this.aB = this.aC; + if (this.hurtTicks > 0) { + this.hurtTicks -= 1; + } + tickPotionEffects(); + this.aW = this.aV; + this.aL = this.aK; + this.aN = this.aM; + this.lastYaw = this.yaw; + this.lastPitch = this.pitch; + } + public void setMoveDestination(double x, double y, double z, double speed) { controllerMove.a(x, y, z, speed); } @@ -397,7 +402,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable updateEffects = true; } Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", getBukkitEntity()); - livingEntityBaseTick(); boolean navigating = npc.getNavigator().isNavigating(); updatePackets(navigating); diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java index 3c94d495a..d19c68897 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java @@ -902,6 +902,11 @@ public class NMSImpl implements NMSBridge { PlayerAnimationImpl.play(animation, player, radius); } + @Override + public void playerTick(Player entity) { + ((EntityPlayer) getHandle(entity)).playerTick(); + } + @Override public void registerEntityClass(Class clazz) { if (ENTITY_REGISTRY == null) diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EntityHumanNPC.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EntityHumanNPC.java index a08cd0705..c09c9d34b 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EntityHumanNPC.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EntityHumanNPC.java @@ -11,7 +11,6 @@ import org.bukkit.Location; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.util.Vector; @@ -46,7 +45,6 @@ import net.minecraft.server.v1_15_R1.AttributeInstance; import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.ChatComponentText; import net.minecraft.server.v1_15_R1.DamageSource; -import net.minecraft.server.v1_15_R1.DimensionManager; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityHuman; import net.minecraft.server.v1_15_R1.EntityPlayer; @@ -80,7 +78,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable private final Location packetLocationCache = new Location(null, 0, 0, 0); private final SkinPacketTracker skinTracker; private int updateCounter = 0; - private int yawUpdateRequiredTicks; public EntityHumanNPC(MinecraftServer minecraftServer, WorldServer world, GameProfile gameProfile, PlayerInteractManager playerInteractManager, NPC npc) { @@ -317,35 +314,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable return npc.getNavigator().isNavigating(); } - public void livingEntityBaseTick() { - // doPortalTick code - boolean old = this.af; - if (af && ag + 1 > ab()) { - af = false; - Bukkit.getServer().getScheduler().runTask(CitizensAPI.getPlugin(), new Runnable() { - @Override - public void run() { - portalCooldown = ba(); - a(world.worldProvider.getDimensionManager().getType() == DimensionManager.NETHER - ? DimensionManager.OVERWORLD - : DimensionManager.NETHER, TeleportCause.NETHER_PORTAL); - } - }); - } - entityBaseTick(); - af = old; - this.az = this.aA; - if (this.hurtTicks > 0) { - this.hurtTicks -= 1; - } - tickPotionEffects(); - this.aU = this.aT; - this.aJ = this.aI; - this.aL = this.aK; - this.lastYaw = this.yaw; - this.lastPitch = this.pitch; - } - private void moveOnCurrentHeading() { if (jumping) { if (onGround && jumpTicks == 0) { @@ -364,6 +332,25 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable } } + @Override + public void playerTick() { + if (npc == null) { + super.playerTick(); + return; + } + entityBaseTick(); + this.az = this.aA; + if (this.hurtTicks > 0) { + this.hurtTicks -= 1; + } + tickPotionEffects(); + this.aU = this.aT; + this.aJ = this.aI; + this.aL = this.aK; + this.lastYaw = this.yaw; + this.lastPitch = this.pitch; + } + public void setMoveDestination(double x, double y, double z, double speed) { controllerMove.a(x, y, z, speed); } @@ -415,7 +402,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable updateEffects = true; } Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", getBukkitEntity()); - livingEntityBaseTick(); boolean navigating = npc.getNavigator().isNavigating(); updatePackets(navigating); @@ -441,15 +427,15 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable npc.update(); /* - double diff = this.yaw - this.aK; - if (diff != 40 && diff != -40) { - ++this.yawUpdateRequiredTicks; - } - if (this.yawUpdateRequiredTicks > 5) { - this.yaw = (diff > -40 && diff < 0) || (diff > 0 && diff > 40) ? this.aK - 40 : this.aK + 40; - this.yawUpdateRequiredTicks = 0; - } - */ + double diff = this.yaw - this.aK; + if (diff != 40 && diff != -40) { + ++this.yawUpdateRequiredTicks; + } + if (this.yawUpdateRequiredTicks > 5) { + this.yaw = (diff > -40 && diff < 0) || (diff > 0 && diff > 40) ? this.aK - 40 : this.aK + 40; + this.yawUpdateRequiredTicks = 0; + } + */ } public void updateAI() { diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java index 8eabe3738..a0c33ff74 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java @@ -905,6 +905,11 @@ public class NMSImpl implements NMSBridge { PlayerAnimationImpl.play(animation, player, radius); } + @Override + public void playerTick(Player entity) { + ((EntityPlayer) getHandle(entity)).playerTick(); + } + @Override public void registerEntityClass(Class clazz) { if (ENTITY_REGISTRY == null) @@ -1819,7 +1824,6 @@ public class NMSImpl implements NMSBridge { private static final MethodHandle SIZE_FIELD_GETTER = NMS.getGetter(Entity.class, "size"); private static final MethodHandle SIZE_FIELD_SETTER = NMS.getSetter(Entity.class, "size"); private static Field SKULL_PROFILE_FIELD; - private static MethodHandle TEAM_FIELD; static { diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EntityHumanNPC.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EntityHumanNPC.java index 1c1c9ad30..9ab9ee6c4 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EntityHumanNPC.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EntityHumanNPC.java @@ -276,7 +276,12 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable } } - public void livingEntityBaseTick() { + @Override + public void l() { + if (npc == null) { + super.l(); + return; + } if (!this.world.isClientSide) { b(0, this.fireTicks > 0); } @@ -363,7 +368,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable } this.noclip = isSpectator(); Bukkit.getServer().getPluginManager().unsubscribeFromPermission("bukkit.broadcast.user", bukkitEntity); - livingEntityBaseTick(); boolean navigating = npc.getNavigator().isNavigating(); updatePackets(navigating); diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/NMSImpl.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/NMSImpl.java index 9bd662d0b..e9941a4c0 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/NMSImpl.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/NMSImpl.java @@ -671,6 +671,11 @@ public class NMSImpl implements NMSBridge { PlayerAnimationImpl.play(animation, player, radius); } + @Override + public void playerTick(Player entity) { + ((EntityPlayer) getHandle(entity)).l(); + } + @Override public void registerEntityClass(Class clazz) { if (ENTITY_CLASS_TO_INT == null || ENTITY_CLASS_TO_INT.containsKey(clazz))