added pose property

This commit is contained in:
D3v1s0m 2023-08-21 20:16:12 +05:30
parent fc5df502f3
commit 329d344013
No known key found for this signature in database
GPG Key ID: FA1F770C7B1D40C1
2 changed files with 25 additions and 1 deletions

@ -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("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("baby", false); // TODO
registerType("pose", NpcPose.STANDING);
// Player // Player
registerType("shoulder_entity_left", ParrotVariant.NONE); registerType("shoulder_entity_left", ParrotVariant.NONE);
@ -278,6 +277,8 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
register(new BitsetProperty("blaze_on_fire", blazeIndex, 0x01)); register(new BitsetProperty("blaze_on_fire", blazeIndex, 0x01));
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_14)) return; if (!ver.isNewerThanOrEquals(ServerVersion.V_1_14)) return;
// Pose
register(new NpcPoseProperty());
// Cat // Cat
int catIndex; int catIndex;

@ -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<NpcPose> {
public NpcPoseProperty() {
super("pose", NpcPose.STANDING, NpcPose.class);
}
@Override
public void apply(Player player, PacketEntity entity, boolean isSpawned, Map<Integer, EntityData> properties) {
properties.put(6, newEntityData(6, EntityDataTypes.ENTITY_POSE, EntityPose.valueOf(entity.getProperty(this).name())));
}
}