pass more stuff

This commit is contained in:
Owen1212055 2024-04-25 09:01:54 -04:00
parent 45900385cd
commit 457e2c8a5a
No known key found for this signature in database
GPG Key ID: 2133292072886A30
2 changed files with 46 additions and 22 deletions

View File

@ -19610,10 +19610,10 @@ index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c
@Override @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 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 --- 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 +++ 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<PoiSection> { public class PoiManager extends SectionStorage<PoiSection> {
public static final int MAX_VILLAGE_DISTANCE = 6; public static final int MAX_VILLAGE_DISTANCE = 6;
public static final int VILLAGE_SECTION_SIZE = 1; public static final int VILLAGE_SECTION_SIZE = 1;
@ -19639,7 +19639,16 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9
public PoiManager( public PoiManager(
RegionStorageInfo storageKey, Path directory, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world RegionStorageInfo storageKey, Path directory, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world
@@ -53,7 +68,7 @@ public class PoiManager extends SectionStorage<PoiSection> { ) {
super(
+ // Paper start
+ storageKey,
+ directory,
+ dsync,
+ // Paper end
new SimpleRegionStorage(storageKey, directory, dataFixer, dsync, DataFixTypes.POI_CHUNK),
PoiSection::codec,
PoiSection::new,
registryManager, registryManager,
world world
); );
@ -19648,7 +19657,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9
} }
public void add(BlockPos pos, Holder<PoiType> type) { public void add(BlockPos pos, Holder<PoiType> type) {
@@ -187,8 +202,8 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -187,8 +207,8 @@ public class PoiManager extends SectionStorage<PoiSection> {
} }
public int sectionsToVillage(SectionPos pos) { public int sectionsToVillage(SectionPos pos) {
@ -19659,7 +19668,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9
} }
boolean isVillageCenter(long pos) { boolean isVillageCenter(long pos) {
@@ -202,20 +217,117 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -202,20 +222,117 @@ public class PoiManager extends SectionStorage<PoiSection> {
@Override @Override
public void tick(BooleanSupplier shouldKeepTicking) { public void tick(BooleanSupplier shouldKeepTicking) {
@ -19783,7 +19792,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9
public void checkConsistencyWithBlocks(SectionPos sectionPos, LevelChunkSection chunkSection) { public void checkConsistencyWithBlocks(SectionPos sectionPos, LevelChunkSection chunkSection) {
Util.ifElse(this.getOrLoad(sectionPos.asLong()), poiSet -> poiSet.refresh(populator -> { Util.ifElse(this.getOrLoad(sectionPos.asLong()), poiSet -> poiSet.refresh(populator -> {
@@ -251,7 +363,7 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -251,7 +368,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
.map(sectionPos -> Pair.of(sectionPos, this.getOrLoad(sectionPos.asLong()))) .map(sectionPos -> Pair.of(sectionPos, this.getOrLoad(sectionPos.asLong())))
.filter(pair -> !pair.getSecond().map(PoiSection::isValid).orElse(false)) .filter(pair -> !pair.getSecond().map(PoiSection::isValid).orElse(false))
.map(pair -> pair.getFirst().chunk()) .map(pair -> pair.getFirst().chunk())
@ -19792,7 +19801,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9
.forEach(chunkPos -> world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.EMPTY)); .forEach(chunkPos -> world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.EMPTY));
} }
@@ -265,7 +377,7 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -265,7 +382,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
@Override @Override
protected int getLevelFromSource(long id) { protected int getLevelFromSource(long id) {
@ -19801,7 +19810,7 @@ index 71d8909f35a22256406a2232d21adfd7d94dc3a5..51564dc963e39018e1572d3429c70eb9
} }
@Override @Override
@@ -287,6 +399,35 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -287,6 +404,35 @@ public class PoiManager extends SectionStorage<PoiSection> {
} }
} }
@ -21000,10 +21009,18 @@ index c4eef3aade889c69cefd873bec2d031cc54103ea..3f6955be976064eb542b5c50a9d6d744
while (objectiterator.hasNext()) { 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 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 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
+++ b/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 net.minecraft.world.level.LevelHeightAccessor;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -21022,16 +21039,23 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda
protected final LevelHeightAccessor levelHeightAccessor; protected final LevelHeightAccessor levelHeightAccessor;
public SectionStorage( public SectionStorage(
@@ -49,7 +49,7 @@ public class SectionStorage<R> implements AutoCloseable { + // Paper start
+ RegionStorageInfo regionStorageInfo,
+ Path path,
+ boolean dsync,
+ // Paper end
SimpleRegionStorage storageAccess,
Function<Runnable, Codec<R>> codecFactory,
Function<Runnable, R> factory,
RegistryAccess registryManager, RegistryAccess registryManager,
LevelHeightAccessor world LevelHeightAccessor world
) { ) {
- this.simpleRegionStorage = storageAccess; - 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.codec = codecFactory;
this.factory = factory; this.factory = factory;
this.registryAccess = registryManager; this.registryAccess = registryManager;
@@ -112,23 +112,21 @@ public class SectionStorage<R> implements AutoCloseable { @@ -112,23 +118,21 @@ public class SectionStorage<R> implements AutoCloseable {
} }
private void readColumn(ChunkPos pos) { private void readColumn(ChunkPos pos) {
@ -21064,7 +21088,7 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda
if (nbt == null) { if (nbt == null) {
for (int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); i++) { for (int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); i++) {
this.storage.put(getKey(pos, i), Optional.empty()); this.storage.put(getKey(pos, i), Optional.empty());
@@ -138,7 +136,7 @@ public class SectionStorage<R> implements AutoCloseable { @@ -138,7 +142,7 @@ public class SectionStorage<R> implements AutoCloseable {
int j = getVersion(dynamic); int j = getVersion(dynamic);
int k = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); int k = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
boolean bl = j != k; boolean bl = j != k;
@ -21073,7 +21097,7 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda
OptionalDynamic<Tag> optionalDynamic = dynamic2.get("Sections"); OptionalDynamic<Tag> optionalDynamic = dynamic2.get("Sections");
for (int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); l++) { for (int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); l++) {
@@ -162,7 +160,7 @@ public class SectionStorage<R> implements AutoCloseable { @@ -162,7 +166,7 @@ public class SectionStorage<R> implements AutoCloseable {
Dynamic<Tag> dynamic = this.writeColumn(pos, registryOps); Dynamic<Tag> dynamic = this.writeColumn(pos, registryOps);
Tag tag = dynamic.getValue(); Tag tag = dynamic.getValue();
if (tag instanceof CompoundTag) { if (tag instanceof CompoundTag) {
@ -21082,7 +21106,7 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda
} else { } else {
LOGGER.error("Expected compound tag, got {}", tag); LOGGER.error("Expected compound tag, got {}", tag);
} }
@@ -212,7 +210,7 @@ public class SectionStorage<R> implements AutoCloseable { @@ -212,7 +216,7 @@ public class SectionStorage<R> implements AutoCloseable {
} }
private static int getVersion(Dynamic<?> dynamic) { private static int getVersion(Dynamic<?> dynamic) {
@ -21091,7 +21115,7 @@ index 151fcbca34e02783e19fbb7b54ec4fbec2eed190..428ed5adce8510dbcd3518f645f0ecda
} }
public void flush(ChunkPos pos) { public void flush(ChunkPos pos) {
@@ -229,6 +227,6 @@ public class SectionStorage<R> implements AutoCloseable { @@ -229,6 +233,6 @@ public class SectionStorage<R> implements AutoCloseable {
@Override @Override
public void close() throws IOException { public void close() throws IOException {

View File

@ -884,10 +884,10 @@ index d5a549f08b98c80a5cf0eef02cb8a389c32dfecb..92731b6b593289e9f583c9b705b219e8
BlockPos blockPos = path.getTarget(); BlockPos blockPos = path.getTarget();
Optional<Holder<PoiType>> optional = poiManager.getType(blockPos); Optional<Holder<PoiType>> 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 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 --- 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 +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
@@ -133,36 +133,45 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -138,36 +138,45 @@ public class PoiManager extends SectionStorage<PoiSection> {
public Optional<BlockPos> find( public Optional<BlockPos> find(
Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus
) { ) {
@ -947,7 +947,7 @@ index 51564dc963e39018e1572d3429c70eb9f8094e72..5ce7db30e6bd75db43ca8f5bbec709d0
.map(poi -> { .map(poi -> {
poi.acquireTicket(); poi.acquireTicket();
return poi.getPos(); return poi.getPos();
@@ -177,8 +186,21 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -182,8 +191,21 @@ public class PoiManager extends SectionStorage<PoiSection> {
int radius, int radius,
RandomSource random RandomSource random
) { ) {
@ -985,10 +985,10 @@ index 5b7deae326228e482b218aeebd857a59b7434eaf..4ee7d75c56d9f9ff3607276857dde844
private boolean isValid; private boolean isValid;
public final Optional<PoiSection> noAllocateOptional = Optional.of(this); // Paper - rewrite chunk system public final Optional<PoiSection> 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 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 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
+++ b/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<R> extends RegionFileStorage implements AutoCloseabl @@ -74,11 +74,11 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
} }
@Nullable @Nullable