Archiviert
13
0

Re-add comment to navigation patch

Dieser Commit ist enthalten in:
Zach Brown 2016-03-18 21:41:50 -05:00
Ursprung c19e52a63f
Commit 148f3809ca

Datei anzeigen

@ -1,4 +1,4 @@
From 918a65f485c1a865b3a38ecd4e5a879d5bf786aa Mon Sep 17 00:00:00 2001
From 7a0a329dd1092b98f0951ae49af15c56d210d6d9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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) {}