diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PhantomController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PhantomController.java index 9b7078575..b5716ec97 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PhantomController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PhantomController.java @@ -19,6 +19,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.ControllerLook; import net.minecraft.server.v1_16_R3.ControllerMove; import net.minecraft.server.v1_16_R3.DamageSource; +import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; @@ -43,6 +44,7 @@ public class PhantomController extends MobEntityController { } public static class EntityPhantomNPC extends EntityPhantom implements NPCHolder { + boolean calledNMSHeight = false; private final CitizensNPC npc; private ControllerLook oldLookController; private ControllerMove oldMoveController; @@ -65,6 +67,17 @@ public class PhantomController extends MobEntityController { } } + @Override + public void a(DataWatcherObject datawatcherobject) { + if (npc != null && !calledNMSHeight) { + calledNMSHeight = true; + NMSImpl.checkAndUpdateHeight(this, datawatcherobject); + calledNMSHeight = false; + } + + super.a(datawatcherobject); + } + @Override protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) { if (npc == null || !npc.isFlyable()) { diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/PhantomController.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/PhantomController.java index 893012db6..a9c19ddb1 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/PhantomController.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/PhantomController.java @@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.Difficulty; import net.minecraft.world.damagesource.DamageSource; @@ -42,6 +43,7 @@ public class PhantomController extends MobEntityController { } public static class EntityPhantomNPC extends Phantom implements NPCHolder { + boolean calledNMSHeight = false; private final CitizensNPC npc; private LookControl oldLookController; private MoveControl oldMoveController; @@ -186,6 +188,17 @@ public class PhantomController extends MobEntityController { } } + @Override + public void onSyncedDataUpdated(EntityDataAccessor datawatcherobject) { + if (npc != null && !calledNMSHeight) { + calledNMSHeight = true; + NMSImpl.checkAndUpdateHeight(this, datawatcherobject); + calledNMSHeight = false; + } + + super.onSyncedDataUpdated(datawatcherobject); + } + @Override public void push(double x, double y, double z) { Vector vector = Util.callPushEvent(npc, x, y, z); diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java index 10d4ed20d..4a3d4752c 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java @@ -1465,7 +1465,6 @@ public class NMSImpl implements NMSBridge { size = (EntityDimensions) SIZE_FIELD_GETTER.invoke(living); } catch (Throwable e) { e.printStackTrace(); - living.onSyncedDataUpdated(datawatcherobject); return; } float oldw = size.width;