@@ -886,10 +886,10 @@ index d5a549f08b98c80a5cf0eef02cb8a389c32dfecb..92731b6b593289e9f583c9b705b219e8
886
886
BlockPos blockPos = path.getTarget();
887
887
Optional<Holder<PoiType>> optional = poiManager.getType(blockPos);
888
888
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
889
- index d7a6eab60bf26916f78f858e224573560e581fef..a908bf1dc5e821dcf6981a8c21076fb0bdc6516d 100644
889
+ index 5930a430983061afddf20e3208ff2462ca1b78cd..63a94b6068fdaef8bb26675c2927cb729ced1dac 100644
890
890
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
891
891
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
892
- @@ -268 ,36 +268 ,45 @@ public class PoiManager extends SectionStorage<PoiSection> implements ca.spotted
892
+ @@ -254 ,36 +254 ,45 @@ public class PoiManager extends SectionStorage<PoiSection, PoiSection.Packed> im
893
893
public Optional<BlockPos> find(
894
894
Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus
895
895
) {
@@ -903,10 +903,10 @@ index d7a6eab60bf26916f78f858e224573560e581fef..a908bf1dc5e821dcf6981a8c21076fb0
903
903
public Optional<BlockPos> findClosest(Predicate<Holder<PoiType>> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
904
904
- return this.getInRange(typePredicate, pos, radius, occupationStatus)
905
905
- .map(PoiRecord::getPos)
906
- - .min(Comparator.comparingDouble(blockPos2 -> blockPos2 .distSqr(pos)));
906
+ - .min(Comparator.comparingDouble(poiPos -> poiPos .distSqr(pos)));
907
907
+ // Paper start - re-route to faster logic
908
- + BlockPos ret = io.papermc.paper.util.PoiAccess.findClosestPoiDataPosition(this, typePredicate, null, pos, radius, radius * radius, occupationStatus, false);
909
- + return Optional.ofNullable(ret );
908
+ + BlockPos closestPos = io.papermc.paper.util.PoiAccess.findClosestPoiDataPosition(this, typePredicate, null, pos, radius, radius * radius, occupationStatus, false);
909
+ + return Optional.ofNullable(closestPos );
910
910
+ // Paper end - re-route to faster logic
911
911
}
912
912
@@ -929,27 +929,27 @@ index d7a6eab60bf26916f78f858e224573560e581fef..a908bf1dc5e821dcf6981a8c21076fb0
929
929
- return this.getInRange(typePredicate, pos, radius, occupationStatus)
930
930
- .map(PoiRecord::getPos)
931
931
- .filter(posPredicate)
932
- - .min(Comparator.comparingDouble(blockPos2 -> blockPos2 .distSqr(pos)));
932
+ - .min(Comparator.comparingDouble(poiPos -> poiPos .distSqr(pos)));
933
933
+ // Paper start - re-route to faster logic
934
- + BlockPos ret = io.papermc.paper.util.PoiAccess.findClosestPoiDataPosition(this, typePredicate, posPredicate, pos, radius, radius * radius, occupationStatus, false);
935
- + return Optional.ofNullable(ret );
934
+ + BlockPos closestPos = io.papermc.paper.util.PoiAccess.findClosestPoiDataPosition(this, typePredicate, posPredicate, pos, radius, radius * radius, occupationStatus, false);
935
+ + return Optional.ofNullable(closestPos );
936
936
+ // Paper end - re-route to faster logic
937
937
}
938
938
939
- public Optional<BlockPos> take(Predicate<Holder<PoiType>> typePredicate, BiPredicate<Holder<PoiType>, BlockPos> biPredicate , BlockPos pos, int radius) {
939
+ public Optional<BlockPos> take(Predicate<Holder<PoiType>> typePredicate, BiPredicate<Holder<PoiType>, BlockPos> posPredicate , BlockPos pos, int radius) {
940
940
- return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE)
941
- - .filter(poi -> biPredicate .test(poi.getPoiType(), poi.getPos()))
941
+ - .filter(poi -> posPredicate .test(poi.getPoiType(), poi.getPos()))
942
942
- .findFirst()
943
943
+ // Paper start - re-route to faster logic
944
944
+ final @javax.annotation.Nullable PoiRecord closest = io.papermc.paper.util.PoiAccess.findClosestPoiDataRecord(
945
- + this, typePredicate, biPredicate , pos, radius, radius * radius, Occupancy.HAS_SPACE, false
945
+ + this, typePredicate, posPredicate , pos, radius, radius * radius, Occupancy.HAS_SPACE, false
946
946
+ );
947
947
+ return Optional.ofNullable(closest)
948
948
+ // Paper end - re-route to faster logic
949
949
.map(poi -> {
950
950
poi.acquireTicket();
951
951
return poi.getPos();
952
- @@ -312 ,8 +321 ,21 @@ public class PoiManager extends SectionStorage<PoiSection> implements ca.spotted
952
+ @@ -298 ,8 +307 ,21 @@ public class PoiManager extends SectionStorage<PoiSection, PoiSection.Packed> im
953
953
int radius,
954
954
RandomSource random
955
955
) {
@@ -974,7 +974,7 @@ index d7a6eab60bf26916f78f858e224573560e581fef..a908bf1dc5e821dcf6981a8c21076fb0
974
974
975
975
public boolean release(BlockPos pos) {
976
976
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
977
- index a6c0e89cb645693034f8e90ac2de8f2da457453c..11e895d837794d79a76303b912092096bd7d07a8 100644
977
+ index 712cbfc100e8aaf612d1d651dae64f57f892a768..827991ee61406bcda3f4794dcc735c0e2e0e09af 100644
978
978
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
979
979
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
980
980
@@ -26,7 +26,7 @@ import org.slf4j.Logger;
@@ -987,10 +987,10 @@ index a6c0e89cb645693034f8e90ac2de8f2da457453c..11e895d837794d79a76303b912092096
987
987
private boolean isValid;
988
988
989
989
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
990
- index c7ed3eb80f6e8b918434153093644776866aa220..21de1b95f2a5d136149447472e871f675760ba1a 100644
990
+ index c3beb7fcad46a917d2b61bd0a0e98e5106056728..9b97fb2d125df4df715599aab27e074707731466 100644
991
991
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
992
992
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
993
- @@ -81 ,11 +81 ,11 @@ public abstract class SectionStorage<R> implements AutoCloseable, ca.spottedleaf
993
+ @@ -131 ,11 +131 ,11 @@ public class SectionStorage<R, P > implements AutoCloseable, ca.spottedleaf.moonr
994
994
}
995
995
996
996
@Nullable
@@ -1005,7 +1005,7 @@ index c7ed3eb80f6e8b918434153093644776866aa220..21de1b95f2a5d136149447472e871f67
1005
1005
return Optional.empty();
1006
1006
} else {
1007
1007
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
1008
- index fd04a50183ccb1f21fc6efa70256e1bb4db2d6d4..49f7ba292b82bac1643cc07aa576f3c37b8e8ab3 100644
1008
+ index 83d294f6f48b867d09ea0d339c779011bf4138a5..9204bb0538297f233442a86733a33e6d0eea8114 100644
1009
1009
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
1010
1010
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
1011
1011
@@ -53,17 +53,39 @@ public class PortalForcer {
0 commit comments