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

View File

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