mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-09-18 21:33:01 +00:00
130 lines
5.7 KiB
Diff
130 lines
5.7 KiB
Diff
From 1c6f7c0bd01f811f228a4ab2e259a5ca1960ac95 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 0bd39249..2d40f03b 100644
|
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
|
@@ -41,7 +41,7 @@ public class Chunk implements IChunkAccess {
|
|
public final Map<HeightMap.Type, HeightMap> heightMap;
|
|
private final ChunkConverter i;
|
|
public final Map<BlockPosition, TileEntity> tileEntities;
|
|
- public final EntitySlice<Entity>[] entitySlices;
|
|
+ public final List<Entity>[] entitySlices; // Spigot
|
|
private final Map<String, StructureStart> l;
|
|
private final Map<String, LongSet> m;
|
|
private final ShortList[] n;
|
|
@@ -66,7 +66,7 @@ public class Chunk implements IChunkAccess {
|
|
this.l = Maps.newHashMap();
|
|
this.m = Maps.newHashMap();
|
|
this.n = new ShortList[16];
|
|
- this.entitySlices = (EntitySlice[]) (new EntitySlice[16]);
|
|
+ this.entitySlices = (List[]) (new List[16]); // Spigot
|
|
this.world = world;
|
|
this.loc = chunkcoordintpair;
|
|
this.i = chunkconverter;
|
|
@@ -82,7 +82,7 @@ public class Chunk implements IChunkAccess {
|
|
}
|
|
|
|
for (int l = 0; l < this.entitySlices.length; ++l) {
|
|
- this.entitySlices[l] = new EntitySlice<>(Entity.class);
|
|
+ this.entitySlices[l] = new org.bukkit.craftbukkit.util.UnsafeList(); // Spigot
|
|
}
|
|
|
|
this.d = abiomebase;
|
|
@@ -577,7 +577,7 @@ 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].a(Entity.class).iterator();
|
|
+ Iterator iterator = this.entitySlices[k].iterator(); // Spigot
|
|
|
|
while (iterator.hasNext()) {
|
|
Entity entity = (Entity) iterator.next();
|
|
@@ -598,12 +598,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].a(oclass).iterator();
|
|
+ Iterator iterator = this.entitySlices[k].iterator(); // Spigot
|
|
|
|
while (iterator.hasNext()) {
|
|
T t0 = (T) iterator.next(); // CraftBukkit - decompile error
|
|
|
|
- if (t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) {
|
|
+ if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check
|
|
list.add(t0);
|
|
}
|
|
}
|
|
@@ -642,7 +642,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/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
index 88a89f38..3da6d92a 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
@@ -478,11 +478,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
chunk.c(true);
|
|
this.world.a(chunk.getTileEntities().values());
|
|
List<Entity> list = null;
|
|
- EntitySlice[] aentityslice = chunk.getEntitySlices();
|
|
+ List<Entity>[] aentityslice = chunk.getEntitySlices(); // Spigot
|
|
int i = aentityslice.length;
|
|
|
|
for (int j = 0; j < i; ++j) {
|
|
- EntitySlice<Entity> entityslice = aentityslice[j];
|
|
+ List<Entity> entityslice = aentityslice[j]; // Spigot
|
|
Iterator iterator = entityslice.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index b55a784c..1ec8272f 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -1101,11 +1101,11 @@ public class WorldServer extends World {
|
|
}
|
|
// Spigot End
|
|
this.tileEntityListUnload.addAll(chunk.getTileEntities().values());
|
|
- EntitySlice[] aentityslice = chunk.getEntitySlices();
|
|
+ List[] aentityslice = chunk.getEntitySlices(); // Spigot
|
|
int i = aentityslice.length;
|
|
|
|
for (int j = 0; j < i; ++j) {
|
|
- EntitySlice<Entity> entityslice = aentityslice[j];
|
|
+ List<Entity> entityslice = aentityslice[j]; // Spigot
|
|
Iterator iterator = entityslice.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
index 28e877a9..76b060a1 100644
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
@@ -1,6 +1,7 @@
|
|
package org.spigotmc;
|
|
|
|
import java.util.Collection;
|
|
+import java.util.List;
|
|
import net.minecraft.server.AxisAlignedBB;
|
|
import net.minecraft.server.Chunk;
|
|
import net.minecraft.server.Entity;
|
|
@@ -142,7 +143,7 @@ public class ActivationRange
|
|
*/
|
|
private static void activateChunkEntities(Chunk chunk)
|
|
{
|
|
- for ( EntitySlice slice : chunk.entitySlices )
|
|
+ for ( List<Entity> slice : chunk.entitySlices )
|
|
{
|
|
for ( Entity entity : (Collection<Entity>) slice )
|
|
{
|
|
--
|
|
2.20.1
|
|
|