implemented Goat properties
This commit is contained in:
parent
959f6241f4
commit
ee30c7dd18
6 changed files with 32 additions and 3 deletions
plugin/src/main/java/lol/pyr/znpcsplus
|
@ -209,8 +209,8 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
|||
registerType("piglin_charging_crossbow", false); // TODO
|
||||
|
||||
// Goat
|
||||
registerType("has_left_horn", true); // TODO
|
||||
registerType("has_right_horn", true); // TODO
|
||||
registerType("has_left_horn", true);
|
||||
registerType("has_right_horn", true);
|
||||
|
||||
// Vindicator
|
||||
registerType("celebrating", false); // TODO
|
||||
|
|
|
@ -87,6 +87,10 @@ public interface MetadataFactory {
|
|||
// Ghast
|
||||
EntityData ghastAttacking(boolean attacking);
|
||||
|
||||
// Goat
|
||||
EntityData goatHasLeftHorn(boolean hasLeftHorn);
|
||||
EntityData goatHasRightHorn(boolean hasRightHorn);
|
||||
|
||||
// Villager
|
||||
EntityData villagerData(int type, int profession, int level);
|
||||
}
|
||||
|
|
|
@ -180,6 +180,16 @@ public class V1_17MetadataFactory extends V1_16MetadataFactory {
|
|||
return newEntityData(16, EntityDataTypes.BOOLEAN, attacking);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData goatHasLeftHorn(boolean hasLeftHorn) {
|
||||
return newEntityData(18, EntityDataTypes.BOOLEAN, hasLeftHorn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData goatHasRightHorn(boolean hasRightHorn) {
|
||||
return newEntityData(19, EntityDataTypes.BOOLEAN, hasRightHorn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData villagerData(int type, int profession, int level) {
|
||||
return newEntityData(18, EntityDataTypes.VILLAGER_DATA, new VillagerData(type, profession, level));
|
||||
|
|
|
@ -205,6 +205,16 @@ public class V1_8MetadataFactory implements MetadataFactory {
|
|||
return newEntityData(16, EntityDataTypes.BYTE, (byte) (attacking ? 1 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData goatHasLeftHorn(boolean hasLeftHorn) {
|
||||
throw new UnsupportedOperationException("The goat horn entity data isn't supported on this version");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData goatHasRightHorn(boolean hasRightHorn) {
|
||||
throw new UnsupportedOperationException("The goat horn entity data isn't supported on this version");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData villagerData(int type, int profession, int level) {
|
||||
return newEntityData(16, EntityDataTypes.INT, profession);
|
||||
|
|
|
@ -308,7 +308,8 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
|
|||
.setHologramOffset(-1.175));
|
||||
|
||||
register(builder(p, "goat", EntityTypes.GOAT)
|
||||
.setHologramOffset(-0.675));
|
||||
.setHologramOffset(-0.675)
|
||||
.addProperties("has_left_horn", "has_right_horn"));
|
||||
|
||||
if (!version.isNewerThanOrEquals(ServerVersion.V_1_19)) return;
|
||||
|
||||
|
|
|
@ -217,6 +217,10 @@ public class V1_8PacketFactory implements PacketFactory {
|
|||
else if (entity.getType().equals(EntityTypes.GHAST)) {
|
||||
add(data, metadataFactory.ghastAttacking(properties.getProperty(propertyRegistry.getByName("attacking", Boolean.class))));
|
||||
}
|
||||
else if (entity.getType().equals(EntityTypes.GOAT)) {
|
||||
add(data, metadataFactory.goatHasLeftHorn(properties.getProperty(propertyRegistry.getByName("has_left_horn", Boolean.class))));
|
||||
add(data, metadataFactory.goatHasRightHorn(properties.getProperty(propertyRegistry.getByName("has_right_horn", Boolean.class))));
|
||||
}
|
||||
else if (entity.getType().equals(EntityTypes.VILLAGER)) {
|
||||
VillagerProfession profession = properties.getProperty(propertyRegistry.getByName("villager_profession", VillagerProfession.class));
|
||||
int professionId = profession.ordinal();
|
||||
|
|
Loading…
Reference in a new issue