added axolotl properties

This commit is contained in:
D3v1s0m 2023-08-21 20:09:47 +05:30
parent 622d6efd42
commit beb3d21ba4
No known key found for this signature in database
GPG Key ID: FA1F770C7B1D40C1
4 changed files with 16 additions and 0 deletions

@ -0,0 +1,9 @@
package lol.pyr.znpcsplus.util;
public enum AxolotlVariant {
LUCY,
WILD,
GOLD,
CYAN,
BLUE
}

@ -264,6 +264,7 @@ public class ZNpcsPlus extends JavaPlugin {
registerEnumParser(manager, VillagerType.class, incorrectUsageMessage); registerEnumParser(manager, VillagerType.class, incorrectUsageMessage);
registerEnumParser(manager, VillagerProfession.class, incorrectUsageMessage); registerEnumParser(manager, VillagerProfession.class, incorrectUsageMessage);
registerEnumParser(manager, VillagerLevel.class, incorrectUsageMessage); registerEnumParser(manager, VillagerLevel.class, incorrectUsageMessage);
registerEnumParser(manager, AxolotlVariant.class, incorrectUsageMessage);
manager.registerCommand("npc", new MultiCommand(loadHelpMessage("root")) manager.registerCommand("npc", new MultiCommand(loadHelpMessage("root"))
.addSubcommand("create", new CreateCommand(npcRegistry, typeRegistry)) .addSubcommand("create", new CreateCommand(npcRegistry, typeRegistry))

@ -131,6 +131,7 @@ public class PropertySetCommand implements CommandHandler {
if (type == VillagerType.class) return context.suggestEnum(VillagerType.values()); if (type == VillagerType.class) return context.suggestEnum(VillagerType.values());
if (type == VillagerProfession.class) return context.suggestEnum(VillagerProfession.values()); if (type == VillagerProfession.class) return context.suggestEnum(VillagerProfession.values());
if (type == VillagerLevel.class) return context.suggestEnum(VillagerLevel.values()); if (type == VillagerLevel.class) return context.suggestEnum(VillagerLevel.values());
if (type == AxolotlVariant.class) return context.suggestEnum(AxolotlVariant.values());
} }
else if (context.argSize() == 4) { else if (context.argSize() == 4) {
if (type == BlockState.class) { if (type == BlockState.class) {

@ -58,6 +58,7 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
registerEnumSerializer(VillagerType.class); registerEnumSerializer(VillagerType.class);
registerEnumSerializer(VillagerProfession.class); registerEnumSerializer(VillagerProfession.class);
registerEnumSerializer(VillagerLevel.class); registerEnumSerializer(VillagerLevel.class);
registerEnumSerializer(AxolotlVariant.class);
/* /*
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
@ -301,6 +302,7 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
register(new BitsetProperty("fox_faceplanted", foxIndex, 0x40)); register(new BitsetProperty("fox_faceplanted", foxIndex, 0x40));
linkProperties("fox_sitting", "fox_crouching", "fox_sleeping", "fox_faceplanted"); linkProperties("fox_sitting", "fox_crouching", "fox_sleeping", "fox_faceplanted");
// Bee
int beeIndex; int beeIndex;
if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) beeIndex = 17; if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) beeIndex = 17;
else beeIndex = 18; else beeIndex = 18;
@ -315,6 +317,9 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
register(new BooleanProperty("immune_to_zombification", zombificationIndex, false, legacyBooleans)); register(new BooleanProperty("immune_to_zombification", zombificationIndex, false, legacyBooleans));
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_17)) return; if (!ver.isNewerThanOrEquals(ServerVersion.V_1_17)) return;
// Axolotl
register(new EncodedIntegerProperty<>("axolotl_variant", AxolotlVariant.LUCY, 17, Enum::ordinal));
register(new BooleanProperty("playing_dead", 18, false, legacyBooleans));
// Goat // Goat
register(new BooleanProperty("has_left_horn", 18, true, legacyBooleans)); register(new BooleanProperty("has_left_horn", 18, true, legacyBooleans));