Implemented armor stand properties
This commit is contained in:
parent
46d848b823
commit
739bbe7116
15 changed files with 320 additions and 12 deletions
46
api/src/main/java/lol/pyr/znpcsplus/util/Vector3f.java
Normal file
46
api/src/main/java/lol/pyr/znpcsplus/util/Vector3f.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
package lol.pyr.znpcsplus.util;
|
||||
|
||||
public class Vector3f {
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
|
||||
public Vector3f() {
|
||||
this.x = 0.0F;
|
||||
this.y = 0.0F;
|
||||
this.z = 0.0F;
|
||||
}
|
||||
|
||||
public Vector3f(float x, float y, float z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Vector3f(String s) {
|
||||
String[] split = s.split(",");
|
||||
this.x = Float.parseFloat(split[0]);
|
||||
this.y = Float.parseFloat(split[1]);
|
||||
this.z = Float.parseFloat(split[2]);
|
||||
}
|
||||
|
||||
public float getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public float getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.x + "," + this.y + "," + this.z;
|
||||
}
|
||||
|
||||
public static Vector3f zero() {
|
||||
return new Vector3f();
|
||||
}
|
||||
}
|
|
@ -239,6 +239,7 @@ public class ZNpcsPlus extends JavaPlugin {
|
|||
versions.put(ServerVersion.V_1_11, LazyLoader.of(V1_11MetadataFactory::new));
|
||||
versions.put(ServerVersion.V_1_13, LazyLoader.of(V1_13MetadataFactory::new));
|
||||
versions.put(ServerVersion.V_1_14, LazyLoader.of(V1_14MetadataFactory::new));
|
||||
versions.put(ServerVersion.V_1_15, LazyLoader.of(V1_15MetadataFactory::new));
|
||||
versions.put(ServerVersion.V_1_16, LazyLoader.of(V1_16MetadataFactory::new));
|
||||
versions.put(ServerVersion.V_1_17, LazyLoader.of(V1_17MetadataFactory::new));
|
||||
|
||||
|
@ -270,6 +271,7 @@ public class ZNpcsPlus extends JavaPlugin {
|
|||
manager.registerParser(NamedTextColor.class, new NamedTextColorParser(incorrectUsageMessage));
|
||||
manager.registerParser(InteractionType.class, new InteractionTypeParser(incorrectUsageMessage));
|
||||
manager.registerParser(Color.class, new ColorParser(incorrectUsageMessage));
|
||||
manager.registerParser(Vector3f.class, new Vector3fParser(incorrectUsageMessage));
|
||||
|
||||
registerEnumParser(manager, NpcPose.class, incorrectUsageMessage);
|
||||
registerEnumParser(manager, DyeColor.class, incorrectUsageMessage);
|
||||
|
|
|
@ -11,6 +11,7 @@ import lol.pyr.znpcsplus.npc.NpcEntryImpl;
|
|||
import lol.pyr.znpcsplus.npc.NpcImpl;
|
||||
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
|
||||
import lol.pyr.znpcsplus.util.NpcPose;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Color;
|
||||
|
@ -77,6 +78,7 @@ public class PropertyCommand implements CommandHandler {
|
|||
if (type == NamedTextColor.class) return context.suggestCollection(NamedTextColor.NAMES.keys());
|
||||
if (type == NpcPose.class) return context.suggestEnum(NpcPose.values());
|
||||
if (type == Color.class) return context.suggestLiteral("0x0F00FF", "#FFFFFF", "16711935");
|
||||
if (type == Vector3f.class) return context.suggestLiteral("0 0 0", "0.0 0.0 0.0");
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import lol.pyr.znpcsplus.api.skin.SkinDescriptor;
|
|||
import lol.pyr.znpcsplus.entity.serializers.*;
|
||||
import lol.pyr.znpcsplus.skin.cache.SkinCache;
|
||||
import lol.pyr.znpcsplus.util.NpcPose;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Color;
|
||||
|
@ -30,6 +31,7 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
|||
registerSerializer(new SkinDescriptorSerializer(skinCache));
|
||||
registerSerializer(new ItemStackPropertySerializer());
|
||||
registerSerializer(new ColorPropertySerializer());
|
||||
registerSerializer(new Vector3fPropertySerializer());
|
||||
|
||||
registerEnumSerializer(NpcPose.class);
|
||||
registerEnumSerializer(DyeColor.class);
|
||||
|
@ -71,17 +73,16 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
|||
registerType("show_base", true); // TODO
|
||||
|
||||
// Armor Stand
|
||||
registerType("small", false); // TODO
|
||||
registerType("arms", false); // TODO
|
||||
registerType("base_plate", true); // TODO
|
||||
registerType("small", false);
|
||||
registerType("arms", false);
|
||||
registerType("base_plate", true);
|
||||
|
||||
// TODO: Make a vector3f class for all of these
|
||||
registerType("head_rotation", null); // TODO
|
||||
registerType("body_rotation", null); // TODO
|
||||
registerType("left_arm_rotation", null); // TODO
|
||||
registerType("right_arm_rotation", null); // TODO
|
||||
registerType("left_leg_rotation", null); // TODO
|
||||
registerType("right_leg_rotation", null); // TODO
|
||||
registerType("head_rotation", Vector3f.zero());
|
||||
registerType("body_rotation", Vector3f.zero());
|
||||
registerType("left_arm_rotation", new Vector3f(-10, 0, -10));
|
||||
registerType("right_arm_rotation", new Vector3f(-15, 0, 10));
|
||||
registerType("left_leg_rotation", new Vector3f(-1 , 0, -1));
|
||||
registerType("right_leg_rotation", new Vector3f(1, 0, 1));
|
||||
|
||||
// Bat
|
||||
registerType("hanging", false); // TODO
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package lol.pyr.znpcsplus.entity.serializers;
|
||||
|
||||
import lol.pyr.znpcsplus.entity.PropertySerializer;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
|
||||
public class Vector3fPropertySerializer implements PropertySerializer<Vector3f> {
|
||||
|
||||
@Override
|
||||
public String serialize(Vector3f property) {
|
||||
return property.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3f deserialize(String property) {
|
||||
return new Vector3f(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Vector3f> getTypeClass() {
|
||||
return Vector3f.class;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package lol.pyr.znpcsplus.metadata;
|
|||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
import com.github.retrooper.packetevents.protocol.entity.pose.EntityPose;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
/**
|
||||
|
@ -29,4 +30,11 @@ public interface MetadataFactory {
|
|||
EntityData usingItem(boolean enabled, boolean offhand, boolean riptide);
|
||||
EntityData potionColor(int color);
|
||||
EntityData potionAmbient(boolean ambient);
|
||||
EntityData armorStandProperties(boolean small, boolean arms, boolean noBasePlate);
|
||||
EntityData armorStandHeadRotation(Vector3f headRotation);
|
||||
EntityData armorStandBodyRotation(Vector3f bodyRotation);
|
||||
EntityData armorStandLeftArmRotation(Vector3f leftArmRotation);
|
||||
EntityData armorStandRightArmRotation(Vector3f rightArmRotation);
|
||||
EntityData armorStandLeftLegRotation(Vector3f leftLegRotation);
|
||||
EntityData armorStandRightLegRotation(Vector3f rightLegRotation);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package lol.pyr.znpcsplus.metadata;
|
|||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
|
||||
public class V1_10MetadataFactory extends V1_9MetadataFactory {
|
||||
@Override
|
||||
|
@ -23,4 +24,39 @@ public class V1_10MetadataFactory extends V1_9MetadataFactory {
|
|||
public EntityData potionAmbient(boolean ambient) {
|
||||
return newEntityData(9, EntityDataTypes.BOOLEAN, ambient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandProperties(boolean small, boolean arms, boolean noBasePlate) {
|
||||
return newEntityData(11, EntityDataTypes.BYTE, (byte) ((small ? 0x01 : 0) | (arms ? 0x04 : 0) | (noBasePlate ? 0x08 : 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandHeadRotation(Vector3f headRotation) {
|
||||
return newEntityData(12, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandBodyRotation(Vector3f bodyRotation) {
|
||||
return newEntityData(13, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) {
|
||||
return newEntityData(14, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) {
|
||||
return newEntityData(15, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) {
|
||||
return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) {
|
||||
return newEntityData(17, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package lol.pyr.znpcsplus.metadata;
|
|||
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.util.Vector3f;
|
||||
|
||||
public class V1_14MetadataFactory extends V1_13MetadataFactory {
|
||||
@Override
|
||||
|
@ -29,4 +30,39 @@ public class V1_14MetadataFactory extends V1_13MetadataFactory {
|
|||
public EntityData potionAmbient(boolean ambient) {
|
||||
return newEntityData(10, EntityDataTypes.BOOLEAN, ambient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandProperties(boolean small, boolean arms, boolean noBasePlate) {
|
||||
return newEntityData(13, EntityDataTypes.BYTE, (byte) ((small ? 0x01 : 0) | (arms ? 0x04 : 0) | (noBasePlate ? 0x08 : 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandHeadRotation(Vector3f headRotation) {
|
||||
return newEntityData(14, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandBodyRotation(Vector3f bodyRotation) {
|
||||
return newEntityData(15, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) {
|
||||
return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) {
|
||||
return newEntityData(17, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) {
|
||||
return newEntityData(18, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) {
|
||||
return newEntityData(19, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package lol.pyr.znpcsplus.metadata;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
|
||||
public class V1_15MetadataFactory extends V1_14MetadataFactory {
|
||||
@Override
|
||||
public EntityData armorStandProperties(boolean small, boolean arms, boolean noBasePlate) {
|
||||
return newEntityData(14, EntityDataTypes.BYTE, (byte) ((small ? 0x01 : 0) | (arms ? 0x04 : 0) | (!noBasePlate ? 0x08 : 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandHeadRotation(Vector3f headRotation) {
|
||||
return newEntityData(15, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandBodyRotation(Vector3f bodyRotation) {
|
||||
return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) {
|
||||
return newEntityData(17, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) {
|
||||
return newEntityData(18, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) {
|
||||
return newEntityData(19, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) {
|
||||
return newEntityData(20, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ()));
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package lol.pyr.znpcsplus.metadata;
|
|||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
|
||||
public class V1_16MetadataFactory extends V1_14MetadataFactory {
|
||||
public class V1_16MetadataFactory extends V1_15MetadataFactory {
|
||||
@Override
|
||||
public EntityData skinLayers(boolean cape, boolean jacket, boolean leftSleeve, boolean rightSleeve, boolean leftLeg, boolean rightLeg, boolean hat) {
|
||||
return createSkinLayers(16, cape, jacket, leftSleeve, rightSleeve, leftLeg, rightLeg, hat);
|
||||
|
|
|
@ -2,6 +2,7 @@ package lol.pyr.znpcsplus.metadata;
|
|||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
|
||||
public class V1_17MetadataFactory extends V1_16MetadataFactory {
|
||||
@Override
|
||||
|
@ -33,4 +34,41 @@ public class V1_17MetadataFactory extends V1_16MetadataFactory {
|
|||
public EntityData potionAmbient(boolean ambient) {
|
||||
return newEntityData(11, EntityDataTypes.BOOLEAN, ambient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandProperties(boolean small, boolean arms, boolean noBasePlate) {
|
||||
return newEntityData(15, EntityDataTypes.BYTE, (byte) ((small ? 0x01 : 0) | (arms ? 0x04 : 0) | (noBasePlate ? 0x08 : 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandHeadRotation(Vector3f headRotation) {
|
||||
return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandBodyRotation(Vector3f bodyRotation) {
|
||||
return newEntityData(17, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) {
|
||||
return newEntityData(18, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) {
|
||||
return newEntityData(19, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) {
|
||||
return newEntityData(20, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) {
|
||||
return newEntityData(21, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityDataType;
|
|||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.protocol.entity.pose.EntityPose;
|
||||
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public class V1_8MetadataFactory implements MetadataFactory {
|
||||
|
@ -58,6 +59,41 @@ public class V1_8MetadataFactory implements MetadataFactory {
|
|||
return newEntityData(8, EntityDataTypes.BYTE, (byte) (ambient ? 1 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandProperties(boolean small, boolean arms, boolean noBasePlate) {
|
||||
return newEntityData(10, EntityDataTypes.BYTE, (byte) ((small ? 0x01 : 0) | (arms ? 0x04 : 0) | (noBasePlate ? 0x08 : 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandHeadRotation(Vector3f headRotation) {
|
||||
return newEntityData(11, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandBodyRotation(Vector3f bodyRotation) {
|
||||
return newEntityData(12, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) {
|
||||
return newEntityData(13, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) {
|
||||
return newEntityData(14, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) {
|
||||
return newEntityData(15, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) {
|
||||
return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData silent(boolean enabled) {
|
||||
return newEntityData(4, EntityDataTypes.BYTE, (byte) (enabled ? 1 : 0));
|
||||
|
|
|
@ -41,7 +41,9 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
|
|||
// Most hologram offsets generated using Entity#getHeight() in 1.19.4
|
||||
|
||||
register(builder(p, "armor_stand", EntityTypes.ARMOR_STAND)
|
||||
.setHologramOffset(-0.15).addEquipmentProperties());
|
||||
.setHologramOffset(-0.15)
|
||||
.addEquipmentProperties()
|
||||
.addProperties("small", "arms", "base_plate", "head_rotation", "body_rotation", "left_arm_rotation", "right_arm_rotation", "left_leg_rotation", "right_leg_rotation"));
|
||||
|
||||
register(builder(p, "bat", EntityTypes.BAT)
|
||||
.setHologramOffset(-1.075));
|
||||
|
|
|
@ -18,6 +18,7 @@ import lol.pyr.znpcsplus.scheduling.TaskScheduler;
|
|||
import lol.pyr.znpcsplus.skin.BaseSkinDescriptor;
|
||||
import lol.pyr.znpcsplus.util.NpcLocation;
|
||||
import lol.pyr.znpcsplus.util.PapiUtil;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Color;
|
||||
|
@ -145,6 +146,19 @@ public class V1_8PacketFactory implements PacketFactory {
|
|||
add(data, metadataFactory.silent(properties.getProperty(propertyRegistry.getByName("silent", Boolean.class))));
|
||||
add(data, metadataFactory.potionColor(properties.getProperty(propertyRegistry.getByName("potion_color", Color.class)).asRGB()));
|
||||
add(data, metadataFactory.potionAmbient(properties.getProperty(propertyRegistry.getByName("potion_ambient", Boolean.class))));
|
||||
if (entity.getType() == EntityTypes.ARMOR_STAND) {
|
||||
add(data, metadataFactory.armorStandProperties(
|
||||
properties.getProperty(propertyRegistry.getByName("small", Boolean.class)),
|
||||
properties.getProperty(propertyRegistry.getByName("arms", Boolean.class)),
|
||||
!properties.getProperty(propertyRegistry.getByName("base_plate", Boolean.class))
|
||||
));
|
||||
add(data, metadataFactory.armorStandHeadRotation(properties.getProperty(propertyRegistry.getByName("head_rotation", Vector3f.class))));
|
||||
add(data, metadataFactory.armorStandBodyRotation(properties.getProperty(propertyRegistry.getByName("body_rotation", Vector3f.class))));
|
||||
add(data, metadataFactory.armorStandLeftArmRotation(properties.getProperty(propertyRegistry.getByName("left_arm_rotation", Vector3f.class))));
|
||||
add(data, metadataFactory.armorStandRightArmRotation(properties.getProperty(propertyRegistry.getByName("right_arm_rotation", Vector3f.class))));
|
||||
add(data, metadataFactory.armorStandLeftLegRotation(properties.getProperty(propertyRegistry.getByName("left_leg_rotation", Vector3f.class))));
|
||||
add(data, metadataFactory.armorStandRightLegRotation(properties.getProperty(propertyRegistry.getByName("right_leg_rotation", Vector3f.class))));
|
||||
}
|
||||
if (properties.hasProperty(propertyRegistry.getByName("name"))) {
|
||||
add(data, metadataFactory.name(PapiUtil.set(player, properties.getProperty(propertyRegistry.getByName("name", Component.class)))));
|
||||
add(data, metadataFactory.nameShown());
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package lol.pyr.znpcsplus.parsers;
|
||||
|
||||
import lol.pyr.director.adventure.command.CommandContext;
|
||||
import lol.pyr.director.adventure.parse.ParserType;
|
||||
import lol.pyr.director.common.command.CommandExecutionException;
|
||||
import lol.pyr.director.common.message.Message;
|
||||
import lol.pyr.znpcsplus.util.Vector3f;
|
||||
|
||||
import java.util.Deque;
|
||||
|
||||
public class Vector3fParser extends ParserType<Vector3f> {
|
||||
public Vector3fParser(Message<CommandContext> message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3f parse(Deque<String> deque) throws CommandExecutionException {
|
||||
return new Vector3f(
|
||||
Float.parseFloat(deque.pop()),
|
||||
Float.parseFloat(deque.pop()),
|
||||
Float.parseFloat(deque.pop()));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue