2023-04-23 16:13:23 +02:00
|
|
|
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/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
2024-05-10 01:36:04 +02:00
|
|
|
index b4e05ce176dfc6a2e66b294ed461c32020adf203..10429dfb6f2ec6aaffa7d71c4d32666ec6f65636 100644
|
2023-04-23 16:13:23 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
2024-05-10 01:36:04 +02:00
|
|
|
@@ -90,6 +90,11 @@ public class ImposterProtoChunk extends ProtoChunk {
|
2023-04-23 16:13:23 +02:00
|
|
|
@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);
|
|
|
|
}
|
|
|
|
|