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 c3906cf..08ede74 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java @@ -102,14 +102,6 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry { // Guardian registerType("is_elder", false); // TODO: ensure it only works till 1.10. Note: index is wrong on wiki.vg - // Shulker - registerType("attach_direction", null); // TODO: make a direction enum - registerType("shield_height", 0); // TODO: figure this out - registerType("shulker_color", DyeColor.RED); // TODO - - // Wither - registerType("invulnerable_time", 0); // TODO - */ } @@ -366,6 +358,17 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry { linkProperties("wolf_angry", "tamed", "sitting"); } + // Wither + int witherIndex; + if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) witherIndex = 16; // using the first index, so we can add the other properties later if needed + else if (ver.isNewerThanOrEquals(ServerVersion.V_1_15)) witherIndex = 15; + else if (ver.isNewerThanOrEquals(ServerVersion.V_1_14)) witherIndex = 14; + else if (ver.isNewerThanOrEquals(ServerVersion.V_1_10)) witherIndex = 12; + else if (ver.isNewerThanOrEquals(ServerVersion.V_1_9)) witherIndex = 11; + else witherIndex = 17; + witherIndex += 3; // skip the first 3 indexes, will be used for the other properties later + register(new IntegerProperty("invulnerable_time", witherIndex++, 0, false)); + if (!ver.isNewerThanOrEquals(ServerVersion.V_1_9)) return; // Shulker int shulkerIndex; diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeRegistryImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeRegistryImpl.java index 3780ed0..4a8f77b 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeRegistryImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeRegistryImpl.java @@ -153,7 +153,8 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry { .addProperties("hand")); register(builder(p, "wither", EntityTypes.WITHER) - .setHologramOffset(1.525)); + .setHologramOffset(1.525) + .addProperties("invulnerable_time")); register(builder(p, "wolf", EntityTypes.WOLF) .setHologramOffset(-1.125)