From ea404e3d82e2f547d772ffb11206dbc21ab21acd Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 16 Oct 2021 18:48:22 +1100 Subject: [PATCH] SPIGOT-6758: Reset ItemSign#openSign when aborting the block placement early By: blablubbabc --- .../net/minecraft/world/item/ItemStack.patch | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch b/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch index 6be9720f51..4ab296dfbd 100644 --- a/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch +++ b/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch @@ -103,7 +103,7 @@ EntityHuman entityhuman = itemactioncontext.getEntity(); BlockPosition blockposition = itemactioncontext.getClickPosition(); ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false); -@@ -202,12 +254,155 @@ +@@ -202,12 +254,157 @@ if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.b(itemactioncontext.getWorld().r(), shapedetectorblock)) { return EnumInteractionResult.PASS; } else { @@ -155,6 +155,7 @@ + } + } + ++ ItemSign.openSign = null; // SPIGOT-6758 - Reset on early return + return enuminteractionresult; + } + world.captureTreeGeneration = false; @@ -186,6 +187,7 @@ + for (EnumDirection dir : EnumDirection.values()) { + ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutBlockChange(world, placedPos.shift(dir))); + } ++ ItemSign.openSign = null; // SPIGOT-6758 - Reset on early return + } else { + // Change the stack to its new contents if it hasn't been tampered with. + if (this.getCount() == oldCount && Objects.equals(this.tag, oldData)) { @@ -260,7 +262,7 @@ return enuminteractionresult; } -@@ -288,6 +483,21 @@ +@@ -288,6 +485,21 @@ } i -= k; @@ -282,7 +284,7 @@ if (i <= 0) { return false; } -@@ -309,6 +519,11 @@ +@@ -309,6 +521,11 @@ if (this.isDamaged(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) { consumer.accept(t0); Item item = this.getItem(); @@ -294,7 +296,7 @@ this.subtract(1); if (t0 instanceof EntityHuman) { -@@ -464,6 +679,17 @@ +@@ -464,6 +681,17 @@ return this.tag; } @@ -312,7 +314,7 @@ public NBTTagCompound getOrCreateTag() { if (this.tag == null) { this.setTag(new NBTTagCompound()); -@@ -844,6 +1070,12 @@ +@@ -844,6 +1072,12 @@ } public void setRepairCost(int i) { @@ -325,7 +327,7 @@ this.getOrCreateTag().setInt("RepairCost", i); } -@@ -893,6 +1125,13 @@ +@@ -893,6 +1127,13 @@ nbttaglist.add(nbttagcompound); }