mirror of
https://github.com/PaperMC/Folia.git
synced 2025-01-30 22:51:21 +01:00
25 lines
1.3 KiB
Diff
25 lines
1.3 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/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
|
index 1eb8022f3e31603322e6c56516304afc9a11bbec..87ddae289972b8e0dd0b48a07e23c627b598bae3 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
|
|
+++ b/src/main/java/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);
|
|
}
|
|
|