summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Ardill <andrew.ardill@gmail.com>2011-12-13 01:44:15 +1100
committerAndrew Ardill <andrew.ardill@gmail.com>2011-12-13 01:45:58 +1100
commitd34e2894347f780ed6f27f745a88688000dc3615 (patch)
treebdc23f5d4263d382c491d06b1df9f8cf0d963f70 /src
parent14754c71a236525e0e9af76c17627ba40eadce0b (diff)
downloadcraftbukkit-d34e2894347f780ed6f27f745a88688000dc3615.tar
craftbukkit-d34e2894347f780ed6f27f745a88688000dc3615.tar.gz
craftbukkit-d34e2894347f780ed6f27f745a88688000dc3615.tar.lz
craftbukkit-d34e2894347f780ed6f27f745a88688000dc3615.tar.xz
craftbukkit-d34e2894347f780ed6f27f745a88688000dc3615.zip
Teach nms ItemStack constructor how to take enchantments
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/ItemStack.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 9c88f416..b19f5b08 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -39,6 +39,18 @@ public final class ItemStack {
this.setData(k); // CraftBukkit
}
+ // CraftBukkit - used to create a new ItemStack, specifying the enchantments at time of creation.
+ public ItemStack(int id, int count, int data, NBTTagList enchantments) {
+ this(id, count, data);
+ // taken from .addEnchantment
+ if (this.tag == null) {
+ this.setTag(new NBTTagCompound());
+ }
+
+ this.tag.set("ench", enchantments); // modify this part to use passed in enchantments list
+ }
+ // CraftBukkit end
+
public static ItemStack a(NBTTagCompound nbttagcompound) {
ItemStack itemstack = new ItemStack();