diff --git a/nms-patches/World.patch b/nms-patches/World.patch index 481df1e926..a0fe2c98ce 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -334,15 +334,21 @@ } } } -@@ -604,6 +816,7 @@ - } - } +@@ -606,12 +818,26 @@ -+ public Map capturedTileEntities = Maps.newHashMap(); @Nullable @Override ++ // CraftBukkit start public TileEntity getTileEntity(BlockPosition blockposition) { -@@ -612,6 +825,12 @@ ++ return getTileEntity(blockposition, true); ++ } ++ public Map capturedTileEntities = Maps.newHashMap(); ++ ++ @Nullable ++ protected TileEntity getTileEntity(BlockPosition blockposition, boolean validate) { ++ // CraftBukkit end + if (isOutsideWorld(blockposition)) { + return null; } else if (!this.isClientSide && Thread.currentThread() != this.serverThread) { return null; } else { @@ -355,7 +361,7 @@ TileEntity tileentity = null; if (this.tickingTileEntities) { -@@ -646,6 +865,13 @@ +@@ -646,6 +872,13 @@ public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { if (!isOutsideWorld(blockposition)) { if (tileentity != null && !tileentity.isRemoved()) { @@ -369,3 +375,12 @@ if (this.tickingTileEntities) { tileentity.setLocation(this, blockposition); Iterator iterator = this.tileEntityListPending.iterator(); +@@ -670,7 +903,7 @@ + } + + public void removeTileEntity(BlockPosition blockposition) { +- TileEntity tileentity = this.getTileEntity(blockposition); ++ TileEntity tileentity = this.getTileEntity(blockposition, false); // CraftBukkit + + if (tileentity != null && this.tickingTileEntities) { + tileentity.ab_(); diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index 828421181a..8334d76e04 100644 --- a/nms-patches/WorldServer.patch +++ b/nms-patches/WorldServer.patch @@ -62,9 +62,9 @@ + + // CraftBukkit start + @Override -+ public TileEntity getTileEntity(BlockPosition pos) { -+ TileEntity result = super.getTileEntity(pos); -+ if (Thread.currentThread() != this.serverThread) { ++ protected TileEntity getTileEntity(BlockPosition pos, boolean validate) { ++ TileEntity result = super.getTileEntity(pos, validate); ++ if (!validate || Thread.currentThread() != this.serverThread) { + // SPIGOT-5378: avoid deadlock, this can be called in loading logic (i.e lighting) but getType() will block on chunk load + return result; + }