3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 19:40:07 +01:00
Paper/patches/removed/1.17/0698-Make-sure-to-remove-correct-TE-during-TE-tick.patch

48 Zeilen
2.5 KiB
Diff

2021-06-11 14:02:28 +02:00
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.
2021-06-15 04:59:31 +02:00
1.17: doesnt apply anymore?
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index b89cefc8890774dbc64fd6bddeb038d2ee36d485..4523bc1f49e7be248a47eeb599fa7b6550dbb08d 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -895,7 +895,7 @@ 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 9b76dc15417eef420804e5184a6d684e1137a746..a15c08be3e1bd0e7934175db6ae0684bbb05e249 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -818,10 +818,18 @@ 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();
}
}