From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld Date: Thu, 3 Mar 2016 02:39:54 -0600 Subject: [PATCH] Change implementation of (tile)entity removal list use sets for faster removal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl } } // Spigot End - this.blockEntitiesToUnload.addAll(chunk.getBlockEntities().values()); + this.tileEntityListUnload.addAll(chunk.getBlockEntities().values()); List[] aentityslice = chunk.getEntitySlices(); // Spigot int i = aentityslice.length; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public final List blockEntityList = Lists.newArrayList(); public final List tickableBlockEntities = Lists.newArrayList(); protected final List pendingBlockEntities = Lists.newArrayList(); - protected final List blockEntitiesToUnload = Lists.newArrayList(); + protected final java.util.Set tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); public final Thread thread; private final boolean isDebug; private int skyDarken; @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { gameprofilerfiller.push("blockEntities"); timings.tileEntityTick.startTiming(); // Spigot - if (!this.blockEntitiesToUnload.isEmpty()) { - this.tickableBlockEntities.removeAll(this.blockEntitiesToUnload); - this.blockEntityList.removeAll(this.blockEntitiesToUnload); - this.blockEntitiesToUnload.clear(); + if (!this.tileEntityListUnload.isEmpty()) { + this.tickableBlockEntities.removeAll(this.tileEntityListUnload); + this.blockEntityList.removeAll(this.tileEntityListUnload); + this.tileEntityListUnload.clear(); } this.updatingBlockEntities = true;