mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
45 lines
2.5 KiB
Diff
45 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Mon, 29 Mar 2021 09:07:25 +0200
|
|
Subject: [PATCH] Make sure to remove correct TE during TE tick
|
|
|
|
This looks like it can cause premature TE removal.
|
|
|
|
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 {
|
|
//this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
|
// Paper - prevent double chunk lookups
|
|
LevelChunk chunk; if ((chunk = this.getChunkIfLoaded(tileentity.getBlockPos())) != null) { // inlined contents of this.isLoaded(BlockPosition). Reuse the returned chunk instead of looking it up again
|
|
- chunk.removeBlockEntity(tileentity.getBlockPos());
|
|
+ chunk.removeTileEntity(tileentity.getBlockPos(), tileentity); // Paper - remove correct TE
|
|
}
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
@@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess {
|
|
|
|
@Override
|
|
public void removeBlockEntity(BlockPos pos) {
|
|
+ // Paper start - remove correct TE
|
|
+ removeTileEntity(pos, null);
|
|
+ }
|
|
+ public void removeTileEntity(BlockPos blockposition, BlockEntity match) {
|
|
+ // Paper end
|
|
if (this.loaded || this.world.isClientSide()) {
|
|
- BlockEntity tileentity = (BlockEntity) this.blockEntities.remove(pos);
|
|
+ // Paper start
|
|
+ BlockEntity tileentity = (BlockEntity) this.blockEntities.get(blockposition);
|
|
|
|
- if (tileentity != null) {
|
|
+ if (tileentity != null && (match == null || match == tileentity)) {
|
|
+ this.blockEntities.remove(blockposition);
|
|
+ // Paper end
|
|
tileentity.setRemoved();
|
|
}
|
|
}
|