mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 00:47:38 +01:00
Update Optimise general POI access (#7903)
This commit is contained in:
parent
172d260d67
commit
d7cc306336
@ -30,20 +30,20 @@ This patch also specifically optimises other areas of code to
|
||||
use PoiAccess. For example, some villager AI and portaling code
|
||||
had to be specifically modified.
|
||||
|
||||
TODO: See two still conflicting hunks and two TODOs
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/PoiAccess.java b/src/main/java/io/papermc/paper/util/PoiAccess.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6884e14df
|
||||
index 0000000000000000000000000000000000000000..aaf94f0a47e09d9d23778df437820bc1556d7827
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/util/PoiAccess.java
|
||||
@@ -0,0 +1,749 @@
|
||||
@@ -0,0 +1,800 @@
|
||||
+package io.papermc.paper.util;
|
||||
+
|
||||
+import com.mojang.datafixers.util.Pair;
|
||||
+import it.unimi.dsi.fastutil.doubles.Double2ObjectMap;
|
||||
+import it.unimi.dsi.fastutil.doubles.Double2ObjectRBTreeMap;
|
||||
+import it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue;
|
||||
+import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
+import java.util.function.BiPredicate;
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.core.Holder;
|
||||
+import net.minecraft.util.Mth;
|
||||
@ -133,6 +133,24 @@ index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6
|
||||
+ }
|
||||
+
|
||||
+ // only includes x/z axis
|
||||
+ // finds the closest poi data by distance.
|
||||
+ public static Pair<Holder<PoiType>, BlockPos> findClosestPoiDataTypeAndPosition(final PoiManager poiStorage,
|
||||
+ final Predicate<Holder<PoiType>> villagePlaceType,
|
||||
+ // position predicate must not modify chunk POI
|
||||
+ final Predicate<BlockPos> positionPredicate,
|
||||
+ final BlockPos sourcePosition,
|
||||
+ final int range, // distance on x y z axis
|
||||
+ final double maxDistance,
|
||||
+ final PoiManager.Occupancy occupancy,
|
||||
+ final boolean load) {
|
||||
+ final PoiRecord ret = findClosestPoiDataRecord(
|
||||
+ poiStorage, villagePlaceType, positionPredicate, sourcePosition, range, maxDistance, occupancy, load
|
||||
+ );
|
||||
+
|
||||
+ return ret == null ? null : Pair.of(ret.getPoiType(), ret.getPos());
|
||||
+ }
|
||||
+
|
||||
+ // only includes x/z axis
|
||||
+ // finds the closest poi data by distance. if multiple match the same distance, then they all are returned.
|
||||
+ public static void findClosestPoiDataPositions(final PoiManager poiStorage,
|
||||
+ final Predicate<Holder<PoiType>> villagePlaceType,
|
||||
@ -176,7 +194,25 @@ index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6
|
||||
+ final boolean load) {
|
||||
+ final List<PoiRecord> ret = new ArrayList<>();
|
||||
+ findClosestPoiDataRecords(
|
||||
+ poiStorage, villagePlaceType, positionPredicate, sourcePosition, range, maxDistance, occupancy, load, ret
|
||||
+ poiStorage, villagePlaceType, positionPredicate, sourcePosition, range, maxDistance, occupancy, load, ret
|
||||
+ );
|
||||
+ return ret.isEmpty() ? null : ret.get(0);
|
||||
+ }
|
||||
+
|
||||
+ // only includes x/z axis
|
||||
+ // finds the closest poi data by distance.
|
||||
+ public static PoiRecord findClosestPoiDataRecord(final PoiManager poiStorage,
|
||||
+ final Predicate<Holder<PoiType>> villagePlaceType,
|
||||
+ // position predicate must not modify chunk POI
|
||||
+ final BiPredicate<Holder<PoiType>, BlockPos> predicate,
|
||||
+ final BlockPos sourcePosition,
|
||||
+ final int range, // distance on x y z axis
|
||||
+ final double maxDistance,
|
||||
+ final PoiManager.Occupancy occupancy,
|
||||
+ final boolean load) {
|
||||
+ final List<PoiRecord> ret = new ArrayList<>();
|
||||
+ findClosestPoiDataRecords(
|
||||
+ poiStorage, villagePlaceType, predicate, sourcePosition, range, maxDistance, occupancy, load, ret
|
||||
+ );
|
||||
+ return ret.isEmpty() ? null : ret.get(0);
|
||||
+ }
|
||||
@ -193,6 +229,19 @@ index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6
|
||||
+ final PoiManager.Occupancy occupancy,
|
||||
+ final boolean load,
|
||||
+ final List<PoiRecord> ret) {
|
||||
+ findClosestPoiDataRecords(poiStorage, villagePlaceType, (type, pos) -> positionPredicate.test(pos), sourcePosition, range, maxDistance, occupancy, load, ret);
|
||||
+ }
|
||||
+
|
||||
+ public static void findClosestPoiDataRecords(final PoiManager poiStorage,
|
||||
+ final Predicate<Holder<PoiType>> villagePlaceType,
|
||||
+ // position predicate must not modify chunk POI
|
||||
+ final BiPredicate<Holder<PoiType>, BlockPos> predicate,
|
||||
+ final BlockPos sourcePosition,
|
||||
+ final int range, // distance on x y z axis
|
||||
+ final double maxDistance,
|
||||
+ final PoiManager.Occupancy occupancy,
|
||||
+ final boolean load,
|
||||
+ final List<PoiRecord> ret) {
|
||||
+ final Predicate<? super PoiRecord> occupancyFilter = occupancy.getTest();
|
||||
+
|
||||
+ final List<PoiRecord> closestRecords = new ArrayList<>();
|
||||
@ -302,7 +351,7 @@ index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (positionPredicate != null && !positionPredicate.test(poiPosition)) {
|
||||
+ if (predicate != null && !predicate.test(poiData.getPoiType(), poiPosition)) {
|
||||
+ // filter by position
|
||||
+ continue;
|
||||
+ }
|
||||
@ -383,7 +432,7 @@ index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6
|
||||
+ final PoiManager.Occupancy occupancy,
|
||||
+ final boolean load,
|
||||
+ final int max,
|
||||
+ final List<BlockPos> ret) {
|
||||
+ final List<Pair<Holder<PoiType>, BlockPos>> ret) {
|
||||
+ final Set<BlockPos> positions = new HashSet<>();
|
||||
+ // pos predicate is last thing that runs before adding to ret.
|
||||
+ final Predicate<BlockPos> newPredicate = (final BlockPos pos) -> {
|
||||
@ -399,7 +448,7 @@ index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6
|
||||
+ );
|
||||
+
|
||||
+ for (final PoiRecord record : toConvert) {
|
||||
+ ret.add(record.getPos());
|
||||
+ ret.add(Pair.of(record.getPoiType(), record.getPos()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@ -665,7 +714,7 @@ index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6
|
||||
+ final PoiManager.Occupancy occupancy,
|
||||
+ final boolean load,
|
||||
+ final int max,
|
||||
+ final List<BlockPos> ret) {
|
||||
+ final List<Pair<Holder<PoiType>, BlockPos>> ret) {
|
||||
+ final Set<BlockPos> positions = new HashSet<>();
|
||||
+ // pos predicate is last thing that runs before adding to ret.
|
||||
+ final Predicate<BlockPos> newPredicate = (final BlockPos pos) -> {
|
||||
@ -681,7 +730,7 @@ index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6
|
||||
+ );
|
||||
+
|
||||
+ for (final PoiRecord record : toConvert) {
|
||||
+ ret.add(record.getPos());
|
||||
+ ret.add(Pair.of(record.getPoiType(), record.getPos()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@ -788,43 +837,45 @@ index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
index cf0df7e693ca8dabfde11616617efd97e986788e..63c997ba5e7194218e844480419c6b59a4d26e9a 100644
|
||||
index 4f75f2be7070d49c2c60866ad7146da19ab61652..43243537b765a2d270be6de3f053fea77ff67d18 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
@@ -82,7 +82,11 @@ public class AcquirePoi extends Behavior<PathfinderMob> {
|
||||
@@ -87,7 +87,11 @@ public class AcquirePoi extends Behavior<PathfinderMob> {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
- Set<BlockPos> set = poiManager.findAllClosestFirst(this.poiType.getPredicate(), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet());
|
||||
- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllClosestFirstWithType(this.poiType, predicate, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet());
|
||||
+ // Paper start - optimise POI access
|
||||
+ java.util.List<BlockPos> poiposes = new java.util.ArrayList<>();
|
||||
+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, this.poiType.getPredicate(), predicate, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
|
||||
+ Set<BlockPos> set = new java.util.HashSet<>(poiposes);
|
||||
+ java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
|
||||
+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, this.poiType, predicate, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
|
||||
+ Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes);
|
||||
+ // Paper end - optimise POI access
|
||||
Path path = entity.getNavigation().createPath(set, this.poiType.getValidRange());
|
||||
Path path = findPathToPois(entity, set);
|
||||
if (path != null && path.canReach()) {
|
||||
BlockPos blockPos = path.getTarget();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
||||
index 0eea3e39616e40e15d1662b973c097cda3b2cee7..3ccc1421f4a5a08dadb9fe3c9fa3ac3131e6ba1e 100644
|
||||
index 33fbf72b440e0d164ecd4fb0fdec72e2394d0a1e..8db20db72cd51046213625fac46c35854c59ec5d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
||||
@@ -49,8 +49,12 @@ public class NearestBedSensor extends Sensor<Mob> {
|
||||
@@ -53,10 +53,12 @@ public class NearestBedSensor extends Sensor<Mob> {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
- Stream<BlockPos> stream = poiManager.findAll(PoiType.HOME.getPredicate(), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY);
|
||||
- Path path = entity.getNavigation().createPath(stream, PoiType.HOME.getValidRange());
|
||||
- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllWithType((holder) -> {
|
||||
- return holder.is(PoiTypes.HOME);
|
||||
- }, predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY).collect(Collectors.toSet());
|
||||
- Path path = AcquirePoi.findPathToPois(entity, set);
|
||||
+ // Paper start - optimise POI access
|
||||
+ java.util.List<BlockPos> poiposes = new java.util.ArrayList<>();
|
||||
+ java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
|
||||
+ // don't ask me why it's unbounded. ask mojang.
|
||||
+ io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, PoiType.HOME.getPredicate(), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes);
|
||||
+ Path path = entity.getNavigation().createPath(new java.util.HashSet<>(poiposes), PoiType.HOME.getValidRange());
|
||||
+ io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes);
|
||||
+ Path path = AcquirePoi.findPathToPois(entity, new java.util.HashSet<>(poiposes));
|
||||
+ // Paper end - optimise POI access
|
||||
if (path != null && path.canReach()) {
|
||||
BlockPos blockPos = path.getTarget();
|
||||
Optional<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
|
||||
index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..96708500deb6cda561bad81956cfb8619a066ae0 100644
|
||||
index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..497a81e49d54380713c18523ae8f09f94c453721 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,7 +40,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
@ -836,7 +887,7 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..96708500deb6cda561bad81956cfb861
|
||||
|
||||
public PoiManager(Path path, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world) {
|
||||
super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, registryManager, world);
|
||||
@@ -113,16 +113,21 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
@@ -113,43 +113,62 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
}
|
||||
|
||||
public Optional<BlockPos> find(Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
|
||||
@ -852,17 +903,22 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..96708500deb6cda561bad81956cfb861
|
||||
- return blockPos2.distSqr(pos);
|
||||
- }));
|
||||
+ // Paper start - re-route to faster logic
|
||||
+ BlockPos ret = io.papermc.paper.util.PoiAccess.findClosestPoiDataPosition(this, typePredicate, null, pos, radius, radius*radius, occupationStatus, false);
|
||||
+ BlockPos ret = io.papermc.paper.util.PoiAccess.findClosestPoiDataPosition(this, typePredicate, null, pos, radius, radius * radius, occupationStatus, false);
|
||||
+ return Optional.ofNullable(ret);
|
||||
+ // Paper end - re-route to faster logic
|
||||
}
|
||||
|
||||
public Optional<Pair<Holder<PoiType>, BlockPos>> findClosestWithType(Predicate<Holder<PoiType>> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
|
||||
+ //TODO re-route to faster logic
|
||||
return this.getInRange(typePredicate, pos, radius, occupationStatus).min(Comparator.comparingDouble((poi) -> {
|
||||
return poi.getPos().distSqr(pos);
|
||||
})).map((poi) -> {
|
||||
@@ -131,12 +136,14 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
- return this.getInRange(typePredicate, pos, radius, occupationStatus).min(Comparator.comparingDouble((poi) -> {
|
||||
- return poi.getPos().distSqr(pos);
|
||||
- })).map((poi) -> {
|
||||
- return Pair.of(poi.getPoiType(), poi.getPos());
|
||||
- });
|
||||
+ // Paper start - re-route to faster logic
|
||||
+ return Optional.ofNullable(io.papermc.paper.util.PoiAccess.findClosestPoiDataTypeAndPosition(
|
||||
+ this, typePredicate, null, pos, radius, radius * radius, occupationStatus, false
|
||||
+ ));
|
||||
+ // Paper end - re-route to faster logic
|
||||
}
|
||||
|
||||
public Optional<BlockPos> findClosest(Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
|
||||
@ -876,11 +932,18 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..96708500deb6cda561bad81956cfb861
|
||||
}
|
||||
|
||||
public Optional<BlockPos> take(Predicate<Holder<PoiType>> typePredicate, BiPredicate<Holder<PoiType>, BlockPos> biPredicate, BlockPos pos, int radius) {
|
||||
+ //TODO re-route to faster logic
|
||||
return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE).filter((poi) -> {
|
||||
return biPredicate.test(poi.getPoiType(), poi.getPos());
|
||||
}).findFirst().map((poi) -> {
|
||||
@@ -146,10 +153,21 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
- return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE).filter((poi) -> {
|
||||
- return biPredicate.test(poi.getPoiType(), poi.getPos());
|
||||
- }).findFirst().map((poi) -> {
|
||||
+ // Paper start - re-route to faster logic
|
||||
+ final @javax.annotation.Nullable PoiRecord closest = io.papermc.paper.util.PoiAccess.findClosestPoiDataRecord(
|
||||
+ this, typePredicate, biPredicate, pos, radius, radius * radius, Occupancy.HAS_SPACE, false
|
||||
+ );
|
||||
+ return Optional.ofNullable(closest).map(poi -> {
|
||||
+ // Paper end - re-route to faster logic
|
||||
poi.acquireTicket();
|
||||
return poi.getPos();
|
||||
});
|
||||
}
|
||||
|
||||
public Optional<BlockPos> getRandom(Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> positionPredicate, PoiManager.Occupancy occupationStatus, BlockPos pos, int radius, RandomSource random) {
|
||||
@ -920,7 +983,7 @@ index bb2be6eea7a0cff4cc70bd43738b1ce213e43558..b71a4027a0eed467a3707c59315092dd
|
||||
private boolean isValid;
|
||||
|
||||
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 80a7a1340908ae783a029912487485f7596bec5b..83d41596e53b3bd2e983561688c49399bdaa2095 100644
|
||||
index 678bd36581ead3a225e3a6e24b78e5db4e42657b..9b2cec7528936a5d53a926c91063cb6e9ed7da1b 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
|
||||
@@ -71,11 +71,11 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
||||
@ -938,10 +1001,10 @@ index 80a7a1340908ae783a029912487485f7596bec5b..83d41596e53b3bd2e983561688c49399
|
||||
return Optional.empty();
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
index 504f5d98d4a3d6b5bbd0998b495196aa6b39f47a..436f31ab1450bb087e00bed2c6acd8d8833e0598 100644
|
||||
index 1311d69bb2fa7b3617936e6ad6eb5236fedc260d..386a73f32f2504af81107852307dcd393d4d8a11 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
@@ -51,18 +51,41 @@ public class PortalForcer {
|
||||
@@ -51,18 +51,39 @@ public class PortalForcer {
|
||||
// int i = flag ? 16 : 128;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -962,9 +1025,7 @@ index 504f5d98d4a3d6b5bbd0998b495196aa6b39f47a..436f31ab1450bb087e00bed2c6acd8d8
|
||||
+ java.util.List<PoiRecord> records = new java.util.ArrayList<>();
|
||||
+ io.papermc.paper.util.PoiAccess.findClosestPoiDataRecords(
|
||||
+ villageplace,
|
||||
+ (PoiType type) -> {
|
||||
+ return type == PoiType.NETHER_PORTAL;
|
||||
+ },
|
||||
+ type -> type.is(PoiTypes.NETHER_PORTAL),
|
||||
+ (BlockPos pos) -> {
|
||||
+ net.minecraft.world.level.chunk.ChunkAccess lowest = this.level.getChunk(pos.getX() >> 4, pos.getZ() >> 4, net.minecraft.world.level.chunk.ChunkStatus.EMPTY);
|
||||
+ if (!lowest.getStatus().isOrAfter(net.minecraft.world.level.chunk.ChunkStatus.FULL)
|
@ -914,7 +914,7 @@ index 0000000000000000000000000000000000000000..3ba094e640d7fe7803e2bbdab8ff3beb
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index a110acecd0459ff2731dbc5f10cc0d990afd4d5b..3ce6df8c6084cbc19a2e57e5934e1e6b944aa2fd 100644
|
||||
index 4dc54c121b4e41cc7ef5da1313fa6a49e73de9e8..5518dc58647aae68b31dbe059cdbc669cfa73112 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -446,7 +446,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@ -1051,7 +1051,7 @@ index 1a3be6f0570c7c746eafa36544debe90d7629432..c0817ef8927f00e2fd3fbf3289f8041f
|
||||
|
||||
<T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index e3efc697f0730703ec42aad79de004a476bd09b6..27e00259a3cec2205cce3e2b99f03a9e9ba45a1b 100644
|
||||
index 91a36884e10c278f6e0efb4fbed1352492b38200..ff118d658d52a4ac5d261727c6e23a3b663ecae9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -294,6 +294,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@ -77,7 +77,7 @@ index a34f22cadc09e53ea4de787b04d050b99dddbcac..c8012de68b997d6270ba4a5d79bc93c0
|
||||
});
|
||||
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 78e2e9285b018aa52726cc61f7027e49e9dd9d68..6d1489332681d938a1c3db832ab967ba494f3b97 100644
|
||||
index 0b3c4e43d5d9b13c963b1802cd85f099b4274c8c..61251596a16fc1e2aba735feca2c073a4db3a4a8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -998,7 +998,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -13,7 +13,7 @@ Paper recently reverted this optimisation, so it's been reintroduced
|
||||
here.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index f87844acb092bedad5e742c8000a1a09759bdd6d..e07b094cf19bc94a4e3ef726f37973eaff7aaf6d 100644
|
||||
index 0d41b56519db354b730527b28e0294469ff11db9..5e8d303133a2cd8b748c127e2b6aa4d279d4df4d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -369,6 +369,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@ -120,7 +120,7 @@ index 0000000000000000000000000000000000000000..16ca915c33e31b50d33336408b041e40
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 6d1489332681d938a1c3db832ab967ba494f3b97..3ef55cb31b8d9a308fab3ac1e463e98a7dce726e 100644
|
||||
index 61251596a16fc1e2aba735feca2c073a4db3a4a8..69ecceda441d9a228c1ae401688ea7333287b80c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -662,6 +662,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@ -342,7 +342,7 @@ index 69c98c2cb2fd8f149a39bbddcbfe0c5c5adc3904..5575730aa6f77a91467c394fa8465c33
|
||||
|
||||
public BlockPos getHomePos() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index e07b094cf19bc94a4e3ef726f37973eaff7aaf6d..03f7eb8a56fd4e609bc7b1a00d18cad5586a41dd 100644
|
||||
index 5e8d303133a2cd8b748c127e2b6aa4d279d4df4d..504455c626a9d22f552144a38861dc356fb02b99 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1302,10 +1302,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@ -105,7 +105,7 @@ index d2227b40aa6a5e49e30c1f33e407d8f25cf2be4e..1c5137be8c0935ae371d0b9e6a8f3d8b
|
||||
|
||||
protected ChunkGenerator generator() {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 3ef55cb31b8d9a308fab3ac1e463e98a7dce726e..d292e4775cdf936bb294bba7c0320c8b97ad14a6 100644
|
||||
index 69ecceda441d9a228c1ae401688ea7333287b80c..61964e73b020aa565a855d23f2f4da2da342c1e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -404,6 +404,83 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@ -226,7 +226,7 @@ index a49dfe4f81d449c5dd7ba5b8f9af7fec5c54f5de..3646b969fa51b9683ab4137e530c3a6f
|
||||
if (entityhuman != null) {
|
||||
double d0 = entityhuman.distanceToSqr((Entity) this);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 03f7eb8a56fd4e609bc7b1a00d18cad5586a41dd..aba8e748123f70d48de638ea18afbbf5dfede504 100644
|
||||
index 504455c626a9d22f552144a38861dc356fb02b99..13c4b7aee9b9802edbaf7e4df9e9355667e727bb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -206,6 +206,69 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@ -110,7 +110,7 @@ index 1c5137be8c0935ae371d0b9e6a8f3d8bccd85d31..8939d15bd413a2b743303d137fc797be
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index d292e4775cdf936bb294bba7c0320c8b97ad14a6..7e7edaebf146d8042e9b75f6088990069ca9021a 100644
|
||||
index 61964e73b020aa565a855d23f2f4da2da342c1e1..81016748af10abc2b3ea15109e4d9bb32383cbc3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1113,6 +1113,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -22882,7 +22882,7 @@ index de7afc737b1ab099edc29a4ef94baa76329c2947..2bc0384728f89b7c64a8beec78a1b77d
|
||||
|
||||
public static int getVersion(CompoundTag chunkNbt) {
|
||||
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 678bd36581ead3a225e3a6e24b78e5db4e42657b..ff6b25fd21836a080d63f1051b6645ec3d262658 100644
|
||||
index 9b2cec7528936a5d53a926c91063cb6e9ed7da1b..47cda78efcce597d3d7ba8fc93a2865e10cdc237 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
|
||||
@@ -148,7 +148,14 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 7e7edaebf146d8042e9b75f6088990069ca9021a..0179e519c01897e373f6f9ed4af17dcf4469b762 100644
|
||||
index 81016748af10abc2b3ea15109e4d9bb32383cbc3..edeafd4c671d686c96bffc095fa81b9a4a6723a6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2569,6 +2569,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't log debug logging being disabled
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 0a53abd88f392fbb33485077aa24df825819d1f2..cd1228e1fbd2434b42df0fd6887d00b9bdb21516 100644
|
||||
index edc5f195cc3de8885b839469656650ba465346be..5d162f59fc5ef9adf7fa762b137bbcfca745d9c5 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -382,7 +382,7 @@ public class SpigotConfig
|
@ -55,7 +55,7 @@ index 169e2514c5d6942fe28f0deb84540bd4a50f0ece..e25423b46ced54dd6b270d45a3c4502a
|
||||
if (chunkHolder.protoChunk != null) {
|
||||
ProtoChunk protochunk = chunkHolder.protoChunk;
|
||||
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 ab9bb440c8e91ecb49c1e14a427d35087a87ac80..400732788820a94acebccb1ad64789e0f6defdb1 100644
|
||||
index 497a81e49d54380713c18523ae8f09f94c453721..210b0cdd4831421c8f43c3d823ac8e962b56bbbc 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
|
||||
@@ -1,5 +1,6 @@
|
||||
@ -87,7 +87,7 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..400732788820a94acebccb1ad64789e0
|
||||
+ }
|
||||
+ // Paper end - unload poi data
|
||||
private final LongSet loadedChunks = new LongOpenHashSet();
|
||||
private final net.minecraft.server.level.ServerLevel world; // Paper
|
||||
public final net.minecraft.server.level.ServerLevel world; // Paper // Paper public
|
||||
|
||||
public PoiManager(Path path, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world) {
|
||||
super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, registryManager, world);
|
||||
@ -213,7 +213,7 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..400732788820a94acebccb1ad64789e0
|
||||
public void add(BlockPos pos, Holder<PoiType> type) {
|
||||
this.getOrCreate(SectionPos.asLong(pos)).add(pos, type);
|
||||
}
|
||||
@@ -182,8 +312,8 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
@@ -201,8 +331,8 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
}
|
||||
|
||||
public int sectionsToVillage(SectionPos pos) {
|
||||
@ -224,7 +224,7 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..400732788820a94acebccb1ad64789e0
|
||||
}
|
||||
|
||||
boolean isVillageCenter(long pos) {
|
||||
@@ -198,7 +328,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
@@ -217,7 +347,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
@Override
|
||||
public void tick(BooleanSupplier shouldKeepTicking) {
|
||||
// Paper start - async chunk io
|
||||
@ -233,7 +233,7 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..400732788820a94acebccb1ad64789e0
|
||||
ChunkPos chunkcoordintpair = SectionPos.of(this.dirty.firstLong()).chunk();
|
||||
|
||||
net.minecraft.nbt.CompoundTag data;
|
||||
@@ -208,19 +338,24 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
@@ -227,19 +357,24 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world,
|
||||
chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY);
|
||||
}
|
||||
@ -261,7 +261,7 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..400732788820a94acebccb1ad64789e0
|
||||
}
|
||||
|
||||
public void checkConsistencyWithBlocks(ChunkPos chunkPos, LevelChunkSection chunkSection) {
|
||||
@@ -278,7 +413,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
@@ -297,7 +432,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
|
||||
@Override
|
||||
protected int getLevelFromSource(long id) {
|
||||
@ -271,7 +271,7 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..400732788820a94acebccb1ad64789e0
|
||||
|
||||
@Override
|
||||
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 ff6b25fd21836a080d63f1051b6645ec3d262658..2646c420cb049ead697e1a973f7d023378903afa 100644
|
||||
index 47cda78efcce597d3d7ba8fc93a2865e10cdc237..38287fad39d553a86370bbdc755c0a006615e0cf 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
|
||||
@@ -58,6 +58,40 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user