mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-04 15:41:40 +00:00
42 lines
3.2 KiB
Diff
42 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
|
Date: Wed, 16 Jul 2025 11:13:38 +0800
|
|
Subject: [PATCH] Re-route SetClosestHomeAsWalkTarget's poi finding to paper's
|
|
faster logic
|
|
|
|
Also see findAnyPoiPositions in NearestBedSensor#doTick
|
|
|
|
diff --git a/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java b/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java
|
|
index 51413df5cd61b3ff59c6c6c3ec69d6732ab07d83..f89e6f4dfbb923cf851fc646a0ede8749fbdf89c 100644
|
|
--- a/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java
|
|
+++ b/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java
|
|
@@ -56,14 +56,14 @@ public class SetClosestHomeAsWalkTarget {
|
|
return true;
|
|
}
|
|
};
|
|
- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllWithType(
|
|
- poi -> poi.is(PoiTypes.HOME), predicate, mob.blockPosition(), 48, PoiManager.Occupancy.ANY
|
|
- )
|
|
- .collect(Collectors.toSet());
|
|
+ // Leaf start - Re-route SetClosestHomeAsWalkTarget's poi finding to paper's faster logic
|
|
+ java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
|
|
+ io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, poi -> poi.is(PoiTypes.HOME), predicate, mob.blockPosition(), 48, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes);
|
|
+ // Leaf end - Re-route SetClosestHomeAsWalkTarget's poi finding to paper's faster logic
|
|
// Kaiiju start - petal - Async path processing
|
|
if (org.dreeam.leaf.config.modules.async.AsyncPathfinding.enabled) {
|
|
// await on path async
|
|
- Path possiblePath = AcquirePoi.findPathToPois(mob, set);
|
|
+ Path possiblePath = AcquirePoi.findPathToPois(mob, new java.util.HashSet<>(poiposes)); // Leaf - Re-route SetClosestHomeAsWalkTarget's poi finding to paper's faster logic
|
|
|
|
// wait on the path to be processed
|
|
org.dreeam.leaf.async.path.AsyncPathProcessor.awaitProcessing(possiblePath, path -> {
|
|
@@ -71,7 +71,7 @@ public class SetClosestHomeAsWalkTarget {
|
|
});
|
|
} else {
|
|
// Kaiiju end
|
|
- Path path = AcquirePoi.findPathToPois(mob, set);
|
|
+ Path path = AcquirePoi.findPathToPois(mob, new java.util.HashSet<>(poiposes)); // Leaf - Re-route SetClosestHomeAsWalkTarget's poi finding to paper's faster logic
|
|
processPath(speedModifier, map, mutableLong, walkTarget, level, poiManager, mutableInt, path);
|
|
} // Kaiiju - async path processing
|
|
|