diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java index 09ef856..3ceeed8 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java @@ -63,7 +63,6 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry { registerType("using_item", false); // TODO: fix it for 1.8 and add new property to use offhand item and riptide animation registerType("baby", false); // TODO - registerType("pose", NpcPose.STANDING); // Player registerType("shoulder_entity_left", ParrotVariant.NONE); @@ -278,6 +277,8 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry { register(new BitsetProperty("blaze_on_fire", blazeIndex, 0x01)); if (!ver.isNewerThanOrEquals(ServerVersion.V_1_14)) return; + // Pose + register(new NpcPoseProperty()); // Cat int catIndex; diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/entity/properties/NpcPoseProperty.java b/plugin/src/main/java/lol/pyr/znpcsplus/entity/properties/NpcPoseProperty.java new file mode 100644 index 0000000..3599f64 --- /dev/null +++ b/plugin/src/main/java/lol/pyr/znpcsplus/entity/properties/NpcPoseProperty.java @@ -0,0 +1,23 @@ +package lol.pyr.znpcsplus.entity.properties; + +import com.github.retrooper.packetevents.protocol.entity.data.EntityData; +import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes; +import com.github.retrooper.packetevents.protocol.entity.pose.EntityPose; +import lol.pyr.znpcsplus.entity.EntityPropertyImpl; +import lol.pyr.znpcsplus.entity.PacketEntity; +import lol.pyr.znpcsplus.util.NpcPose; +import org.bukkit.entity.Player; + +import java.util.Map; + +public class NpcPoseProperty extends EntityPropertyImpl { + + public NpcPoseProperty() { + super("pose", NpcPose.STANDING, NpcPose.class); + } + + @Override + public void apply(Player player, PacketEntity entity, boolean isSpawned, Map properties) { + properties.put(6, newEntityData(6, EntityDataTypes.ENTITY_POSE, EntityPose.valueOf(entity.getProperty(this).name()))); + } +}