Skip to content

Commit

Permalink
Remove useless patched in blockEntity checks (#1369)
Browse files Browse the repository at this point in the history
  • Loading branch information
TelepathicGrunt authored Aug 3, 2024
1 parent 71de6db commit c7823b9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@
}

public BlockBehaviour.Properties properties() {
@@ -159,7 +_,7 @@
}

protected void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) {
- if (p_60515_.hasBlockEntity() && !p_60515_.is(p_60518_.getBlock())) {
+ if (p_60515_.hasBlockEntity() && (!p_60515_.is(p_60518_.getBlock()) || !p_60518_.hasBlockEntity())) {
p_60516_.removeBlockEntity(p_60517_);
}
}
@@ -168,7 +_,7 @@
if (!p_311951_.isAir() && p_312925_.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) {
Block block = p_311951_.getBlock();
Expand Down
10 changes: 1 addition & 9 deletions patches/net/minecraft/world/level/chunk/LevelChunk.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@
for (Entry<Heightmap.Types, Heightmap> entry : p_196851_.getHeightmaps()) {
if (ChunkStatus.FULL.heightmapsAfter().contains(entry.getKey())) {
this.setHeightmap(entry.getKey(), entry.getValue().getRawData());
@@ -271,14 +_,14 @@
boolean flag2 = blockstate.hasBlockEntity();
if (!this.level.isClientSide) {
blockstate.onRemove(this.level, p_62865_, p_62866_, p_62867_);
- } else if (!blockstate.is(block) && flag2) {
+ } else if ((!blockstate.is(block) || !p_62866_.hasBlockEntity()) && flag2) {
this.removeBlockEntity(p_62865_);
}

@@ -278,7 +_,7 @@
if (!levelchunksection.getBlockState(j, k, l).is(block)) {
return null;
} else {
Expand Down

0 comments on commit c7823b9

Please sign in to comment.