mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
93 lines
5.8 KiB
Diff
93 lines
5.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Wed, 13 Apr 2016 00:25:28 -0400
|
|
Subject: [PATCH] Remove unused World Tile Entity List
|
|
|
|
Massive hit to performance and it is completely unnecessary.
|
|
|
|
Removed during 1.17 update - no longer logically applies
|
|
not true? blockEntityTickers and pendingBlockEntityTickers have similar logic applied to them
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index f7eddb39985072afeb79ec0cbfc084d7e84638e6..bb99d9fe5e274318d8480a6de2c45b0a57351f77 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -1715,7 +1715,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
|
}
|
|
|
|
bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size()));
|
|
- bufferedwriter.write(String.format("block_entities: %d\n", this.blockEntityList.size()));
|
|
+ bufferedwriter.write(String.format("block_entities: %d\n", this.tickableBlockEntities.size())); // Paper - remove unused list
|
|
bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTicks().size()));
|
|
bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getLiquidTicks().size()));
|
|
bufferedwriter.write("distance_manager: " + playerchunkmap.getDistanceManager().getDebugStatus() + "\n");
|
|
@@ -1854,7 +1854,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
|
|
|
private void dumpBlockEntities(Writer writer) throws IOException {
|
|
CsvOutput csvwriter = CsvOutput.builder().addColumn("x").addColumn("y").addColumn("z").addColumn("type").build(writer);
|
|
- Iterator iterator = this.blockEntityList.iterator();
|
|
+ Iterator iterator = this.tickableBlockEntities.iterator(); // Paper - remove unused list
|
|
|
|
while (iterator.hasNext()) {
|
|
BlockEntity tileentity = (BlockEntity) iterator.next();
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 89a6a0b4235cfcc1d3ad68ff59a21fa60df4508f..8f0fec38b482465285057d3fd27d456cf036f2fd 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -91,7 +91,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
public static final ResourceKey<Level> NETHER = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("the_nether"));
|
|
public static final ResourceKey<Level> END = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("the_end"));
|
|
private static final Direction[] DIRECTIONS = Direction.values();
|
|
- public final List<BlockEntity> blockEntityList = Lists.newArrayList();
|
|
+ //public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
|
|
public final List<BlockEntity> tickableBlockEntities = Lists.newArrayList();
|
|
protected final List<BlockEntity> pendingBlockEntities = Lists.newArrayList();
|
|
protected final java.util.Set<BlockEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
|
|
@@ -683,9 +683,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
}, blockEntity::getBlockPos});
|
|
}
|
|
|
|
- boolean flag = this.blockEntityList.add(blockEntity);
|
|
+ boolean flag = true; // Paper - remove unused list
|
|
|
|
- if (flag && blockEntity instanceof TickableBlockEntity) {
|
|
+ if (flag && blockEntity instanceof TickableBlockEntity && !this.tickableBlockEntities.contains(blockEntity)) { // Paper
|
|
this.tickableBlockEntities.add(blockEntity);
|
|
}
|
|
|
|
@@ -721,7 +721,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
timings.tileEntityTick.startTiming(); // Spigot
|
|
if (!this.tileEntityListUnload.isEmpty()) {
|
|
this.tickableBlockEntities.removeAll(this.tileEntityListUnload);
|
|
- this.blockEntityList.removeAll(this.tileEntityListUnload);
|
|
+ //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list
|
|
this.tileEntityListUnload.clear();
|
|
}
|
|
|
|
@@ -781,7 +781,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
tilesThisCycle--;
|
|
this.tickableBlockEntities.remove(tileTickPosition--);
|
|
// Spigot end
|
|
- this.blockEntityList.remove(tileentity);
|
|
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
|
if (this.hasChunkAt(tileentity.getBlockPos())) {
|
|
this.getChunkAt(tileentity.getBlockPos()).removeBlockEntity(tileentity.getBlockPos());
|
|
}
|
|
@@ -811,7 +811,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
this.sendBlockUpdated(tileentity1.getBlockPos(), iblockdata, iblockdata, 3);
|
|
// CraftBukkit start
|
|
// From above, don't screw this up - SPIGOT-1746
|
|
- if (!this.blockEntityList.contains(tileentity1)) {
|
|
+ if (true) { // Paper - remove unused list
|
|
this.addBlockEntity(tileentity1);
|
|
}
|
|
// CraftBukkit end
|
|
@@ -957,7 +957,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
} else {
|
|
if (tileentity != null) {
|
|
this.pendingBlockEntities.remove(tileentity);
|
|
- this.blockEntityList.remove(tileentity);
|
|
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
|
this.tickableBlockEntities.remove(tileentity);
|
|
}
|
|
|