Implement config hooks in PaperHooks

This commit is contained in:
Spottedleaf
2024-10-24 08:36:07 -07:00
parent 4b1beb1404
commit 065aecac6c
3 changed files with 14 additions and 23 deletions

View File

@@ -3,16 +3,8 @@ https://github.com/Tuinity/Moonrise/compare/6a2c6d27df11d417c1fefa749109d8e87599
need to compare the diffs
add notes to moonrise patch:
- implemented fast palette patch
- implemented better bitstorage magic patch
- implemented blockstate property patch (replaced old paper one)
- implemented fluid patch
todo:
- double check that the misc changes commit on dev/1.21.2 moonrise is applied
- implement platformhooks
- in ChunkEntitySlices, implement modifySavedEntities() by copying from old
- implement PlayerChunkUnloadEvent in PlatformHooks#onChunkUnWatch
- make sure chunk pos is passed in PlatformHooks#postLoadProtoChunk
@@ -32,5 +24,4 @@ todo:
- implement starlight.ChunkSerializerMixin diff from reference
- implement starlight.SerializableChunkData$SectionData diff from reference
- implement starlight.SerializableChunkDataMixin diff from reference
- unfuck the chtunk system config diff
- chunk system: move get entity lookup reroute into the folia scheduler api patch

View File

@@ -91,9 +91,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public int configPlayerMaxConcurrentGens();
+
+ public long configAutoSaveInterval();
+ public long configAutoSaveInterval(final ServerLevel world);
+
+ public int configMaxAutoSavePerTick();
+ public int configMaxAutoSavePerTick(final ServerLevel world);
+
+ public boolean configFixMC159283();
+
@@ -1153,42 +1153,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public boolean configAutoConfigSendDistance() {
+
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingAdvanced.autoConfigSendDistance;
+ }
+
+ @Override
+ public double configPlayerMaxLoadRate() {
+
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingBasic.playerMaxChunkLoadRate;
+ }
+
+ @Override
+ public double configPlayerMaxGenRate() {
+
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingBasic.playerMaxChunkGenerateRate;
+ }
+
+ @Override
+ public double configPlayerMaxSendRate() {
+
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingBasic.playerMaxChunkSendRate;
+ }
+
+ @Override
+ public int configPlayerMaxConcurrentLoads() {
+
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingAdvanced.playerMaxConcurrentChunkLoads;
+ }
+
+ @Override
+ public int configPlayerMaxConcurrentGens() {
+
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingAdvanced.playerMaxConcurrentChunkGenerates;
+ }
+
+ @Override
+ public long configAutoSaveInterval() {
+
+ public long configAutoSaveInterval(final ServerLevel world) {
+ return world.paperConfig().chunks.autoSaveInterval.value();
+ }
+
+ @Override
+ public int configMaxAutoSavePerTick() {
+
+ public int configMaxAutoSavePerTick(final ServerLevel world) {
+ return world.paperConfig().chunks.maxAutoSaveChunksPerTick;
+ }
+
+ @Override

View File

@@ -7019,8 +7019,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void autoSave() {
+ final List<NewChunkHolder> reschedule = new ArrayList<>();
+ final long currentTick = this.currentTick;
+ final long maxSaveTime = currentTick - Math.max(1L, PlatformHooks.get().configAutoSaveInterval());
+ final int maxToSave = PlatformHooks.get().configMaxAutoSavePerTick();
+ final long maxSaveTime = currentTick - Math.max(1L, PlatformHooks.get().configAutoSaveInterval(this.world));
+ final int maxToSave = PlatformHooks.get().configMaxAutoSavePerTick(this.world);
+ for (int autoSaved = 0; autoSaved < maxToSave && !this.autoSaveQueue.isEmpty();) {
+ final NewChunkHolder holder = this.autoSaveQueue.first();
+