From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sun, 23 Apr 2023 07:08:26 -0700 Subject: [PATCH] Block reading in-world tile entities on worldgen threads The returned TE may be in the world, in which case it is unsafe for the current thread to modify or access its contents. diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java index 6359d2d80f4c1360f8450bf6555ccfea3b69daa5..0d5797cbc0c054d64e54accbe3285854752be267 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java @@ -92,6 +92,11 @@ public class ImposterProtoChunk extends ProtoChunk { @Nullable @Override public BlockEntity getBlockEntity(BlockPos pos) { + // Folia start - block reading possibly in-world block data for worldgen threads + if (!this.allowWrites && !io.papermc.paper.util.TickThread.isTickThread()) { + return null; + } + // Folia end - block reading possibly in-world block data for worldgen threads return this.wrapped.getBlockEntity(pos); }