[GH-ISSUE #7880] No isValidBlockState check: a block entity of the wrong type stays when a block is set (sculk and creaking heart entries linger) #7519

Open
opened 2026-11-03 07:09:41 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @arismoko on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7880

🤖 Filed by Aria's agent swarm, Dyna, not by Aria.

Horizon has no counterpart to vanilla's BlockEntity.isValidBlockState check when a block is set. A block entity left at a position whose type doesn't fit the new block stays there. Vanilla drops it and creates the new block's own entity.

Vanilla 26.3

LevelChunk.setBlockState (LevelChunk.java:329-334): when the new state has a block entity, vanilla gets the one at the position. If !blockEntity.isValidBlockState(state) (BlockEntity.java:64-66, type.isValid(state)), it logs "Found mismatched block entity", removes it, and calls newBlock.newBlockEntity(pos, state). Only an entity whose type fits the new state is kept, and it gets setBlockState.

Horizon

  • No such check: nothing compares a kept BlockEntity variant with the block now at its position.
  • One known way to get a mismatch: game/spill.rs remove_entity deliberately leaves BlockEntity::Sculk and BlockEntity::CreakingHeart entries in world.block_entities ("Sculk blocks and creaking hearts notice their removal on their own tick"). Until that tick, the position holds a sculk or creaking heart entity under whatever block replaced it. A same-tick write of a block with a block entity, such as a chest or furnace over a sculk sensor, shrieker or creaking heart, therefore finds an entity of the wrong type already there.
  • Where it shows up: any path that treats "an entity is present" as "keep it" ends up with a block that has the wrong entity, or none of its own.

Suggested fix

Give block entities a type-validity check, the variant against the block name the way BlockEntityType.isValid checks the block set. Apply it where a block with a block entity is placed: drop a mismatched entity and create the block's own, as LevelChunk.setBlockState does.

Check

Found by reading the code against the decompiled 26.3 sources while reviewing a fork change. It hasn't been reproduced in game yet. To reproduce, place a chest over a sculk sensor in the same tick it is removed, for example with /setblock ~ ~ ~ chest replace on a sculk sensor, then open it.

Originally created by @arismoko on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7880 > 🤖 Filed by Aria's agent swarm, Dyna, not by Aria. Horizon has no counterpart to vanilla's `BlockEntity.isValidBlockState` check when a block is set. A block entity left at a position whose type doesn't fit the new block stays there. Vanilla drops it and creates the new block's own entity. ## Vanilla 26.3 `LevelChunk.setBlockState` (`LevelChunk.java:329-334`): when the new state has a block entity, vanilla gets the one at the position. If `!blockEntity.isValidBlockState(state)` (`BlockEntity.java:64-66`, `type.isValid(state)`), it logs "Found mismatched block entity", removes it, and calls `newBlock.newBlockEntity(pos, state)`. Only an entity whose type fits the new state is kept, and it gets `setBlockState`. ## Horizon - **No such check:** nothing compares a kept `BlockEntity` variant with the block now at its position. - **One known way to get a mismatch:** `game/spill.rs` `remove_entity` deliberately leaves `BlockEntity::Sculk` and `BlockEntity::CreakingHeart` entries in `world.block_entities` ("Sculk blocks and creaking hearts notice their removal on their own tick"). Until that tick, the position holds a sculk or creaking heart entity under whatever block replaced it. A same-tick write of a block with a block entity, such as a chest or furnace over a sculk sensor, shrieker or creaking heart, therefore finds an entity of the wrong type already there. - **Where it shows up:** any path that treats "an entity is present" as "keep it" ends up with a block that has the wrong entity, or none of its own. ## Suggested fix Give block entities a type-validity check, the variant against the block name the way `BlockEntityType.isValid` checks the block set. Apply it where a block with a block entity is placed: drop a mismatched entity and create the block's own, as `LevelChunk.setBlockState` does. ## Check Found by reading the code against the decompiled 26.3 sources while reviewing a fork change. It hasn't been reproduced in game yet. To reproduce, place a chest over a sculk sensor in the same tick it is removed, for example with `/setblock ~ ~ ~ chest replace` on a sculk sensor, then open it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7519
No description provided.