From ceb10171c9f3c6807230259d90e09010161a58fa Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 16 Sep 2019 14:30:16 +1200 Subject: [PATCH] Fixes zombie villager disguise, fixed #391 --- .../disguisetypes/watchers/ZombieVillagerWatcher.java | 6 +++--- .../libraryaddict/disguise/utilities/DisguiseUtilities.java | 6 +++--- .../disguise/utilities/reflection/ReflectionManager.java | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ZombieVillagerWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ZombieVillagerWatcher.java index f47eb9ef..31310067 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ZombieVillagerWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/ZombieVillagerWatcher.java @@ -35,12 +35,12 @@ public class ZombieVillagerWatcher extends ZombieWatcher { } public VillagerData getVillagerData() { - return getData(MetaIndex.VILLAGER_DATA); + return getData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION); } public void setVillagerData(VillagerData villagerData) { - setData(MetaIndex.VILLAGER_DATA, villagerData); - sendData(MetaIndex.VILLAGER_DATA); + setData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION, villagerData); + sendData(MetaIndex.ZOMBIE_VILLAGER_PROFESSION); } public Profession getProfession() { diff --git a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 2e9831cf..1236b6fe 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -1132,7 +1132,6 @@ public class DisguiseUtilities { return; } - try { if (selfDisguised.contains(disguise.getEntity().getUniqueId()) && disguise.isDisguiseInUse()) { removeSelfDisguise((Player) disguise.getEntity()); @@ -1791,9 +1790,10 @@ public class DisguiseUtilities { if (watchableObject.getValue() == null) continue; + MetaIndex metaIndex = MetaIndex.getMetaIndex(disguiseWatcher, watchableObject.getIndex()); + WrappedDataWatcher.WrappedDataWatcherObject obj = ReflectionManager - .createDataWatcherObject(MetaIndex.getMetaIndex(disguiseWatcher, watchableObject.getIndex()), - watchableObject.getValue()); + .createDataWatcherObject(metaIndex, watchableObject.getValue()); newWatcher.setObject(obj, watchableObject.getValue()); } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java index 9d2018e8..ec932dea 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java @@ -1004,8 +1004,6 @@ public class ReflectionManager { if (value == null) return null; - value = convertInvalidMeta(value); - return new WrappedDataWatcherObject(index.getIndex(), index.getSerializer()); }