mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 02:19:19 +00:00
ClassInstanceMultiMap belongs to Minecraft vanilla entity storage. And is unused, since replaced by spottedleaf's entity storage (rewrite chunk system). However these patches might be useful for vanilla entity storage if is used.
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 d7dbe7d24a6697be6b5db729f940b16b74838d11..a294e64df092e29aec79429031afce4c97ec28d0 100644
|
|
--- a/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
+++ b/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
@@ -77,8 +77,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;
|
|
@@ -304,7 +304,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) {
|
|
@@ -320,13 +320,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
|