2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-07-16 20:08:09 +00:00
|
|
|
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
|
|
|
|
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java b/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java
|
|
|
|
index d51f89fed6129c4b37ef63971f8f61dc14e8032d..efa98e87eead036246348f3915b401f0f52f2242 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java
|
|
|
|
@@ -29,7 +29,12 @@ public class DoubleBlockFinder {
|
2020-01-10 03:11:19 +00:00
|
|
|
return new DoubleBlockFinder.Result.Single<>(s0);
|
2018-07-16 20:08:09 +00:00
|
|
|
} else {
|
2020-01-10 03:11:19 +00:00
|
|
|
BlockPosition blockposition1 = blockposition.shift((EnumDirection) function1.apply(iblockdata));
|
2019-04-27 06:26:04 +00:00
|
|
|
- IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
|
2020-06-25 23:38:24 +00:00
|
|
|
+ // Paper start
|
2019-04-27 06:26:04 +00:00
|
|
|
+ IBlockData iblockdata1 = generatoraccess.getTypeIfLoaded(blockposition1);
|
|
|
|
+ if (iblockdata1 == null) {
|
2020-01-10 03:11:19 +00:00
|
|
|
+ return new DoubleBlockFinder.Result.Single<>(s0);
|
2018-07-16 20:08:09 +00:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2020-01-10 03:11:19 +00:00
|
|
|
|
2020-06-25 23:38:24 +00:00
|
|
|
if (iblockdata1.a(iblockdata.getBlock())) {
|
|
|
|
DoubleBlockFinder.BlockType doubleblockfinder_blocktype1 = (DoubleBlockFinder.BlockType) function.apply(iblockdata1);
|