PaperMC/Spigot-Server-Patches/0395-Don-t-load-Chunks-from-Hoppers-and-other-things.patch
Mariell Hoversholm 654b792caf Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
a339310c #755: Fix NPE when calling getInventory() for virtual EnderChests
2577f9bf Increase outdated build delay
1dabfdc8 #754: Fix pre-1.16 serialized SkullMeta being broken on 1.16+, losing textures
2020-09-27 11:04:51 -04:00

32 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 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/DoubleBlockFinder.java b/src/main/java/net/minecraft/server/DoubleBlockFinder.java
index ac46a68f7b0f13b9d936ae872306a229ec4f1a61..89b2b11bf00b656bb23be855b25697e6ac93a0a2 100644
--- a/src/main/java/net/minecraft/server/DoubleBlockFinder.java
+++ b/src/main/java/net/minecraft/server/DoubleBlockFinder.java
@@ -21,7 +21,12 @@ public class DoubleBlockFinder {
return new DoubleBlockFinder.Result.Single<>(s0);
} else {
BlockPosition blockposition1 = blockposition.shift((EnumDirection) function1.apply(iblockdata));
- IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
+ // Paper start
+ IBlockData iblockdata1 = generatoraccess.getTypeIfLoaded(blockposition1);
+ if (iblockdata1 == null) {
+ return new DoubleBlockFinder.Result.Single<>(s0);
+ }
+ // Paper end
if (iblockdata1.a(iblockdata.getBlock())) {
DoubleBlockFinder.BlockType doubleblockfinder_blocktype1 = (DoubleBlockFinder.BlockType) function.apply(iblockdata1);