diff options
author | md_5 <git@md-5.net> | 2017-01-02 16:13:25 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-01-02 16:13:25 +1100 |
commit | 613be0d8418c044807040bb4c9b72ae4c118f5cd (patch) | |
tree | ecc60f541aa6569b64b4958f131be51b10b0b1d2 /nms-patches/ItemStack.patch | |
parent | a6d8fa2eac1d7a51c70229f84edea9ea90ba4fd0 (diff) | |
download | craftbukkit-613be0d8418c044807040bb4c9b72ae4c118f5cd.tar craftbukkit-613be0d8418c044807040bb4c9b72ae4c118f5cd.tar.gz craftbukkit-613be0d8418c044807040bb4c9b72ae4c118f5cd.tar.lz craftbukkit-613be0d8418c044807040bb4c9b72ae4c118f5cd.tar.xz craftbukkit-613be0d8418c044807040bb4c9b72ae4c118f5cd.zip |
SPIGOT-2980: Improve SpawnEgg NBT application and ItemStack conversion.
Diffstat (limited to 'nms-patches/ItemStack.patch')
-rw-r--r-- | nms-patches/ItemStack.patch | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index 6e539e71..0d778c71 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -20,7 +20,17 @@ public final class ItemStack { public static final ItemStack a = new ItemStack((Item) null); -@@ -46,28 +59,56 @@ +@@ -42,32 +55,68 @@ + this(item, i, 0); + } + ++ // CraftBukkit start + public ItemStack(Item item, int i, int j) { ++ this(item, i, j, true); ++ } ++ ++ public ItemStack(Item item, int i, int j, boolean convert) { ++ // CraftBukkit end this.item = item; this.damage = j; this.count = i; @@ -28,7 +38,9 @@ + if (MinecraftServer.getServer() != null) { + this.setData(j); + } -+ this.convertStack(); ++ if (convert) { ++ this.convertStack(); ++ } + // CraftBukkit end if (this.damage < 0) { - this.damage = 0; @@ -82,7 +94,7 @@ this.F(); } -@@ -94,11 +135,138 @@ +@@ -94,11 +143,138 @@ } public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { @@ -222,7 +234,7 @@ return enuminteractionresult; } -@@ -122,7 +290,7 @@ +@@ -122,7 +298,7 @@ nbttagcompound.setByte("Count", (byte) this.count); nbttagcompound.setShort("Damage", (short) this.damage); if (this.tag != null) { @@ -231,7 +243,7 @@ } return nbttagcompound; -@@ -157,11 +325,30 @@ +@@ -157,11 +333,30 @@ } public void setData(int i) { @@ -264,7 +276,7 @@ } public int k() { -@@ -198,6 +385,11 @@ +@@ -198,6 +393,11 @@ if (this.f()) { if (this.isDamaged(i, entityliving.getRandom())) { entityliving.b(this); @@ -276,7 +288,16 @@ this.subtract(1); if (entityliving instanceof EntityHuman) { EntityHuman entityhuman = (EntityHuman) entityliving; -@@ -509,6 +701,12 @@ +@@ -239,7 +439,7 @@ + } + + public ItemStack cloneItemStack() { +- ItemStack itemstack = new ItemStack(this.item, this.count, this.damage); ++ ItemStack itemstack = new ItemStack(this.item, this.count, this.damage, false); // CraftBukkit + + if (this.tag != null) { + itemstack.tag = this.tag.g(); +@@ -509,6 +709,12 @@ nbttaglist.add(nbttagcompound); } |