mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-24 01:19:25 +00:00
68 lines
3.6 KiB
Diff
68 lines
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: wangxyper <wangxyper@163.com>
|
|
Date: Fri, 13 Jan 2023 09:35:26 +0800
|
|
Subject: [PATCH] Hearse: Fix a concurrent problem
|
|
|
|
Original license: MIT
|
|
Original project: https://github.com/NaturalCodeClub/HearseRewrite
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
|
index 78bd56f150543d2e38cf1606b133d682194424d2..122699937606f5e00e356f5c1ea12db0563508a3 100644
|
|
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
|
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
|
@@ -2,7 +2,6 @@ package io.papermc.paper.world;
|
|
|
|
import com.destroystokyo.paper.util.maplist.EntityList;
|
|
import io.papermc.paper.chunk.system.entity.EntityLookup;
|
|
-import io.papermc.paper.util.TickThread;
|
|
import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
|
|
import it.unimi.dsi.fastutil.objects.Reference2ObjectMaps;
|
|
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
|
|
@@ -21,7 +20,6 @@ import net.minecraft.world.phys.AABB;
|
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
-import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.concurrent.locks.StampedLock;
|
|
import java.util.function.Predicate;
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
index e254b2d04e4fc1dc76c26f61ea38aeb27755143f..948abd93c64a5b3679f3552945d7a9a2edaf7c3f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
@@ -17,6 +17,9 @@ import java.util.function.Function;
|
|
import java.util.function.Supplier;
|
|
import java.util.stream.Stream;
|
|
import javax.annotation.Nullable;
|
|
+
|
|
+import it.unimi.dsi.fastutil.shorts.ShortLists;
|
|
+import net.himeki.mcmtfabric.parallelised.fastutil.ConcurrentShortHashSet;
|
|
import net.minecraft.CrashReport;
|
|
import net.minecraft.CrashReportCategory;
|
|
import net.minecraft.ReportedException;
|
|
@@ -384,7 +387,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
|
|
|
public static ShortList getOrCreateOffsetList(ShortList[] lists, int index) {
|
|
if (lists[index] == null) {
|
|
- lists[index] = new ShortArrayList();
|
|
+ lists[index] = ShortLists.synchronize(new ShortArrayList());
|
|
}
|
|
|
|
return lists[index];
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
index a78f04ae5eb2d0f11579cb0a40384f3f103371af..f1aae5aa6d2951e21e5e0f84fc87117d41876695 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
@@ -1075,10 +1075,8 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
for (int i = 0; i < this.postProcessing.length; ++i) {
|
|
if (this.postProcessing[i] != null) {
|
|
- ShortListIterator shortlistiterator = this.postProcessing[i].iterator();
|
|
|
|
- while (shortlistiterator.hasNext()) {
|
|
- Short oshort = (Short) shortlistiterator.next();
|
|
+ for (Short oshort : this.postProcessing[i]) {
|
|
BlockPos blockposition = ProtoChunk.unpackOffsetCoordinates(oshort, this.getSectionYFromSectionIndex(i), chunkcoordintpair);
|
|
BlockState iblockdata = this.getBlockState(blockposition);
|
|
FluidState fluid = iblockdata.getFluidState();
|