Paper/Spigot-Server-Patches/0124-Don-t-load-Chunks-from-Hoppers-and-other-things.patch
Shane Freeder 6048122e23
Revert "Optimize Pathfinding"
This patch appears to be causing some issues with 1.14.3 entity AI
2019-06-25 20:18:50 +01:00

36 lines
1.7 KiB
Diff

From b69e373bb7de1abeaae748b3ae900241fddd39f1 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 65b616481e..8183a61c9d 100644
--- a/src/main/java/net/minecraft/server/BlockChest.java
+++ b/src/main/java/net/minecraft/server/BlockChest.java
@@ -227,7 +227,12 @@ public class BlockChest extends BlockTileEntity implements IBlockWaterlogged {
return blockchest_chestfinder.b(tileentitychest);
} else {
BlockPosition blockposition1 = blockposition.shift(j(iblockdata));
- IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
+ // Paper start - don't load chunks if the other side of the chest is in unloaded chunk
+ IBlockData iblockdata1 = generatoraccess.getTypeIfLoaded(blockposition1);
+ if (iblockdata1 == null) {
+ return null;
+ }
+ // Paper end
if (iblockdata1.getBlock() == iblockdata.getBlock()) {
BlockPropertyChestType blockpropertychesttype1 = (BlockPropertyChestType) iblockdata1.get(BlockChest.b);
--
2.22.0