mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-09-18 21:33:01 +00:00
110 lines
4.5 KiB
Diff
110 lines
4.5 KiB
Diff
From 82aa0765c1e7111760b6c10c99b6a2e82b29d55d 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 14ecc1456..5d3c7ad87 100644
|
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
|
@@ -40,7 +40,7 @@ public class Chunk implements IChunkAccess {
|
|
private boolean l;
|
|
private final ChunkConverter m;
|
|
public final Map<BlockPosition, TileEntity> tileEntities;
|
|
- public final EntitySlice<Entity>[] entitySlices;
|
|
+ public final List<Entity>[] entitySlices; // Spigot
|
|
private final Map<String, StructureStart> p;
|
|
private final Map<String, LongSet> q;
|
|
private final ShortList[] r;
|
|
@@ -101,7 +101,7 @@ public class Chunk implements IChunkAccess {
|
|
this.B = Queues.newConcurrentLinkedQueue();
|
|
this.C = ChunkStatus.EMPTY;
|
|
this.E = new AtomicInteger();
|
|
- this.entitySlices = (EntitySlice[]) (new EntitySlice[16]);
|
|
+ this.entitySlices = (List[]) (new List[16]); // Spigot
|
|
this.world = world;
|
|
this.locX = i;
|
|
this.locZ = j;
|
|
@@ -119,7 +119,7 @@ public class Chunk implements IChunkAccess {
|
|
}
|
|
|
|
for (int j1 = 0; j1 < this.entitySlices.length; ++j1) {
|
|
- this.entitySlices[j1] = new EntitySlice(Entity.class);
|
|
+ this.entitySlices[j1] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot
|
|
}
|
|
|
|
this.f = abiomebase;
|
|
@@ -782,11 +782,11 @@ public class Chunk implements IChunkAccess {
|
|
public void addEntities() {
|
|
this.i = true;
|
|
this.world.a(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(entityslice.stream().filter((entity) -> {
|
|
return !(entity instanceof EntityHuman);
|
|
@@ -851,7 +851,7 @@ public class Chunk implements IChunkAccess {
|
|
this.world.b(tileentity);
|
|
}
|
|
|
|
- EntitySlice[] aentityslice = this.entitySlices;
|
|
+ List[] aentityslice = this.entitySlices; // Spigot
|
|
int i = aentityslice.length;
|
|
|
|
for (int j = 0; j < i; ++j) {
|
|
@@ -938,12 +938,12 @@ public class Chunk implements IChunkAccess {
|
|
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().c(axisalignedbb) && (predicate == null || predicate.test((T) entity))) { // CraftBukkit - fix decompile error
|
|
+ if (oclass.isInstance(entity) && entity.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test((T) entity))) { // CraftBukkit - fix decompile error // Spigot - instance check
|
|
list.add((T) entity); // Fix decompile error
|
|
}
|
|
}
|
|
@@ -1098,7 +1098,7 @@ public class Chunk implements IChunkAccess {
|
|
return this.tileEntities;
|
|
}
|
|
|
|
- public EntitySlice<Entity>[] getEntitySlices() {
|
|
+ public List<Entity>[] getEntitySlices() { // Spigot
|
|
return this.entitySlices;
|
|
}
|
|
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
index f45e0a344..c1071c92e 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;
|
|
@@ -142,9 +143,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.19.1
|
|
|