From fa35cdb3a1c239eb957e7d81b1bc11993a774106 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Mon, 7 Mar 2016 22:24:18 -0600 Subject: [PATCH] Revert "Optimize NavigationListener Iteration" --- ...ptimize-NavigationListener-Iteration.patch | 52 ------------- Spigot-Server-Patches/mc-dev-imports.patch | 75 ------------------- 2 files changed, 127 deletions(-) delete mode 100644 Spigot-Server-Patches/Optimize-NavigationListener-Iteration.patch diff --git a/Spigot-Server-Patches/Optimize-NavigationListener-Iteration.patch b/Spigot-Server-Patches/Optimize-NavigationListener-Iteration.patch deleted file mode 100644 index 04ee1882af..0000000000 --- a/Spigot-Server-Patches/Optimize-NavigationListener-Iteration.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 7 Mar 2016 22:43:26 -0500 -Subject: [PATCH] Optimize NavigationListener Iteration - -I don't know what the person who wrote that code was smoking, but I -don't think it was good. - -diff --git a/src/main/java/net/minecraft/server/NavigationListener.java b/src/main/java/net/minecraft/server/NavigationListener.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NavigationListener.java -+++ b/src/main/java/net/minecraft/server/NavigationListener.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import java.util.ArrayList; // Paper -+import java.util.List; // Paper - import java.util.WeakHashMap; - - public class NavigationListener implements IWorldAccess { - - private static final Object a = new Object(); -- private final WeakHashMap b = new WeakHashMap(); -+ private final List b = new ArrayList<>(); // Paper - - public NavigationListener() {} - - public void a(NavigationAbstract navigationabstract) { -- this.b.put(navigationabstract, NavigationListener.a); -+ org.spigotmc.AsyncCatcher.catchOp("Async Navigation Add"); // Paper -+ this.b.add(navigationabstract); // Paper - } - - public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) { - if (this.a(world, blockposition, iblockdata, iblockdata1)) { -- NavigationAbstract[] anavigationabstract = (NavigationAbstract[]) this.b.keySet().toArray(new NavigationAbstract[0]); -- NavigationAbstract[] anavigationabstract1 = anavigationabstract; -- int j = anavigationabstract.length; -+ // Paper start -+ //NavigationAbstract[] anavigationabstract = (NavigationAbstract[]) this.b.keySet().toArray(new NavigationAbstract[0]); -+ //NavigationAbstract[] anavigationabstract1 = anavigationabstract; -+ int j = this.b.size(); -+ - - for (int k = 0; k < j; ++k) { -- NavigationAbstract navigationabstract = anavigationabstract1[k]; -+ NavigationAbstract navigationabstract = this.b.get(k); -+ // Paper end - - if (navigationabstract != null && !navigationabstract.i()) { - PathEntity pathentity = navigationabstract.k(); --- \ No newline at end of file diff --git a/Spigot-Server-Patches/mc-dev-imports.patch b/Spigot-Server-Patches/mc-dev-imports.patch index ed0464f8cb..d418843c9c 100644 --- a/Spigot-Server-Patches/mc-dev-imports.patch +++ b/Spigot-Server-Patches/mc-dev-imports.patch @@ -3609,81 +3609,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.b.getType(blockposition.down()).b(); + } +} -diff --git a/src/main/java/net/minecraft/server/NavigationListener.java b/src/main/java/net/minecraft/server/NavigationListener.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/NavigationListener.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.WeakHashMap; -+ -+public class NavigationListener implements IWorldAccess { -+ -+ private static final Object a = new Object(); -+ private final WeakHashMap b = new WeakHashMap(); -+ -+ public NavigationListener() {} -+ -+ public void a(NavigationAbstract navigationabstract) { -+ this.b.put(navigationabstract, NavigationListener.a); -+ } -+ -+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) { -+ if (this.a(world, blockposition, iblockdata, iblockdata1)) { -+ NavigationAbstract[] anavigationabstract = (NavigationAbstract[]) this.b.keySet().toArray(new NavigationAbstract[0]); -+ NavigationAbstract[] anavigationabstract1 = anavigationabstract; -+ int j = anavigationabstract.length; -+ -+ for (int k = 0; k < j; ++k) { -+ NavigationAbstract navigationabstract = anavigationabstract1[k]; -+ -+ if (navigationabstract != null && !navigationabstract.i()) { -+ PathEntity pathentity = navigationabstract.k(); -+ -+ if (pathentity != null && !pathentity.b() && pathentity.d() != 0) { -+ PathPoint pathpoint = navigationabstract.c.c(); -+ double d0 = blockposition.distanceSquared(((double) pathpoint.a + navigationabstract.a.locX) / 2.0D, ((double) pathpoint.b + navigationabstract.a.locY) / 2.0D, ((double) pathpoint.c + navigationabstract.a.locZ) / 2.0D); -+ int l = (pathentity.d() - pathentity.e()) * (pathentity.d() - pathentity.e()); -+ -+ if (d0 < (double) l) { -+ navigationabstract.j(); -+ } -+ } -+ } -+ } -+ -+ } -+ } -+ -+ protected boolean a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) { -+ AxisAlignedBB axisalignedbb = iblockdata.d(world, blockposition); -+ AxisAlignedBB axisalignedbb1 = iblockdata1.d(world, blockposition); -+ -+ return axisalignedbb != axisalignedbb1 && (axisalignedbb == null || !axisalignedbb.equals(axisalignedbb1)); -+ } -+ -+ public void a(BlockPosition blockposition) {} -+ -+ public void a(int i, int j, int k, int l, int i1, int j1) {} -+ -+ public void a(EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) {} -+ -+ public void a(int i, boolean flag, double d0, double d1, double d2, double d3, double d4, double d5, int... aint) {} -+ -+ public void a(Entity entity) {} -+ -+ public void b(Entity entity) {} -+ -+ public void a(SoundEffect soundeffect, BlockPosition blockposition) {} -+ -+ public void a(int i, BlockPosition blockposition, int j) {} -+ -+ public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {} -+ -+ public void b(int i, BlockPosition blockposition, int j) {} -+} diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000