Implemented Axolotl properties
This commit is contained in:
parent
3e583f84f8
commit
dd3c88efce
6 changed files with 47 additions and 15 deletions
|
@ -84,6 +84,10 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
||||||
registerType("left_leg_rotation", new Vector3f(-1 , 0, -1));
|
registerType("left_leg_rotation", new Vector3f(-1 , 0, -1));
|
||||||
registerType("right_leg_rotation", new Vector3f(1, 0, 1));
|
registerType("right_leg_rotation", new Vector3f(1, 0, 1));
|
||||||
|
|
||||||
|
// Axolotl
|
||||||
|
registerType("axolotl_variant", 0);
|
||||||
|
registerType("playing_dead", false); // TODO fix disabling
|
||||||
|
|
||||||
// Bat
|
// Bat
|
||||||
registerType("hanging", false); // TODO
|
registerType("hanging", false); // TODO
|
||||||
|
|
||||||
|
@ -105,10 +109,6 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
||||||
registerType("carpet_color", DyeColor.class); // TODO
|
registerType("carpet_color", DyeColor.class); // TODO
|
||||||
registerType("llama_variant", 0); // TODO
|
registerType("llama_variant", 0); // TODO
|
||||||
|
|
||||||
// Axolotl
|
|
||||||
registerType("axolotl_variant", 0); // TODO
|
|
||||||
registerType("playing_dead", false); // TODO
|
|
||||||
|
|
||||||
// Bee
|
// Bee
|
||||||
registerType("angry", false); // TODO
|
registerType("angry", false); // TODO
|
||||||
registerType("has_nectar", false); // TODO
|
registerType("has_nectar", false); // TODO
|
||||||
|
|
|
@ -30,6 +30,8 @@ public interface MetadataFactory {
|
||||||
EntityData usingItem(boolean enabled, boolean offhand, boolean riptide);
|
EntityData usingItem(boolean enabled, boolean offhand, boolean riptide);
|
||||||
EntityData potionColor(int color);
|
EntityData potionColor(int color);
|
||||||
EntityData potionAmbient(boolean ambient);
|
EntityData potionAmbient(boolean ambient);
|
||||||
|
|
||||||
|
// Armor Stand
|
||||||
EntityData armorStandProperties(boolean small, boolean arms, boolean noBasePlate);
|
EntityData armorStandProperties(boolean small, boolean arms, boolean noBasePlate);
|
||||||
EntityData armorStandHeadRotation(Vector3f headRotation);
|
EntityData armorStandHeadRotation(Vector3f headRotation);
|
||||||
EntityData armorStandBodyRotation(Vector3f bodyRotation);
|
EntityData armorStandBodyRotation(Vector3f bodyRotation);
|
||||||
|
@ -37,4 +39,8 @@ public interface MetadataFactory {
|
||||||
EntityData armorStandRightArmRotation(Vector3f rightArmRotation);
|
EntityData armorStandRightArmRotation(Vector3f rightArmRotation);
|
||||||
EntityData armorStandLeftLegRotation(Vector3f leftLegRotation);
|
EntityData armorStandLeftLegRotation(Vector3f leftLegRotation);
|
||||||
EntityData armorStandRightLegRotation(Vector3f rightLegRotation);
|
EntityData armorStandRightLegRotation(Vector3f rightLegRotation);
|
||||||
|
|
||||||
|
// Axolotl
|
||||||
|
EntityData axolotlVariant(int variant);
|
||||||
|
EntityData playingDead(boolean playingDead);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,4 +69,14 @@ public class V1_17MetadataFactory extends V1_16MetadataFactory {
|
||||||
public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) {
|
public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) {
|
||||||
return createRotations(21, rightLegRotation);
|
return createRotations(21, rightLegRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityData axolotlVariant(int variant) {
|
||||||
|
return newEntityData(17, EntityDataTypes.INT, variant);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityData playingDead(boolean playingDead) {
|
||||||
|
return newEntityData(18, EntityDataTypes.BOOLEAN, playingDead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,16 @@ public class V1_8MetadataFactory implements MetadataFactory {
|
||||||
return createRotations(16, rightLegRotation);
|
return createRotations(16, rightLegRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityData axolotlVariant(int variant) {
|
||||||
|
throw new UnsupportedOperationException("The axolotl variant entity data isn't supported on this version");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityData playingDead(boolean playingDead) {
|
||||||
|
throw new UnsupportedOperationException("The playing dead entity data isn't supported on this version");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityData silent(boolean enabled) {
|
public EntityData silent(boolean enabled) {
|
||||||
return newEntityData(4, EntityDataTypes.BYTE, (byte) (enabled ? 1 : 0));
|
return newEntityData(4, EntityDataTypes.BYTE, (byte) (enabled ? 1 : 0));
|
||||||
|
|
|
@ -290,7 +290,8 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
|
||||||
if (!version.isNewerThanOrEquals(ServerVersion.V_1_17)) return;
|
if (!version.isNewerThanOrEquals(ServerVersion.V_1_17)) return;
|
||||||
|
|
||||||
register(builder(p, "axolotl", EntityTypes.AXOLOTL)
|
register(builder(p, "axolotl", EntityTypes.AXOLOTL)
|
||||||
.setHologramOffset(-1.555));
|
.setHologramOffset(-1.555)
|
||||||
|
.addProperties("axolotl_variant", "playing_dead"));
|
||||||
|
|
||||||
register(builder(p, "glow_squid", EntityTypes.GLOW_SQUID)
|
register(builder(p, "glow_squid", EntityTypes.GLOW_SQUID)
|
||||||
.setHologramOffset(-1.175));
|
.setHologramOffset(-1.175));
|
||||||
|
|
|
@ -130,15 +130,6 @@ public class V1_8PacketFactory implements PacketFactory {
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer, EntityData> generateMetadata(Player player, PacketEntity entity, PropertyHolder properties) {
|
public Map<Integer, EntityData> generateMetadata(Player player, PacketEntity entity, PropertyHolder properties) {
|
||||||
HashMap<Integer, EntityData> data = new HashMap<>();
|
HashMap<Integer, EntityData> data = new HashMap<>();
|
||||||
if (entity.getType() == EntityTypes.PLAYER) add(data, metadataFactory.skinLayers(
|
|
||||||
properties.getProperty(propertyRegistry.getByName("skin_cape", Boolean.class)),
|
|
||||||
properties.getProperty(propertyRegistry.getByName("skin_jacket", Boolean.class)),
|
|
||||||
properties.getProperty(propertyRegistry.getByName("skin_left_sleeve", Boolean.class)),
|
|
||||||
properties.getProperty(propertyRegistry.getByName("skin_right_sleeve", Boolean.class)),
|
|
||||||
properties.getProperty(propertyRegistry.getByName("skin_left_leg", Boolean.class)),
|
|
||||||
properties.getProperty(propertyRegistry.getByName("skin_right_leg", Boolean.class)),
|
|
||||||
properties.getProperty(propertyRegistry.getByName("skin_hat", Boolean.class))
|
|
||||||
));
|
|
||||||
add(data, metadataFactory.effects(
|
add(data, metadataFactory.effects(
|
||||||
properties.getProperty(propertyRegistry.getByName("fire", Boolean.class)),
|
properties.getProperty(propertyRegistry.getByName("fire", Boolean.class)),
|
||||||
false,
|
false,
|
||||||
|
@ -149,7 +140,18 @@ public class V1_8PacketFactory implements PacketFactory {
|
||||||
add(data, metadataFactory.silent(properties.getProperty(propertyRegistry.getByName("silent", Boolean.class))));
|
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.potionColor(properties.getProperty(propertyRegistry.getByName("potion_color", Color.class)).asRGB()));
|
||||||
add(data, metadataFactory.potionAmbient(properties.getProperty(propertyRegistry.getByName("potion_ambient", Boolean.class))));
|
add(data, metadataFactory.potionAmbient(properties.getProperty(propertyRegistry.getByName("potion_ambient", Boolean.class))));
|
||||||
if (entity.getType() == EntityTypes.ARMOR_STAND) {
|
if (entity.getType().equals(EntityTypes.PLAYER)) {
|
||||||
|
add(data, metadataFactory.skinLayers(
|
||||||
|
properties.getProperty(propertyRegistry.getByName("skin_cape", Boolean.class)),
|
||||||
|
properties.getProperty(propertyRegistry.getByName("skin_jacket", Boolean.class)),
|
||||||
|
properties.getProperty(propertyRegistry.getByName("skin_left_sleeve", Boolean.class)),
|
||||||
|
properties.getProperty(propertyRegistry.getByName("skin_right_sleeve", Boolean.class)),
|
||||||
|
properties.getProperty(propertyRegistry.getByName("skin_left_leg", Boolean.class)),
|
||||||
|
properties.getProperty(propertyRegistry.getByName("skin_right_leg", Boolean.class)),
|
||||||
|
properties.getProperty(propertyRegistry.getByName("skin_hat", Boolean.class))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else if (entity.getType().equals(EntityTypes.ARMOR_STAND)) {
|
||||||
add(data, metadataFactory.armorStandProperties(
|
add(data, metadataFactory.armorStandProperties(
|
||||||
properties.getProperty(propertyRegistry.getByName("small", Boolean.class)),
|
properties.getProperty(propertyRegistry.getByName("small", Boolean.class)),
|
||||||
properties.getProperty(propertyRegistry.getByName("arms", Boolean.class)),
|
properties.getProperty(propertyRegistry.getByName("arms", Boolean.class)),
|
||||||
|
@ -161,6 +163,9 @@ public class V1_8PacketFactory implements PacketFactory {
|
||||||
add(data, metadataFactory.armorStandRightArmRotation(properties.getProperty(propertyRegistry.getByName("right_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.armorStandLeftLegRotation(properties.getProperty(propertyRegistry.getByName("left_leg_rotation", Vector3f.class))));
|
||||||
add(data, metadataFactory.armorStandRightLegRotation(properties.getProperty(propertyRegistry.getByName("right_leg_rotation", Vector3f.class))));
|
add(data, metadataFactory.armorStandRightLegRotation(properties.getProperty(propertyRegistry.getByName("right_leg_rotation", Vector3f.class))));
|
||||||
|
} else if (entity.getType().equals(EntityTypes.AXOLOTL)) {
|
||||||
|
add(data, metadataFactory.axolotlVariant(properties.getProperty(propertyRegistry.getByName("axolotl_variant", Integer.class))));
|
||||||
|
add(data, metadataFactory.playingDead(properties.getProperty(propertyRegistry.getByName("playing_dead", Boolean.class))));
|
||||||
}
|
}
|
||||||
if (properties.hasProperty(propertyRegistry.getByName("name"))) {
|
if (properties.hasProperty(propertyRegistry.getByName("name"))) {
|
||||||
add(data, metadataFactory.name(PapiUtil.set(textSerializer, player, properties.getProperty(propertyRegistry.getByName("name", Component.class)))));
|
add(data, metadataFactory.name(PapiUtil.set(textSerializer, player, properties.getProperty(propertyRegistry.getByName("name", Component.class)))));
|
||||||
|
|
Loading…
Reference in a new issue