From 457e2c8a5abb8d345d87058fbf419fd772a24d85 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:01:54 -0400 Subject: [PATCH] pass more stuff --- .../server/0986-Rewrite-chunk-system.patch | 58 +++++++++++++------ .../1012-Optimise-general-POI-access.patch | 10 ++-- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/patches/server/0986-Rewrite-chunk-system.patch b/patches/server/0986-Rewrite-chunk-system.patch index fd52880b98..ec45f3cb07 100644 --- a/patches/server/0986-Rewrite-chunk-system.patch +++ b/patches/server/0986-Rewrite-chunk-system.patch @@ -19610,10 +19610,10 @@ index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9f8094e72 100644 +index 71d8909f35a22256406a2232d21adfd7d94dc3a5..7b52b0507cbda76aee1db954641f397bef51f94d 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -@@ -40,8 +40,23 @@ import net.minecraft.world.level.chunk.storage.SimpleRegionStorage; +@@ -40,20 +40,40 @@ import net.minecraft.world.level.chunk.storage.SimpleRegionStorage; public class PoiManager extends SectionStorage { public static final int MAX_VILLAGE_DISTANCE = 6; public static final int VILLAGE_SECTION_SIZE = 1; @@ -19639,7 +19639,16 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9 public PoiManager( RegionStorageInfo storageKey, Path directory, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world -@@ -53,7 +68,7 @@ public class PoiManager extends SectionStorage { + ) { + super( ++ // Paper start ++ storageKey, ++ directory, ++ dsync, ++ // Paper end + new SimpleRegionStorage(storageKey, directory, dataFixer, dsync, DataFixTypes.POI_CHUNK), + PoiSection::codec, + PoiSection::new, registryManager, world ); @@ -19648,7 +19657,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9 } public void add(BlockPos pos, Holder type) { -@@ -187,8 +202,8 @@ public class PoiManager extends SectionStorage { +@@ -187,8 +207,8 @@ public class PoiManager extends SectionStorage { } public int sectionsToVillage(SectionPos pos) { @@ -19659,7 +19668,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9 } boolean isVillageCenter(long pos) { -@@ -202,20 +217,117 @@ public class PoiManager extends SectionStorage { +@@ -202,20 +222,117 @@ public class PoiManager extends SectionStorage { @Override public void tick(BooleanSupplier shouldKeepTicking) { @@ -19783,7 +19792,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9 public void checkConsistencyWithBlocks(SectionPos sectionPos, LevelChunkSection chunkSection) { Util.ifElse(this.getOrLoad(sectionPos.asLong()), poiSet -> poiSet.refresh(populator -> { -@@ -251,7 +363,7 @@ public class PoiManager extends SectionStorage { +@@ -251,7 +368,7 @@ public class PoiManager extends SectionStorage { .map(sectionPos -> Pair.of(sectionPos, this.getOrLoad(sectionPos.asLong()))) .filter(pair -> !pair.getSecond().map(PoiSection::isValid).orElse(false)) .map(pair -> pair.getFirst().chunk()) @@ -19792,7 +19801,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9 .forEach(chunkPos -> world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.EMPTY)); } -@@ -265,7 +377,7 @@ public class PoiManager extends SectionStorage { +@@ -265,7 +382,7 @@ public class PoiManager extends SectionStorage { @Override protected int getLevelFromSource(long id) { @@ -19801,7 +19810,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9 } @Override -@@ -287,6 +399,35 @@ public class PoiManager extends SectionStorage { +@@ -287,6 +404,35 @@ public class PoiManager extends SectionStorage { } } @@ -21000,10 +21009,18 @@ index c4eef3aade889c69cefd873bec2d031cc54103ea..3f6955be976064eb542b5c50a9d6d744 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecdacf3a0132 100644 +index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..883fbe5c81e3be27007a1a0489f80ba1863e5a04 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -@@ -31,15 +31,15 @@ import net.minecraft.world.level.ChunkPos; +@@ -12,6 +12,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap; + import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; + import it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet; + import java.io.IOException; ++import java.nio.file.Path; + import java.util.Map; + import java.util.Optional; + import java.util.concurrent.CompletableFuture; +@@ -31,25 +32,30 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LevelHeightAccessor; import org.slf4j.Logger; @@ -21022,16 +21039,23 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda protected final LevelHeightAccessor levelHeightAccessor; public SectionStorage( -@@ -49,7 +49,7 @@ public class SectionStorage implements AutoCloseable { ++ // Paper start ++ RegionStorageInfo regionStorageInfo, ++ Path path, ++ boolean dsync, ++ // Paper end + SimpleRegionStorage storageAccess, + Function> codecFactory, + Function factory, RegistryAccess registryManager, LevelHeightAccessor world ) { - this.simpleRegionStorage = storageAccess; -+ super(,path, dsync); // Paper - remove mojang I/O thread TODO this trash ++ super(regionStorageInfo, path, dsync); // Paper - remove mojang I/O thread this.codec = codecFactory; this.factory = factory; this.registryAccess = registryManager; -@@ -112,23 +112,21 @@ public class SectionStorage implements AutoCloseable { +@@ -112,23 +118,21 @@ public class SectionStorage implements AutoCloseable { } private void readColumn(ChunkPos pos) { @@ -21064,7 +21088,7 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda if (nbt == null) { for (int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); i++) { this.storage.put(getKey(pos, i), Optional.empty()); -@@ -138,7 +136,7 @@ public class SectionStorage implements AutoCloseable { +@@ -138,7 +142,7 @@ public class SectionStorage implements AutoCloseable { int j = getVersion(dynamic); int k = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); boolean bl = j != k; @@ -21073,7 +21097,7 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda OptionalDynamic optionalDynamic = dynamic2.get("Sections"); for (int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); l++) { -@@ -162,7 +160,7 @@ public class SectionStorage implements AutoCloseable { +@@ -162,7 +166,7 @@ public class SectionStorage implements AutoCloseable { Dynamic dynamic = this.writeColumn(pos, registryOps); Tag tag = dynamic.getValue(); if (tag instanceof CompoundTag) { @@ -21082,7 +21106,7 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda } else { LOGGER.error("Expected compound tag, got {}", tag); } -@@ -212,7 +210,7 @@ public class SectionStorage implements AutoCloseable { +@@ -212,7 +216,7 @@ public class SectionStorage implements AutoCloseable { } private static int getVersion(Dynamic dynamic) { @@ -21091,7 +21115,7 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda } public void flush(ChunkPos pos) { -@@ -229,6 +227,6 @@ public class SectionStorage implements AutoCloseable { +@@ -229,6 +233,6 @@ public class SectionStorage implements AutoCloseable { @Override public void close() throws IOException { diff --git a/patches/server/1012-Optimise-general-POI-access.patch b/patches/server/1012-Optimise-general-POI-access.patch index f6a42457f4..9591ef9b65 100644 --- a/patches/server/1012-Optimise-general-POI-access.patch +++ b/patches/server/1012-Optimise-general-POI-access.patch @@ -884,10 +884,10 @@ index d5a549f08b98c80a5cf0eef02cb8a389c32dfecb..92731b6b593289e9f583c9b705b219e8 BlockPos blockPos = path.getTarget(); Optional> optional = poiManager.getType(blockPos); diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index 51564dc963e39018e1572d3429c70eb9f8094e72..5ce7db30e6bd75db43ca8f5bbec709d07861966f 100644 +index 7b52b0507cbda76aee1db954641f397bef51f94d..c6f193339fdcbcc938d4eafdcad0b112cf1698d5 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -@@ -133,36 +133,45 @@ public class PoiManager extends SectionStorage { +@@ -138,36 +138,45 @@ public class PoiManager extends SectionStorage { public Optional find( Predicate> typePredicate, Predicate posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus ) { @@ -947,7 +947,7 @@ index 51564dc963e39018e1572d3429c70eb9f8094e72..5ce7db30e6bd75db43ca8f5bbec709d0 .map(poi -> { poi.acquireTicket(); return poi.getPos(); -@@ -177,8 +186,21 @@ public class PoiManager extends SectionStorage { +@@ -182,8 +191,21 @@ public class PoiManager extends SectionStorage { int radius, RandomSource random ) { @@ -985,10 +985,10 @@ index 5b7deae326228e482b218aeebd857a59b7434eaf..4ee7d75c56d9f9ff3607276857dde844 private boolean isValid; public final Optional noAllocateOptional = Optional.of(this); // Paper - rewrite chunk system diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index 428ed5adce8510dbcd3518f645f0ecdacf3a0132..f265be3b5b0ce769d2dbf20dd188bf59ce9f32d4 100644 +index 883fbe5c81e3be27007a1a0489f80ba1863e5a04..a4a919d8373f1535e336de7e648d41a07efb1cba 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -@@ -68,11 +68,11 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl +@@ -74,11 +74,11 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl } @Nullable