Chunk System and Starlight WIP

Chunk system patch was refactored to take advantage of
newer ConcurrentUtil's concurrent long hash table (which
fixes hash collisions caused by chaining fastutil's long hash
and CHM's hash) plus some other minor improvements.

The chunk system was also merged with Starlight, which mostly
provides a small improvement to ThreadedLevelLightEngine#checkBlock
as the scheduling was rewritten.
This commit is contained in:
Spottedleaf
2024-06-14 17:19:25 -07:00
parent 9b34dc14d9
commit fddfa624cf
9 changed files with 28806 additions and 10 deletions

View File

@@ -29210,6 +29210,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return correct.equals(value) ? null : correct;
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/ChunkSystemConverters.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/ChunkSystemConverters.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/ChunkSystemConverters.java
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/ChunkSystemConverters.java
@@ -0,0 +0,0 @@ public final class ChunkSystemConverters {
public static CompoundTag convertPoiCompoundTag(final CompoundTag data, final ServerLevel world) {
final int dataVersion = getDataVersion(data, DEFAULT_POI_DATA_VERSION);
- return DataFixTypes.POI_CHUNK.update(world.getServer().getFixerUpper(), data, dataVersion, getCurrentVersion());
+ // Paper start - dataconverter
+ return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(
+ ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.POI_CHUNK, data, dataVersion, getCurrentVersion()
+ );
+ // Paper end - dataconverter
}
public static CompoundTag convertEntityChunkCompoundTag(final CompoundTag data, final ServerLevel world) {
final int dataVersion = getDataVersion(data, DEFAULT_ENTITY_CHUNK_DATA_VERSION);
- return DataFixTypes.ENTITY_CHUNK.update(world.getServer().getFixerUpper(), data, dataVersion, getCurrentVersion());
+ // Paper start - dataconverter
+ return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(
+ ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ENTITY_CHUNK, data, dataVersion, getCurrentVersion()
+ );
+ // Paper end - dataconverter
}
private ChunkSystemConverters() {}
diff --git a/src/main/java/net/minecraft/data/structures/StructureUpdater.java b/src/main/java/net/minecraft/data/structures/StructureUpdater.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/data/structures/StructureUpdater.java
@@ -29227,7 +29255,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -0,0 +0,0 @@ public class ChunkStorage implements AutoCloseable {
@@ -0,0 +0,0 @@ public class ChunkStorage implements AutoCloseable, ca.spottedleaf.moonrise.patc
} else {
try {
// CraftBukkit start
@@ -29236,7 +29264,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
CompoundTag level = nbttagcompound.getCompound("Level");
if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
ServerChunkCache cps = (generatoraccess == null) ? null : ((ServerLevel) generatoraccess).getChunkSource();
@@ -0,0 +0,0 @@ public class ChunkStorage implements AutoCloseable {
@@ -0,0 +0,0 @@ public class ChunkStorage implements AutoCloseable, ca.spottedleaf.moonrise.patc
// CraftBukkit end
if (i < 1493) {
@@ -29245,7 +29273,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
LegacyStructureDataHandler persistentstructurelegacy = this.getLegacyStructureHandler(resourcekey, supplier);
@@ -0,0 +0,0 @@ public class ChunkStorage implements AutoCloseable {
@@ -0,0 +0,0 @@ public class ChunkStorage implements AutoCloseable, ca.spottedleaf.moonrise.patc
// Spigot end
ChunkStorage.injectDatafixingContext(nbttagcompound, resourcekey, optional);