diff --git a/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntityArmorStand.java b/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntityArmorStand.java index c27fc2ba43..7acd00f14f 100644 --- a/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntityArmorStand.java +++ b/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntityArmorStand.java @@ -7,13 +7,10 @@ public class PacketEntityArmorStand extends PacketEntity { - public static final int MARKER_FLAG = 16; - - boolean isMarker; + public boolean isMarker = false; public PacketEntityArmorStand(GrimPlayer player, UUID uuid, EntityType type, double x, double y, double z, int extraData) { super(player, uuid, type, x, y, z); - isMarker = (extraData & MARKER_FLAG) != 0; } @Override diff --git a/src/main/java/ac/grim/grimac/utils/latency/CompensatedEntities.java b/src/main/java/ac/grim/grimac/utils/latency/CompensatedEntities.java index 6fe1951135..e88e0975be 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedEntities.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedEntities.java @@ -169,26 +169,24 @@ public void addEntity(int entityID, UUID uuid, EntityType entityType, Vector3d p packetEntity = new PacketEntityHorse(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), xRot); } else if (entityType == EntityTypes.SLIME || entityType == EntityTypes.MAGMA_CUBE || entityType == EntityTypes.PHANTOM) { packetEntity = new PacketEntitySizeable(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); + } else if (EntityTypes.PIG.equals(entityType)) { + packetEntity = new PacketEntityRideable(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); + } else if (EntityTypes.SHULKER.equals(entityType)) { + packetEntity = new PacketEntityShulker(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); + } else if (EntityTypes.STRIDER.equals(entityType)) { + packetEntity = new PacketEntityStrider(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); + } else if (EntityTypes.isTypeInstanceOf(entityType, EntityTypes.BOAT) || EntityTypes.CHICKEN.equals(entityType)) { + packetEntity = new PacketEntityTrackXRot(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), xRot); + } else if (EntityTypes.FISHING_BOBBER.equals(entityType)) { + packetEntity = new PacketEntityHook(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), data); + } else if (EntityTypes.ENDER_DRAGON.equals(entityType)) { + packetEntity = new PacketEntityEnderDragon(player, uuid, entityID, position.getX(), position.getY(), position.getZ()); + } else if (EntityTypes.isTypeInstanceOf(entityType, EntityTypes.ABSTRACT_ARROW)) { + packetEntity = new PacketEntityArrow(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); + } else if (EntityTypes.ARMOR_STAND.equals(entityType)) { + packetEntity = new PacketEntityArmorStand(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), data); } else { - if (EntityTypes.PIG.equals(entityType)) { - packetEntity = new PacketEntityRideable(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); - } else if (EntityTypes.SHULKER.equals(entityType)) { - packetEntity = new PacketEntityShulker(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); - } else if (EntityTypes.STRIDER.equals(entityType)) { - packetEntity = new PacketEntityStrider(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); - } else if (EntityTypes.isTypeInstanceOf(entityType, EntityTypes.BOAT) || EntityTypes.CHICKEN.equals(entityType)) { - packetEntity = new PacketEntityTrackXRot(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), xRot); - } else if (EntityTypes.FISHING_BOBBER.equals(entityType)) { - packetEntity = new PacketEntityHook(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), data); - } else if (EntityTypes.ENDER_DRAGON.equals(entityType)) { - packetEntity = new PacketEntityEnderDragon(player, uuid, entityID, position.getX(), position.getY(), position.getZ()); - } else if (EntityTypes.isTypeInstanceOf(entityType, EntityTypes.ABSTRACT_ARROW)) { - packetEntity = new PacketEntityArrow(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); - } else if (EntityTypes.ARMOR_STAND.equals(entityType)) { - packetEntity = new PacketEntityArmorStand(player, uuid, entityType, position.getX(), position.getY(), position.getZ(), data); - } else { - packetEntity = new PacketEntity(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); - } + packetEntity = new PacketEntity(player, uuid, entityType, position.getX(), position.getY(), position.getZ()); } entityMap.put(entityID, packetEntity); @@ -433,6 +431,13 @@ public void updateEntityMetadata(int entityID, List watchableObjects Integer attachedEntityID = (Integer) hookWatchableObject.getValue(); ((PacketEntityHook) entity).attached = attachedEntityID - 1; // the server adds 1 to the ID + } else if (entity instanceof PacketEntityArmorStand) { + EntityData armorStandByte = WatchableIndexUtil.getIndex(watchableObjects, 15); + if (armorStandByte != null) { + byte info = (Byte) armorStandByte.getValue(); + + ((PacketEntityArmorStand) entity).isMarker = (info & 0x10) != 0; + } } if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9_4)) {