summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/BlockDispenser.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityCow.java6
-rw-r--r--src/main/java/net/minecraft/server/ItemBucket.java23
-rw-r--r--src/main/java/net/minecraft/server/TileEntityFurnace.java4
4 files changed, 10 insertions, 29 deletions
diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java
index 4b7f8a3e..39833823 100644
--- a/src/main/java/net/minecraft/server/BlockDispenser.java
+++ b/src/main/java/net/minecraft/server/BlockDispenser.java
@@ -102,7 +102,7 @@ public class BlockDispenser extends BlockContainer {
itemstack = tileentitydispenser.getContents()[dispenseSlot];
// Copy item stack, because we want it to have 1 item
- itemstack = new ItemStack(itemstack.id, 1, itemstack.getData());
+ itemstack = new ItemStack(itemstack.id, 1, itemstack.getData(), itemstack.getEnchantments());
}
// CraftBukkit end
@@ -139,7 +139,7 @@ public class BlockDispenser extends BlockContainer {
motY = event.getVelocity().getY();
motZ = event.getVelocity().getZ();
- itemstack = new ItemStack(event.getItem().getTypeId(), event.getItem().getAmount(), event.getItem().getDurability());
+ itemstack = CraftItemStack.createNMSItemStack(event.getItem());
// CraftBukkit end
if (itemstack.id == Item.ARROW.id) {
@@ -244,7 +244,7 @@ public class BlockDispenser extends BlockContainer {
}
itemstack.count -= i1;
- EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData()));
+ EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData(), itemstack.getEnchantments())); // CraftBukkit - make sure enchantments are copied over
float f3 = 0.05F;
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index ecbf4fd5..9700fe86 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -80,11 +80,7 @@ public class EntityCow extends EntityAnimal {
return false;
}
- CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
- byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
- itemstack = new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data);
-
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, itemstack);
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, CraftItemStack.createNMSItemStack(event.getItemStack()));
// CraftBukkit end
return true;
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java
index 2eb6104d..4b6a2422 100644
--- a/src/main/java/net/minecraft/server/ItemBucket.java
+++ b/src/main/java/net/minecraft/server/ItemBucket.java
@@ -54,13 +54,10 @@ public class ItemBucket extends Item {
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}
-
- CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
- byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
// CraftBukkit end
world.setTypeId(i, j, k, 0);
- return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data); // CraftBukkit
+ return CraftItemStack.createNMSItemStack(event.getItemStack()); // CraftBukkit
}
if (world.getMaterial(i, j, k) == Material.LAVA && world.getData(i, j, k) == 0) {
@@ -74,13 +71,10 @@ public class ItemBucket extends Item {
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}
-
- CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
- byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
// CraftBukkit end
world.setTypeId(i, j, k, 0);
- return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data); // CraftBukkit
+ return CraftItemStack.createNMSItemStack(event.getItemStack()); // CraftBukkit
}
} else {
if (this.a < 0) {
@@ -91,9 +85,7 @@ public class ItemBucket extends Item {
return itemstack;
}
- CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
- byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
- return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data);
+ return CraftItemStack.createNMSItemStack(event.getItemStack());
}
int clickedX = i, clickedY = j, clickedZ = k;
@@ -151,10 +143,7 @@ public class ItemBucket extends Item {
}
// CraftBukkit start
- CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
- byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
-
- return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data);
+ return CraftItemStack.createNMSItemStack(event.getItemStack());
// CraftBukkit end
}
}
@@ -167,9 +156,7 @@ public class ItemBucket extends Item {
return itemstack;
}
- CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
- byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
- return new ItemStack(itemInHand.getTypeId(), itemInHand.getAmount(), data);
+ return CraftItemStack.createNMSItemStack(event.getItemStack());
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index f8a7c6fb..1de57c59 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -211,9 +211,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
return;
}
- org.bukkit.inventory.ItemStack oldResult = furnaceSmeltEvent.getResult();
- ItemStack newResult = new ItemStack(oldResult.getTypeId(), oldResult.getAmount(), oldResult.getDurability());
- itemstack = newResult;
+ itemstack = CraftItemStack.createNMSItemStack(furnaceSmeltEvent.getResult());
if (this.items[2] == null) {
this.items[2] = itemstack.cloneItemStack();