From 613be0d8418c044807040bb4c9b72ae4c118f5cd Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 2 Jan 2017 16:13:25 +1100 Subject: SPIGOT-2980: Improve SpawnEgg NBT application and ItemStack conversion. --- nms-patches/ItemStack.patch | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'nms-patches') 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); } -- cgit v1.2.3