From 75bebd959d33c3b6a99b9976c09e6b5192354fcb Mon Sep 17 00:00:00 2001 From: D3v1s0m Date: Wed, 8 Nov 2023 18:56:42 +0530 Subject: [PATCH] fixed index for horse_armor property and actually added it --- .../pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java | 7 ++++++- .../src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java index b011137..fddc533 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java @@ -307,7 +307,12 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry { // Use chesteplate property for 1.14 and above if (ver.isOlderThan(ServerVersion.V_1_14)) { - register(new EncodedIntegerProperty<>("horse_armor", HorseArmor.NONE, horseVariantIndex + 2, Enum::ordinal)); + int horseArmorIndex; + if (ver.isNewerThanOrEquals(ServerVersion.V_1_11)) horseArmorIndex = 16; + else if (ver.isNewerThanOrEquals(ServerVersion.V_1_10)) horseArmorIndex = 17; + else if (ver.isNewerThanOrEquals(ServerVersion.V_1_9)) horseArmorIndex = 16; + else horseArmorIndex = 22; + register(new EncodedIntegerProperty<>("horse_armor", HorseArmor.NONE, horseArmorIndex, Enum::ordinal)); } // Chested Horse diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java index 846e420..b8a00f6 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java @@ -132,6 +132,9 @@ public class NpcTypeImpl implements NpcType { if (EntityTypes.isTypeInstanceOf(type, EntityTypes.ABSTRACT_HORSE)) { addProperties("is_saddled", "is_eating", "is_rearing", "has_mouth_open"); } + if (type.equals(EntityTypes.HORSE) && version.isOlderThan(ServerVersion.V_1_14)) { + addProperties("horse_armor"); + } if (EntityTypes.isTypeInstanceOf(type, EntityTypes.CHESTED_HORSE)) { addProperties("has_chest"); } else if (version.isOlderThan(ServerVersion.V_1_11) && type.equals(EntityTypes.HORSE)) {