PaperMC/patches/server-remapped/Change-implementation-of-tile-entity-removal-list.patch
MiniDigger | Martin 95d25d98e8 Move patches around
2021-06-11 14:02:28 +02:00

48 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
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<BlockEntity> blockEntityList = Lists.newArrayList();
public final List<BlockEntity> tickableBlockEntities = Lists.newArrayList();
protected final List<BlockEntity> pendingBlockEntities = Lists.newArrayList();
- protected final List<BlockEntity> blockEntitiesToUnload = Lists.newArrayList();
+ protected final java.util.Set<BlockEntity> 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;