Fixed itemframes. Tho they are still stupid

This commit is contained in:
Andrew 2013-11-06 21:54:01 +13:00
parent 331d254641
commit b47d5e8b5f
2 changed files with 14 additions and 11 deletions

View File

@ -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 ItemFrameWatcher extends FlagWatcher {
public ItemFrameWatcher(Disguise disguise) {
@ -15,17 +13,24 @@ public class ItemFrameWatcher extends FlagWatcher {
}
public ItemStack getItemStack() {
if (getValue(3, (byte) 0) instanceof Integer)
if (getValue(2, null) == null)
return new ItemStack(0);
return CraftItemStack.asBukkitCopy((net.minecraft.server.v1_6_R3.ItemStack) getValue(3, null));
return CraftItemStack.asBukkitCopy((net.minecraft.server.v1_6_R3.ItemStack) getValue(2, null));
}
public void setItemStack(ItemStack newItem) {
if (newItem.getTypeId() == 0)
setValue(3, (byte) 0);
else {
setValue(3, CraftItemStack.asCraftCopy(newItem));
}
newItem = newItem.clone();
newItem.setAmount(1);
setValue(2, CraftItemStack.asNMSCopy(newItem));
sendData(2);
}
public int getItemRotation() {
return (Integer) getValue(3, 0);
}
public void setItemRotation(int rotation) {
setValue(3, (byte) (rotation % 4));
sendData(3);
}

View File

@ -4,8 +4,6 @@ import java.util.Random;
import me.libraryaddict.disguise.disguisetypes.Disguise;
public class SlimeWatcher extends LivingWatcher {
public SlimeWatcher(Disguise disguise) {