25 lines
1.2 KiB
Diff
25 lines
1.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
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/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
|
index d1331b580b3d27c77244b22a4ad15e719f686c8f..b430bb3c1bca935312bf6183b9f502c683b27c1f 100644
|
|
--- a/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
|
+++ b/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
|
@@ -91,6 +91,11 @@ public class ImposterProtoChunk extends ProtoChunk implements ca.spottedleaf.moo
|
|
@Nullable
|
|
@Override
|
|
public BlockEntity getBlockEntity(BlockPos pos) {
|
|
+ // Folia start - block reading possibly in-world block data for worldgen threads
|
|
+ if (!this.allowWrites && !ca.spottedleaf.moonrise.common.util.TickThread.isTickThread()) {
|
|
+ return null;
|
|
+ }
|
|
+ // Folia end - block reading possibly in-world block data for worldgen threads
|
|
return this.wrapped.getBlockEntity(pos);
|
|
}
|
|
|