From 148f3809ca444dfaa7ccd7851d2274be8b17412c Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 18 Mar 2016 21:41:50 -0500 Subject: [PATCH] Re-add comment to navigation patch --- .../0077-Optimize-Navigation-Listener.patch | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Spigot-Server-Patches/0077-Optimize-Navigation-Listener.patch b/Spigot-Server-Patches/0077-Optimize-Navigation-Listener.patch index 57bed32b41..4c2845f80a 100644 --- a/Spigot-Server-Patches/0077-Optimize-Navigation-Listener.patch +++ b/Spigot-Server-Patches/0077-Optimize-Navigation-Listener.patch @@ -1,4 +1,4 @@ -From 918a65f485c1a865b3a38ecd4e5a879d5bf786aa Mon Sep 17 00:00:00 2001 +From 7a0a329dd1092b98f0951ae49af15c56d210d6d9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 8 Mar 2016 19:13:54 -0500 Subject: [PATCH] Optimize Navigation Listener @@ -32,10 +32,10 @@ index 7d794b9..aa18f54 100644 protected abstract Pathfinder a(); diff --git a/src/main/java/net/minecraft/server/NavigationListener.java b/src/main/java/net/minecraft/server/NavigationListener.java -index f82ea80..aade479 100644 +index f82ea80..963a0e7 100644 --- a/src/main/java/net/minecraft/server/NavigationListener.java +++ b/src/main/java/net/minecraft/server/NavigationListener.java -@@ -1,26 +1,32 @@ +@@ -1,26 +1,35 @@ package net.minecraft.server; +import java.util.ArrayList; // Paper @@ -66,13 +66,16 @@ index f82ea80..aade479 100644 - for (int k = 0; k < j; ++k) { - NavigationAbstract navigationabstract = anavigationabstract1[k]; + */ ++ // DO NOT USE AN ITERATOR! This must be a for (;;) to avoid CME. ++ // This is perfectly safe, as additions are ok to be done in this iteration ++ // and Removals are queued instead of immediate. + for (int k = 0; k < this.navigators.size(); ++k) { + NavigationAbstract navigationabstract = this.navigators.get(k); + // Paper end if (navigationabstract != null && !navigationabstract.i()) { PathEntity pathentity = navigationabstract.k(); -@@ -55,9 +61,21 @@ public class NavigationListener implements IWorldAccess { +@@ -55,9 +64,21 @@ public class NavigationListener implements IWorldAccess { public void a(int i, boolean flag, double d0, double d1, double d2, double d3, double d4, double d5, int... aint) {}