From 0e14ff9789de1562c155358aad71c44e54dce2ba Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 20 Feb 2015 21:34:11 +1100 Subject: [PATCH] Use Standard List for EntitySlices. --- ...9-Use-Standard-List-for-EntitySlices.patch | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 CraftBukkit-Patches/0159-Use-Standard-List-for-EntitySlices.patch diff --git a/CraftBukkit-Patches/0159-Use-Standard-List-for-EntitySlices.patch b/CraftBukkit-Patches/0159-Use-Standard-List-for-EntitySlices.patch new file mode 100644 index 0000000000..ffc346c024 --- /dev/null +++ b/CraftBukkit-Patches/0159-Use-Standard-List-for-EntitySlices.patch @@ -0,0 +1,63 @@ +From b1d615dc4ee4ae82b71fa658ec342cddaba37bd1 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Fri, 20 Feb 2015 21:33:36 +1100 +Subject: [PATCH] Use Standard List for EntitySlices. + + +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index c50ab45..e9cd4d4 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -31,7 +31,7 @@ public class Chunk { + public final int locZ; + private boolean k; + public final Map tileEntities; +- public final EntitySlice[] entitySlices; ++ public final List[] entitySlices; // Spigot + public boolean done; + private boolean lit; + private boolean p; +@@ -80,14 +80,14 @@ public class Chunk { + this.tileEntities = Maps.newHashMap(); + this.v = 4096; + this.w = Queues.newConcurrentLinkedQueue(); +- this.entitySlices = (EntitySlice[]) (new EntitySlice[16]); ++ this.entitySlices = (List[]) (new List[16]); // Spigot + this.world = world; + this.locX = i; + this.locZ = j; + this.heightMap = new int[256]; + + for (int k = 0; k < this.entitySlices.length; ++k) { +- this.entitySlices[k] = new EntitySlice(Entity.class); ++ this.entitySlices[k] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot + } + + Arrays.fill(this.f, -999); +@@ -892,12 +892,12 @@ public class Chunk { + j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); + + for (int k = i; k <= j; ++k) { +- Iterator iterator = this.entitySlices[k].b(oclass).iterator(); ++ Iterator iterator = this.entitySlices[k].iterator(); // Spigot + + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + +- if (entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply(entity))) { ++ if (entity.getClass().isAssignableFrom(oclass) && entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply(entity))) { // Spigot + list.add(entity); + } + } +@@ -1278,7 +1278,7 @@ public class Chunk { + return this.tileEntities; + } + +- public EntitySlice[] getEntitySlices() { ++ public List[] getEntitySlices() { + return this.entitySlices; + } + +-- +2.1.0 +