2015-02-20 17:39:04 +01:00
|
|
|
From 853d24c50d7ba15fafb7303e5a7d826659556392 Mon Sep 17 00:00:00 2001
|
2015-02-20 11:34:11 +01:00
|
|
|
From: md_5 <git@md-5.net>
|
|
|
|
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
|
2015-02-20 17:39:04 +01:00
|
|
|
index c50ab45..b76b446 100644
|
2015-02-20 11:34:11 +01:00
|
|
|
--- 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))) {
|
2015-02-20 17:39:04 +01:00
|
|
|
+ if (oclass.isInstance(entity) && entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply(entity))) { // Spigot
|
2015-02-20 11:34:11 +01:00
|
|
|
list.add(entity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -1278,7 +1278,7 @@ public class Chunk {
|
|
|
|
return this.tileEntities;
|
|
|
|
}
|
|
|
|
|
|
|
|
- public EntitySlice[] getEntitySlices() {
|
|
|
|
+ public List[] getEntitySlices() {
|
|
|
|
return this.entitySlices;
|
|
|
|
}
|
|
|
|
|
2015-02-20 11:38:01 +01:00
|
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
index d3f4af1..c5ff1be 100644
|
|
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
@@ -141,9 +141,9 @@ public class ActivationRange
|
|
|
|
*/
|
|
|
|
private static void activateChunkEntities(Chunk chunk)
|
|
|
|
{
|
|
|
|
- for ( EntitySlice slice : chunk.entitySlices )
|
|
|
|
+ for ( List<Entity> slice : chunk.entitySlices )
|
|
|
|
{
|
|
|
|
- for ( Entity entity : (Set<Entity>) slice )
|
|
|
|
+ for ( Entity entity : slice )
|
|
|
|
{
|
|
|
|
if ( MinecraftServer.currentTick > entity.activatedTick )
|
|
|
|
{
|
2015-02-20 11:34:11 +01:00
|
|
|
--
|
|
|
|
2.1.0
|
|
|
|
|