feat: added skeleton_type property
This commit is contained in:
parent
439f152ef5
commit
8cd7282bb5
4 changed files with 22 additions and 0 deletions
11
api/src/main/java/lol/pyr/znpcsplus/util/SkeletonType.java
Normal file
11
api/src/main/java/lol/pyr/znpcsplus/util/SkeletonType.java
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package lol.pyr.znpcsplus.util;
|
||||||
|
|
||||||
|
public enum SkeletonType {
|
||||||
|
NORMAL,
|
||||||
|
WITHER,
|
||||||
|
STRAY;
|
||||||
|
|
||||||
|
public byte getLegacyId() {
|
||||||
|
return (byte) ordinal();
|
||||||
|
}
|
||||||
|
}
|
|
@ -296,6 +296,7 @@ public class ZNpcsPlus {
|
||||||
registerEnumParser(manager, ArmadilloState.class, incorrectUsageMessage);
|
registerEnumParser(manager, ArmadilloState.class, incorrectUsageMessage);
|
||||||
registerEnumParser(manager, WoldVariant.class, incorrectUsageMessage);
|
registerEnumParser(manager, WoldVariant.class, incorrectUsageMessage);
|
||||||
registerEnumParser(manager, NpcStorageType.class, incorrectUsageMessage);
|
registerEnumParser(manager, NpcStorageType.class, incorrectUsageMessage);
|
||||||
|
registerEnumParser(manager, SkeletonType.class, incorrectUsageMessage);
|
||||||
|
|
||||||
manager.registerCommand("npc", new MultiCommand(bootstrap.loadHelpMessage("root"))
|
manager.registerCommand("npc", new MultiCommand(bootstrap.loadHelpMessage("root"))
|
||||||
.addSubcommand("center", new CenterCommand(npcRegistry))
|
.addSubcommand("center", new CenterCommand(npcRegistry))
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
||||||
registerEnumSerializer(Sound.class);
|
registerEnumSerializer(Sound.class);
|
||||||
registerEnumSerializer(ArmadilloState.class);
|
registerEnumSerializer(ArmadilloState.class);
|
||||||
registerEnumSerializer(WoldVariant.class);
|
registerEnumSerializer(WoldVariant.class);
|
||||||
|
registerEnumSerializer(SkeletonType.class);
|
||||||
|
|
||||||
registerPrimitiveSerializers(Integer.class, Boolean.class, Double.class, Float.class, Long.class, Short.class, Byte.class, String.class);
|
registerPrimitiveSerializers(Integer.class, Boolean.class, Double.class, Float.class, Long.class, Short.class, Byte.class, String.class);
|
||||||
|
|
||||||
|
@ -439,6 +440,12 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
||||||
witherIndex += 3; // skip the first 3 indexes, will be used for the other properties later
|
witherIndex += 3; // skip the first 3 indexes, will be used for the other properties later
|
||||||
register(new IntegerProperty("invulnerable_time", witherIndex, 0, false));
|
register(new IntegerProperty("invulnerable_time", witherIndex, 0, false));
|
||||||
|
|
||||||
|
// Skeleton
|
||||||
|
if (ver.isOlderThan(ServerVersion.V_1_11)) {
|
||||||
|
if (legacyBooleans) register(new EncodedByteProperty<>("skeleton_type", SkeletonType.NORMAL, 13, SkeletonType::getLegacyId));
|
||||||
|
else register(new EncodedIntegerProperty<>("skeleton_type", SkeletonType.NORMAL, ver.isOlderThan(ServerVersion.V_1_10) ? 11 : 12, Enum::ordinal));
|
||||||
|
}
|
||||||
|
|
||||||
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_9)) return;
|
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_9)) return;
|
||||||
// Shulker
|
// Shulker
|
||||||
int shulkerIndex;
|
int shulkerIndex;
|
||||||
|
|
|
@ -143,6 +143,9 @@ public class NpcTypeImpl implements NpcType {
|
||||||
} else if (version.isOlderThan(ServerVersion.V_1_11) && type.equals(EntityTypes.HORSE)) {
|
} else if (version.isOlderThan(ServerVersion.V_1_11) && type.equals(EntityTypes.HORSE)) {
|
||||||
addProperties("has_chest");
|
addProperties("has_chest");
|
||||||
}
|
}
|
||||||
|
if (version.isOlderThan(ServerVersion.V_1_11) && EntityTypes.isTypeInstanceOf(type, EntityTypes.SKELETON)) {
|
||||||
|
addProperties("skeleton_type");
|
||||||
|
}
|
||||||
if (EntityTypes.isTypeInstanceOf(type, EntityTypes.ABSTRACT_EVO_ILLU_ILLAGER)) {
|
if (EntityTypes.isTypeInstanceOf(type, EntityTypes.ABSTRACT_EVO_ILLU_ILLAGER)) {
|
||||||
addProperties("spell");
|
addProperties("spell");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue