diff --git a/src/main/java/thedarkcolour/exdeorum/block/AbstractCrucibleBlock.java b/src/main/java/thedarkcolour/exdeorum/block/AbstractCrucibleBlock.java index 2e9775c1..a81a4655 100644 --- a/src/main/java/thedarkcolour/exdeorum/block/AbstractCrucibleBlock.java +++ b/src/main/java/thedarkcolour/exdeorum/block/AbstractCrucibleBlock.java @@ -19,6 +19,7 @@ package thedarkcolour.exdeorum.block; import net.minecraft.core.BlockPos; +import net.minecraft.core.SectionPos; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.BlockGetter; @@ -50,6 +51,16 @@ public abstract class AbstractCrucibleBlock extends ETankBlock { @Override public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { + // Only attempt to access the block entity if the chunk is already loaded. + // This prevents getExistingBlockEntity from triggering asynchronous chunk + // loading, which can cause the server to hang during shutdown. + if (level instanceof Level world) { + int chunkX = SectionPos.blockToSectionCoord(pos.getX()); + int chunkZ = SectionPos.blockToSectionCoord(pos.getZ()); + if (!world.hasChunk(chunkX, chunkZ)) { + return 0; + } + } if (level.getExistingBlockEntity(pos) instanceof AbstractCrucibleBlockEntity crucible) { return crucible.getTank().getFluid().getFluid().getFluidType().getLightLevel(); }