9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-27 02:49:06 +00:00
Files
SparklyPaperMC/patches/server/0011-Skip-POI-finding-if-stuck-in-vehicle.patch
2021-08-07 13:26:00 -03:00

34 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Sauve <paul@technove.co>
Date: Thu, 18 Feb 2021 13:13:27 -0600
Subject: [PATCH] Skip POI finding if stuck in vehicle
Airplane
Copyright (C) 2020 Technove LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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 efe66264ad5717bf3aac0fbda07275fb5571acc1..68188f3322a9af8eac423afc5f87bc4f88f4a5bb 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
@@ -68,6 +68,7 @@ public class AcquirePoi extends Behavior<PathfinderMob> {
@Override
protected void start(ServerLevel world, PathfinderMob entity, long time) {
this.nextScheduledStart = time + 20L + (long)world.getRandom().nextInt(20);
+ if (entity.getNavigation().isStuck()) this.nextScheduledStart += 200L; // Airplane - wait an additional 10s to check again if they're stuck
PoiManager poiManager = world.getPoiManager();
this.batchCache.long2ObjectEntrySet().removeIf((entry) -> {
return !entry.getValue().isStillValid(time);