107 lines
4.8 KiB
Diff
107 lines
4.8 KiB
Diff
From 85a19c23ec2e95de28cb094814b9c24b9f44878e Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 109b657..d70f979 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<BlockPosition, TileEntity> tileEntities;
|
|
- public final EntitySlice<Entity>[] entitySlices; // CraftBukkit - public
|
|
+ public final List<Entity>[] entitySlices; // Spigot
|
|
private boolean done;
|
|
private boolean lit;
|
|
private boolean p;
|
|
@@ -80,7 +80,7 @@ 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;
|
|
@@ -88,7 +88,7 @@ public class Chunk {
|
|
|
|
/* CraftBukkit start
|
|
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
|
|
}
|
|
// CraftBukkit end */
|
|
|
|
@@ -918,12 +918,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].c(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((T) entity))) { // CraftBukkit - fix decompile error
|
|
+ if (oclass.isInstance(entity) && entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply((T) entity))) { // CraftBukkit - fix decompile error // Spigot
|
|
list.add((T) entity); // Fix decompile error
|
|
}
|
|
}
|
|
@@ -1303,7 +1303,7 @@ public class Chunk {
|
|
return this.tileEntities;
|
|
}
|
|
|
|
- public EntitySlice<Entity>[] getEntitySlices() {
|
|
+ public List<Entity>[] getEntitySlices() {
|
|
return this.entitySlices;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
index c143d01..4ac27d0 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
@@ -157,7 +157,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|
|
|
// CraftBukkit start - moved from Chunk.<init>
|
|
for (int k = 0; k < chunk.entitySlices.length; ++k) {
|
|
- chunk.entitySlices[k] = new EntitySlice(Entity.class);
|
|
+ chunk.entitySlices[k] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot
|
|
}
|
|
// CraftBukkit end
|
|
chunk.addEntities();
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
|
index a43870a..f099976 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
|
@@ -44,7 +44,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
|
|
}
|
|
// moved from Chunk.<init>
|
|
for (int k = 0; k < chunk.entitySlices.length; ++k) {
|
|
- chunk.entitySlices[k] = new EntitySlice(Entity.class);
|
|
+ chunk.entitySlices[k] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot
|
|
}
|
|
|
|
queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world);
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
index 0143623..621a717 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 )
|
|
{
|
|
--
|
|
2.1.0
|
|
|