Paper/Spigot-Server-Patches/0144-Don-t-load-Chunks-from-Hoppers-and-other-things.patch
Aikar 05466e3b47
[Auto] Update Upstream
Upstream has released updates that appear to apply compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing.

Bukkit Changes:
d2834556 SPIGOT-4219: Event for PigZombies angering.

CraftBukkit Changes:
a9c796f1 SPIGOT-4184: Fix furnaces not matching Vanilla smelt or animations
195f071e SPIGOT-4219: Event for PigZombies angering.
5e3082c7 SPIGOT-4230: Improve legacy block types
2018-08-05 19:46:43 -04:00

36 lines
1.7 KiB
Diff

From 9047a61c9f88a72ba5b3eb8757040b86c1be3951 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 1ad39aca3b..7262c2b19f 100644
--- a/src/main/java/net/minecraft/server/BlockChest.java
+++ b/src/main/java/net/minecraft/server/BlockChest.java
@@ -196,7 +196,12 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC
return (ITileInventory) object;
} else {
BlockPosition blockposition1 = blockposition.shift(k(iblockdata));
- IBlockData iblockdata1 = world.getType(blockposition1);
+ // Paper start - don't load chunks if the other side of the chest is in unloaded chunk
+ final IBlockData iblockdata1 = world.getTypeIfLoaded(blockposition1); // Paper
+ if (iblockdata1 == null) {
+ return null;
+ }
+ // Paper end
if (iblockdata1.getBlock() == this) {
BlockPropertyChestType blockpropertychesttype1 = (BlockPropertyChestType) iblockdata1.get(BlockChest.b);
--
2.18.0