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 1.17: no more unload lists diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index 6c6098731752d61b5241710b075d4ffe3826daac..89472b6e8f38921db50440d0213e40ac893892f1 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1122,7 +1122,7 @@ 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 e25666328dbf433b8358f2637d93b4128034bbaa..7b4475807cca0e92ea9ae6ea49a82a8634cc0ff5 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -89,7 +89,7 @@ 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; @@ -697,10 +697,10 @@ 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;