From a951373baeea32270bc866b02ca6548cdf10b011 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

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/>.
---
 .../world/entity/ai/behavior/AcquirePoi.java.patch     | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/AcquirePoi.java.patch

diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/AcquirePoi.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/AcquirePoi.java.patch
new file mode 100644
index 0000000000..64bab57963
--- /dev/null
+++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/AcquirePoi.java.patch
@@ -0,0 +1,10 @@
+--- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
++++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
+@@ -70,6 +70,7 @@
+                                     return false;
+                                 } else {
+                                     mutableLong.setValue(time + 20L + (long)world.getRandom().nextInt(20));
++                                    if (entity.getNavigation().isStuck()) mutableLong.add(200); // Paper - Perf: Wait an additional 10s to check again if they're stuck
+                                     PoiManager poiManager = world.getPoiManager();
+                                     long2ObjectMap.long2ObjectEntrySet().removeIf(entry -> !entry.getValue().isStillValid(time));
+                                     Predicate<BlockPos> predicate2 = pos -> {