mirror of https://github.com/YatopiaMC/Yatopia.git
38 lines
2.2 KiB
Diff
38 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Paul Sauve <paul@technove.co>
|
|
Date: Sat, 13 Mar 2021 10:19:15 -0600
|
|
Subject: [PATCH] Skip copying unloading tile entities
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index 9d6ddfec93f49f80fdc88248fc5aaf5ad6ee48da..bdb0e46d9196f4ac164ed09fd9d01db60aaab401 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -44,7 +44,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
|
//public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
|
|
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
|
|
protected final List<TileEntity> tileEntityListPending = Lists.newArrayList();
|
|
- protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
|
|
+ protected final java.util.Set<TileEntity> tileEntityListUnload = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Airplane - use set with faster contains
|
|
public final Thread serverThread;
|
|
private final boolean debugWorld;
|
|
private int d;
|
|
@@ -969,12 +969,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
|
gameprofilerfiller.enter("blockEntities");
|
|
timings.tileEntityTick.startTiming(); // Spigot
|
|
if (!this.tileEntityListUnload.isEmpty()) {
|
|
+ // Airplane start - we just use the identitymap as the basis for the unload set now instead of copying
|
|
+ /*
|
|
// Paper start - Use alternate implementation with faster contains
|
|
java.util.Set<TileEntity> toRemove = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>());
|
|
toRemove.addAll(tileEntityListUnload);
|
|
this.tileEntityListTick.removeAll(toRemove);
|
|
// Paper end
|
|
//this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list
|
|
+ */
|
|
+ this.tileEntityListTick.removeAll(this.tileEntityListUnload);
|
|
+ // Airplane end
|
|
this.tileEntityListUnload.clear();
|
|
}
|
|
|