From 643f2b1c8533cea90e60279020e9fd9d5921a9c5 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 8 Nov 2013 06:37:36 +1300 Subject: [PATCH] Changed enderman watcher to override held get/set and deprecated the rest --- .../disguisetypes/watchers/DroppedItemWatcher.java | 2 -- .../disguisetypes/watchers/EndermanWatcher.java | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.java index 3add2ee7..0b0fbe02 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/DroppedItemWatcher.java @@ -6,8 +6,6 @@ import me.libraryaddict.disguise.disguisetypes.FlagWatcher; import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; - - public class DroppedItemWatcher extends FlagWatcher { public DroppedItemWatcher(Disguise disguise) { diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java index ef3fb899..80e46fe9 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/EndermanWatcher.java @@ -10,14 +10,21 @@ public class EndermanWatcher extends LivingWatcher { super(disguise); } + @Deprecated public int getCarriedData() { return ((Byte) getValue(17, (byte) 0)); } + @Deprecated public int getCarriedId() { return ((Byte) getValue(16, (byte) 0)); } + @Override + public ItemStack getHeldItem() { + return new ItemStack((Byte) getValue(16, (byte) 0), 1, ((Byte) getValue(17, (byte) 0))); + } + public boolean isAgressive() { return (Integer) getValue(18, (byte) 0) == 1; } @@ -35,9 +42,16 @@ public class EndermanWatcher extends LivingWatcher { sendData(17); } + @Deprecated public void setCarriedItem(ItemStack itemstack) { setValue(16, (byte) (itemstack.getTypeId() & 255)); setValue(17, (byte) (itemstack.getDurability() & 255)); } + @Override + public void setHeldItem(ItemStack itemstack) { + setValue(16, (byte) (itemstack.getTypeId() & 255)); + setValue(17, (byte) (itemstack.getDurability() & 255)); + } + }