9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-22 16:39:30 +00:00
Files
LeavesMC/patches/server/0028-Skip-POI-finding-if-stuck-in-vehicle.patch
2023-02-02 08:48:28 +08:00

40 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sun, 14 Aug 2022 11:18:44 +0800
Subject: [PATCH] Skip POI finding if stuck in vehicle
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
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 d4c91e0a0c64fcb7f1145de3f30134cb1f1f8ee6..44fc394dbab7e05a3bd7cab493300a964a6c46a5 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
@@ -47,6 +47,11 @@ public class AcquirePoi {
return false;
} else {
mutableLong.setValue(time + 20L + (long)world.getRandom().nextInt(20));
+ // Leaves start - wait an additional 10s to check again if they're stuck
+ if (top.leavesmc.leaves.LeavesConfig.skipPOIFindingInVehicle && entity.getNavigation().isStuck()) {
+ mutableLong.add(200L);
+ }
+ // Leaves end - wait an additional 10s to check again if they're stuck
PoiManager poiManager = world.getPoiManager();
long2ObjectMap.long2ObjectEntrySet().removeIf((entry) -> {
return !entry.getValue().isStillValid(time);
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index b37daf01183089c021878d551ecc56be8256cc3c..69e1cfad36ef7b5117f85a3771e4f5cc7896a5db 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -283,6 +283,11 @@ public final class LeavesConfig {
}
}
+ public static boolean skipPOIFindingInVehicle = true;
+ private static void skipPOIFindingInVehicle() {
+ skipPOIFindingInVehicle = getBoolean("settings.performance.skip-poi-find-in-vehicle", skipPOIFindingInVehicle);
+ }
+
public static final class WorldConfig {
public final String worldName;