mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-09-18 21:33:01 +00:00
109 lines
4.2 KiB
Diff
109 lines
4.2 KiB
Diff
From 338f5193c63e0aecf0d585d9bcc67e0a6e3e5f91 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 1376bee..4542987 100644
|
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
|
@@ -32,7 +32,7 @@ public class Chunk {
|
|
public final int locZ;
|
|
private boolean m;
|
|
public final Map<BlockPosition, TileEntity> tileEntities;
|
|
- public final EntitySlice<Entity>[] entitySlices;
|
|
+ public final List<Entity>[] entitySlices; // Spigot
|
|
private boolean done;
|
|
private boolean lit;
|
|
private boolean r;
|
|
@@ -83,14 +83,14 @@ public class Chunk {
|
|
this.tileEntities = Maps.newHashMap();
|
|
this.x = 4096;
|
|
this.y = 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.h, -999);
|
|
@@ -744,11 +744,11 @@ public class Chunk {
|
|
public void addEntities() {
|
|
this.j = true;
|
|
this.world.b(this.tileEntities.values());
|
|
- EntitySlice[] aentityslice = this.entitySlices;
|
|
+ List[] aentityslice = this.entitySlices; // Spigot
|
|
int i = aentityslice.length;
|
|
|
|
for (int j = 0; j < i; ++j) {
|
|
- EntitySlice entityslice = aentityslice[j];
|
|
+ List entityslice = aentityslice[j]; // Spigot
|
|
|
|
this.world.a((Collection) entityslice);
|
|
}
|
|
@@ -777,7 +777,7 @@ public class Chunk {
|
|
this.world.b(tileentity);
|
|
}
|
|
|
|
- EntitySlice[] aentityslice = this.entitySlices;
|
|
+ List[] aentityslice = this.entitySlices; // Spigot
|
|
int i = aentityslice.length;
|
|
|
|
for (int j = 0; j < i; ++j) {
|
|
@@ -864,12 +864,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
|
|
}
|
|
}
|
|
@@ -1288,7 +1288,7 @@ public class Chunk {
|
|
return this.tileEntities;
|
|
}
|
|
|
|
- public EntitySlice<Entity>[] getEntitySlices() {
|
|
+ public List<Entity>[] getEntitySlices() {
|
|
return this.entitySlices;
|
|
}
|
|
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
index 057d65e..30efc99 100644
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
@@ -1,5 +1,6 @@
|
|
package org.spigotmc;
|
|
|
|
+import java.util.List;
|
|
import java.util.Set;
|
|
import net.minecraft.server.AxisAlignedBB;
|
|
import net.minecraft.server.Chunk;
|
|
@@ -140,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.7.4
|
|
|