summaryrefslogtreecommitdiffstats
path: root/nms-patches/PathfinderGoalSelector.patch
blob: c2452a0846a4b453556106106d120d280e30707d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalSelector.java	2014-11-28 17:43:43.305707430 +0000
+++ src/main/java/net/minecraft/server/PathfinderGoalSelector.java	2014-11-28 17:38:21.000000000 +0000
@@ -6,11 +6,15 @@
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
+import org.bukkit.craftbukkit.util.UnsafeList; // CraftBukkit
+
 public class PathfinderGoalSelector {
 
     private static final Logger a = LogManager.getLogger();
-    private List b = Lists.newArrayList();
-    private List c = Lists.newArrayList();
+    // CraftBukkit start - ArrayList -> UnsafeList
+    private List b = new UnsafeList();
+    private List c = new UnsafeList();
+    // CraftBukkit end
     private final MethodProfiler d;
     private int e;
     private int f = 3;
@@ -107,9 +111,11 @@
             if (pathfindergoalselectoritem1 != pathfindergoalselectoritem) {
                 if (pathfindergoalselectoritem.b >= pathfindergoalselectoritem1.b) {
                     if (!this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1) && this.c.contains(pathfindergoalselectoritem1)) {
+                        ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
                         return false;
                     }
                 } else if (!pathfindergoalselectoritem1.a.i() && this.c.contains(pathfindergoalselectoritem1)) {
+                    ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
                     return false;
                 }
             }