mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
47 lines
2.6 KiB
Diff
47 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: hayanesuru <hayanesuru@outlook.jp>
|
|
Date: Tue, 3 Jun 2025 15:41:12 +0900
|
|
Subject: [PATCH] optimize structure map
|
|
|
|
|
|
diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
index 50a9903367f49ece2a267d10944b1515c7b93859..5117671a4391690c90e7577a2518d0298e4b8c74 100644
|
|
--- a/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
+++ b/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
@@ -76,8 +76,8 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh
|
|
protected BlendingData blendingData;
|
|
public final Map<Heightmap.Types, Heightmap> heightmaps = Maps.newEnumMap(Heightmap.Types.class);
|
|
// Paper - rewrite chunk system
|
|
- private final Map<Structure, StructureStart> structureStarts = Maps.newHashMap();
|
|
- private final Map<Structure, LongSet> structuresRefences = Maps.newHashMap();
|
|
+ private final Map<Structure, StructureStart> structureStarts = new it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<>(); // Leaf - optimize structure map
|
|
+ private final Map<Structure, LongSet> structuresRefences = new it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<>(); // Leaf - optimize structure map
|
|
protected final Map<BlockPos, CompoundTag> pendingBlockEntities = Maps.newHashMap();
|
|
public final Map<BlockPos, BlockEntity> blockEntities = new Object2ObjectOpenHashMap<>();
|
|
protected final LevelHeightAccessor levelHeightAccessor;
|
|
@@ -297,7 +297,7 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh
|
|
}
|
|
|
|
public Map<Structure, StructureStart> getAllStarts() {
|
|
- return Collections.unmodifiableMap(this.structureStarts);
|
|
+ return this.structureStarts; // Leaf - optimize structure map
|
|
}
|
|
|
|
public void setAllStarts(Map<Structure, StructureStart> structureStarts) {
|
|
@@ -313,13 +313,13 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh
|
|
|
|
@Override
|
|
public void addReferenceForStructure(Structure structure, long reference) {
|
|
- this.structuresRefences.computeIfAbsent(structure, key -> new LongOpenHashSet()).add(reference);
|
|
+ this.structuresRefences.computeIfAbsent(structure, key -> new it.unimi.dsi.fastutil.longs.LongArraySet()).add(reference); // Leaf - optimize structure map
|
|
this.markUnsaved();
|
|
}
|
|
|
|
@Override
|
|
public Map<Structure, LongSet> getAllReferences() {
|
|
- return Collections.unmodifiableMap(this.structuresRefences);
|
|
+ return this.structuresRefences; // Leaf - optimize structure map
|
|
}
|
|
|
|
@Override
|