aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorShane Freeder <[email protected]>2019-04-17 00:53:55 +0100
committerShane Freeder <[email protected]>2019-04-17 00:53:55 +0100
commit90d8377b5962b729483f3f720de3661cb4abf8f9 (patch)
treecb346a2547abc353236f5cc095937953683f0b92
parent9c79f489ed6d273a262199c615d4f5449a393248 (diff)
downloadPaper-90d8377b5962b729483f3f720de3661cb4abf8f9.tar.gz
Paper-90d8377b5962b729483f3f720de3661cb4abf8f9.zip
Fix NPE from sign placement (Closes #1963) (Fixes #1917)
This fixes issues with upstreams changes to solve a private issue on their side, as signs are placed, they may replace existing blocks, e.g. grass, which breaks upstreams assumption that the sign is always placed adjacent to a surface
-rw-r--r--Spigot-Server-Patches/0439-Fix-NPE-from-sign-placement.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0439-Fix-NPE-from-sign-placement.patch b/Spigot-Server-Patches/0439-Fix-NPE-from-sign-placement.patch
new file mode 100644
index 0000000000..4f85103c0e
--- /dev/null
+++ b/Spigot-Server-Patches/0439-Fix-NPE-from-sign-placement.patch
@@ -0,0 +1,55 @@
+From 89feaae0a193a0443bfe41f2306ac1819e93f7b2 Mon Sep 17 00:00:00 2001
+From: Shane Freeder <[email protected]>
+Date: Wed, 17 Apr 2019 00:48:59 +0100
+Subject: [PATCH] Fix NPE from sign placement
+
+This fixes issues with upstreams changes to solve a private issue on
+their side, as signs are placed, they may replace existing blocks, e.g.
+grass, which breaks upstreams assumption that the sign is always placed
+adjacent to a surface
+
+diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
+index f5d9b4abc2..fdbe9a2adc 100644
+--- a/src/main/java/net/minecraft/server/EntityHuman.java
++++ b/src/main/java/net/minecraft/server/EntityHuman.java
+@@ -70,6 +70,7 @@ public abstract class EntityHuman extends EntityLiving {
+ public EntityFishingHook hookedFish;
+ // Paper start
+ public boolean affectsSpawning = true;
++ public BlockPosition openingSign = null; // Paper - fix NPE when opening signs
+ // Paper end
+ // Paper start - Player view distance API
+ private int viewDistance = -1;
+diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java
+index 11045ee1e1..7808aed0c0 100644
+--- a/src/main/java/net/minecraft/server/ItemSign.java
++++ b/src/main/java/net/minecraft/server/ItemSign.java
+@@ -16,6 +16,7 @@ public class ItemSign extends ItemBlockWallable {
+ if (!world.isClientSide && !flag && entityhuman != null) {
+ // CraftBukkit start - SPIGOT-4678
+ // entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
++ entityhuman.openingSign = blockposition; // Paper - fix NPE when opening signs
+ ItemSign.openSign = true;
+ // CraftBukkit end
+ }
+diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
+index eb130c0121..993de2bded 100644
+--- a/src/main/java/net/minecraft/server/ItemStack.java
++++ b/src/main/java/net/minecraft/server/ItemStack.java
+@@ -305,7 +305,12 @@ public final class ItemStack {
+ // SPIGOT-4678
+ if (this.item instanceof ItemSign && ItemSign.openSign) {
+ ItemSign.openSign = false;
+- entityhuman.openSign((TileEntitySign) world.getTileEntity(new BlockActionContext(itemactioncontext).getClickPosition()));
++ // Paper start - fix NPE when opening signs
++ if (entityhuman.openingSign != null) {
++ entityhuman.openSign((TileEntitySign) world.getTileEntity(entityhuman.openingSign));
++ entityhuman.openingSign = null;
++ }
++ // Paper end
+ }
+
+ // SPIGOT-1288 - play sound stripped from ItemBlock
+--
+2.21.0
+