aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAikar <[email protected]>2016-11-04 01:32:53 -0400
committerAikar <[email protected]>2016-11-04 01:32:53 -0400
commit4f5d91198f2be3f5a1ea35f4208f4de5af3a3020 (patch)
tree54e5e8aa7960a2c36948d9345794bfbf1232055b
parent3725f9d940f2284176132511819622751d3a73f9 (diff)
downloadPaper-4f5d91198f2be3f5a1ea35f4208f4de5af3a3020.tar.gz
Paper-4f5d91198f2be3f5a1ea35f4208f4de5af3a3020.zip
Prevent Hoppers from loading chunks by double chest
-rw-r--r--Spigot-Server-Patches/0179-Don-t-load-Chunks-from-Hoppers-and-other-things.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0179-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/Spigot-Server-Patches/0179-Don-t-load-Chunks-from-Hoppers-and-other-things.patch
new file mode 100644
index 0000000000..4d4c680d7d
--- /dev/null
+++ b/Spigot-Server-Patches/0179-Don-t-load-Chunks-from-Hoppers-and-other-things.patch
@@ -0,0 +1,36 @@
+From ee5f4518088b9d58be983ccbcd6bf6e7309ff967 Mon Sep 17 00:00:00 2001
+From: Aikar <[email protected]>
+Date: Thu, 3 Nov 2016 20:28:12 -0400
+Subject: [PATCH] Don't load Chunks from Hoppers and other things
+
+Hoppers call this to I guess "get the primary side" of a double sided chest.
+
+If the double sided chest crosses chunk lines, it causes the chunk to load.
+This will end up causing sync chunk loads, which will unload with Chunk GC,
+only to be reloaded again the next tick.
+
+This of course is undesirable, so just return the loaded side as "primary"
+and treat it as a single chest if the other sides are unloaded
+
+diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java
+index a5f2fc0..71239cd 100644
+--- a/src/main/java/net/minecraft/server/BlockChest.java
++++ b/src/main/java/net/minecraft/server/BlockChest.java
+@@ -339,7 +339,13 @@ public class BlockChest extends BlockTileEntity {
+ while (iterator.hasNext()) {
+ EnumDirection enumdirection = (EnumDirection) iterator.next();
+ BlockPosition blockposition1 = blockposition.shift(enumdirection);
+- Block block = world.getType(blockposition1).getBlock();
++ // Paper start - don't load chunks if the other side of the chest is in unloaded chunk
++ final IBlockData type = world.getTypeIfLoaded(blockposition1); // Paper
++ if (type == null) {
++ continue;
++ }
++ Block block = type.getBlock();
++ // Paper end
+
+ if (block == this) {
+ if (this.e(world, blockposition1)) {
+--
+2.10.2
+