13
0
geforkt von Mirrors/Paper

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.
Dieser Commit ist enthalten in:
Spottedleaf 2024-06-14 17:19:25 -07:00
Ursprung 9b34dc14d9
Commit fddfa624cf
9 geänderte Dateien mit 28806 neuen und 10 gelöschten Zeilen

32
leaf_notes.txt Normale Datei
Datei anzeigen

@ -0,0 +1,32 @@
- Starlight fixlight command + method on light engine (note: add to mod to, after done this)
- note: for paper, the chunk debug command
- rebase IntervalledCounter into util patch
- mcutil diff
- paper debug chunks --async in DedicatedServer
- TODO keep around region file lock?
- mcutil#getTicketLevelFor is wrong, just delete it later
- in the mod:
- ChunkHolder
- isReadyForSaving overwrite
- remove state fields in mod
- addSaveDependency overwrite
- ChunkMap
- pendingUnloads/pendingGenerationTasks/unloadQueue/ field destroy
- DistanceManager
- getTickets/dumpTickets/tickingTracker/ overwrite
- GenerationChunkHolder
- remove state fields in mod
- rescheduleChunkTask/failAndClearPendingFuturesBetween/failAndClearPendingFuture/completeFuture/
findHighestStatusWithPendingFuture/acquireStatusBump/isStatusDisallowed/ overwrite
- LayerLightEngine
- getDebugSectionType overwrite
- ThreadedLayerLightEngine
- waitForPendingTasks overwrite
on another note, clean up mcutils...
later, run a diff compared to the mod and move all of the diff to separate classes
apply todo in levelmixin
to fix later:
- Change loadedChunkMap in ServerChunkCache to use concurrent long map

Datei anzeigen

@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
RegionFile regionfile = this.getRegionFile(pos, false); // CraftBukkit
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (nbt == null) {
regionfile.clear(pos);
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
dataoutputstream.close();
}
}

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -47,7 +47,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
try {
NbtIo.write(nbt, (DataOutput) dataoutputstream);
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} catch (Throwable throwable1) {
throwable.addSuppressed(throwable1);
}
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
throw throwable;
}
@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// Paper start - Chunk save reattempt
return;
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
public RegionStorageInfo info() {
return this.info;
}

Datei anzeigen

@ -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);

Datei anzeigen

@ -14,7 +14,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
if (regionfile != null) {
return regionfile;
} else {

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.handlingTick = false;
gameprofilerfiller.pop();