From f4a4efce0624890563e8eba7d69a556b67ffa232 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sat, 27 Nov 2021 08:32:02 +0100 Subject: [PATCH] Fix quarry ghost chunkloading when only the edges of a quarry are loaded. --- common/buildcraft/builders/TileQuarry.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/common/buildcraft/builders/TileQuarry.java b/common/buildcraft/builders/TileQuarry.java index 2f2b50fa..afd5c603 100644 --- a/common/buildcraft/builders/TileQuarry.java +++ b/common/buildcraft/builders/TileQuarry.java @@ -152,16 +152,18 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI } public boolean areChunksLoaded() { - if (BuildCraftBuilders.quarryLoadsChunks) { - // Small optimization - return true; + if (!BuildCraftBuilders.quarryLoadsChunks) { + // Each chunk covers the full height, so we only check one of them per height. + for (int chunkX = box.xMin >> 4; chunkX <= box.xMax >> 4; chunkX++) { + for (int chunkZ = box.zMin >> 4; chunkZ <= box.zMax >> 4; chunkZ++) { + if (!worldObj.blockExists(chunkX << 4, box.yMax, chunkZ << 4)) { + return false; + } + } + } } - // Each chunk covers the full height, so we only check one of them per height. - return worldObj.blockExists(box.xMin, box.yMax, box.zMin) - && worldObj.blockExists(box.xMax, box.yMax, box.zMin) - && worldObj.blockExists(box.xMin, box.yMax, box.zMax) - && worldObj.blockExists(box.xMax, box.yMax, box.zMax); + return true; } @Override