mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-09-18 21:33:01 +00:00
142 lines
7.1 KiB
Diff
142 lines
7.1 KiB
Diff
From 8d4adb866c19146501e6cb5e5255c101d697d84c 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/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
|
index 42e0a70bf..55a062af2 100644
|
|
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
|
@@ -636,11 +636,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
chunk.setLoaded(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()) {
|
|
@@ -866,7 +866,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
|
|
// CraftBukkit - decompile error
|
|
csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
|
- return Stream.of(chunk.getEntitySlices()).mapToInt(EntitySlice::size).sum();
|
|
+ return Stream.of(chunk.getEntitySlices()).mapToInt(List::size).sum(); // Spigot
|
|
}).orElse(0), optional1.map((chunk) -> {
|
|
return chunk.getTileEntities().size();
|
|
}).orElse(0));
|
|
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
index 72f69d270..1eeb9b9ca 100644
|
|
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
@@ -1110,11 +1110,11 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
}
|
|
// 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/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
|
index de2521e11..4561cf94f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
|
@@ -69,7 +69,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<StructureGenerator<?>, StructureStart<?>> l;
|
|
private final Map<StructureGenerator<?>, LongSet> m;
|
|
private final ShortList[] n;
|
|
@@ -98,7 +98,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 = (WorldServer) world; // CraftBukkit - type
|
|
this.loc = chunkcoordintpair;
|
|
this.i = chunkconverter;
|
|
@@ -114,7 +114,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 = biomestorage;
|
|
@@ -601,8 +601,8 @@ public class Chunk implements IChunkAccess {
|
|
j = MathHelper.clamp(j, 0, this.entitySlices.length - 1);
|
|
|
|
for (int k = i; k <= j; ++k) {
|
|
- EntitySlice<Entity> entityslice = this.entitySlices[k];
|
|
- List<Entity> list1 = entityslice.a();
|
|
+ List<Entity> entityslice = this.entitySlices[k]; // Spigot
|
|
+ List<Entity> list1 = entityslice; // Spigot
|
|
int l = list1.size();
|
|
|
|
for (int i1 = 0; i1 < l; ++i1) {
|
|
@@ -640,7 +640,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()) {
|
|
T entity = (T) iterator.next(); // CraftBukkit - decompile error
|
|
@@ -662,12 +662,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);
|
|
}
|
|
}
|
|
@@ -706,7 +706,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 705d666d7..44a7323ff 100644
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
@@ -156,7 +156,7 @@ public class ActivationRange
|
|
*/
|
|
private static void activateChunkEntities(Chunk chunk)
|
|
{
|
|
- for ( net.minecraft.util.EntitySlice slice : chunk.entitySlices )
|
|
+ for ( java.util.List<Entity> slice : chunk.entitySlices )
|
|
{
|
|
for ( Entity entity : (Collection<Entity>) slice )
|
|
{
|
|
--
|
|
2.25.1
|
|
|