From c75e53935f1bf518d71bffcb5cd67647cf9e5c1a Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Mon, 31 Jan 2011 01:07:38 +0000 Subject: [PATCH] Renamed ItemStack.set/getDamage to durability, which is now a short --- .../java/org/bukkit/craftbukkit/CraftWorld.java | 2 +- .../craftbukkit/inventory/CraftInventory.java | 4 ++-- .../craftbukkit/inventory/CraftItemStack.java | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index a9c394f6d7..a0b324c8aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -125,7 +125,7 @@ public class CraftWorld implements World { net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), - item.getDamage() + item.getDurability() ); EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack); entity.c = 10; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index d7ad8a5021..d1ce551014 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -53,13 +53,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { if (item == null || item.getTypeId() <= 0) { mcItems[i] = null; } else { - mcItems[i] = new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDamage()); + mcItems[i] = new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability()); } } } public void setItem(int index, ItemStack item) { - getInventory().a(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDamage()))); + getInventory().a(index, (item == null ? null : new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), item.getDurability()))); } public boolean contains(int materialId) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index f08391c1c7..122ad08a82 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -10,7 +10,7 @@ public class CraftItemStack extends ItemStack { super( item != null ? item.id: 0, item != null ? item.count : 0, - (byte)(item != null ? item.damage : 0) + (short)(item != null ? item.damage : 0) ); this.item = item; } @@ -101,21 +101,21 @@ public class CraftItemStack extends ItemStack { } @Override - public void setDamage(final byte damage) { + public void setDurability(final short durability) { // Ignore damage if item is null if (item != null) { - super.setDamage(damage); - item.damage = damage; + super.setDurability(durability); + item.damage = durability; } } @Override - public byte getDamage() { + public short getDurability() { if (item != null) { - super.setDamage((byte) item.damage); // sync, needed? - return (byte) item.damage; + super.setDurability((short) item.damage); // sync, needed? + return (short) item.damage; } else { - return 0; + return -1; } }