diff options
Diffstat (limited to 'src/main/java/org')
3 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index f7ec1994..63ecd699 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -687,7 +687,7 @@ public class CraftWorld implements World { } else if (Egg.class.isAssignableFrom(clazz)) { entity = new EntityEgg(world, x, y, z); } else if (FallingSand.class.isAssignableFrom(clazz)) { - entity = new EntityFallingSand(world, x, y, z, 0); + entity = new EntityFallingSand(world, x, y, z, 0, 0); } else if (Fireball.class.isAssignableFrom(clazz)) { entity = new EntityFireball(world); ((EntityFireball) entity).setPositionRotation(x, y, z, yaw, pitch); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 439c671e..ae0c1f53 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -199,12 +199,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { public int firstPartial(ItemStack item) { ItemStack[] inventory = getContents(); + ItemStack filteredItem = new CraftItemStack(item); if (item == null) { return -1; } for (int i = 0; i < inventory.length; i++) { ItemStack cItem = inventory[i]; - if (cItem != null && cItem.getTypeId() == item.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == item.getDurability()) { + if (cItem != null && cItem.getTypeId() == filteredItem.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == filteredItem.getDurability()) { return i; } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 078c0b04..ebe28cac 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -10,11 +10,15 @@ public class CraftItemStack extends ItemStack { super( item != null ? item.id: 0, item != null ? item.count : 0, - (short)(item != null ? item.damage : 0) + (short)(item != null ? item.getData() : 0) ); this.item = item; } + public CraftItemStack(ItemStack item) { + this(item.getTypeId(), item.getAmount(), item.getDurability()); + } + /* 'Overwritten' constructors from ItemStack, yay for Java sucking */ public CraftItemStack(final int type) { this(type, 0); @@ -105,15 +109,15 @@ public class CraftItemStack extends ItemStack { // Ignore damage if item is null if (item != null) { super.setDurability(durability); - item.damage = durability; + item.b(durability); } } @Override public short getDurability() { if (item != null) { - super.setDurability((short) item.damage); // sync, needed? - return (short) item.damage; + super.setDurability((short) item.getData()); // sync, needed? + return (short) item.getData(); } else { return -1; } |