summaryrefslogtreecommitdiffstats
path: root/nms-patches/PathfinderGoalSelector.patch
blob: 2aee5af40f60a523a118b86322e448a4e833c1f2 (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
--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalSelector.java	2015-02-26 22:40:22.967608135 +0000
+++ src/main/java/net/minecraft/server/PathfinderGoalSelector.java	2015-02-26 22:40:22.971608135 +0000
@@ -6,11 +6,13 @@
 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<PathfinderGoalSelector.PathfinderGoalSelectorItem> b = Lists.newArrayList();
-    private List<PathfinderGoalSelector.PathfinderGoalSelectorItem> c = Lists.newArrayList();
+    private List<PathfinderGoalSelector.PathfinderGoalSelectorItem> b = new UnsafeList<PathfinderGoalSelector.PathfinderGoalSelectorItem>();
+    private List<PathfinderGoalSelector.PathfinderGoalSelectorItem> c = new UnsafeList<PathfinderGoalSelector.PathfinderGoalSelectorItem>();
     private final MethodProfiler d;
     private int e;
     private int f = 3;
@@ -107,9 +109,11 @@
             if (pathfindergoalselector_pathfindergoalselectoritem1 != pathfindergoalselector_pathfindergoalselectoritem) {
                 if (pathfindergoalselector_pathfindergoalselectoritem.b >= pathfindergoalselector_pathfindergoalselectoritem1.b) {
                     if (!this.a(pathfindergoalselector_pathfindergoalselectoritem, pathfindergoalselector_pathfindergoalselectoritem1) && this.c.contains(pathfindergoalselector_pathfindergoalselectoritem1)) {
+                        ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
                         return false;
                     }
                 } else if (!pathfindergoalselector_pathfindergoalselectoritem1.a.i() && this.c.contains(pathfindergoalselector_pathfindergoalselectoritem1)) {
+                    ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
                     return false;
                 }
             }