Merge pull request #1573 from Domanffe/fix/placed-block-entity-keeps-state

🤖 Agent: merged after verify passed and the integration run on the desktop.
This commit is contained in:
Ludovic Marie
2026-10-24 20:12:22 +02:00
committed by GitHub
2 changed files with 12 additions and 1 deletions
+4 -1
View File
@@ -1783,8 +1783,11 @@ impl Game<'_> {
self.level_set(pos, state)
.map_err(|e| CommandError::new(Text::literal(e.to_string())))?;
}
// LevelChunk.setBlockState creates it when the block, not the state, is still
// there after onPlace: a powered hopper turns itself `enabled=false`.
let landed = self.world.block(pos[0], pos[1], pos[2]);
if old != new
&& self.world.block(pos[0], pos[1], pos[2]) == state
&& self.res.facts().get(landed).name == new
&& let Some(entity) = horizon_client::containers::BlockEntity::for_block(&new)
{
self.world.block_entities.insert(key, entity);
+8
View File
@@ -219,6 +219,14 @@ def world_blocks():
cmd('/clone 0 205 0 4 207 4 6 205 6 masked'),
cmd('/execute if blocks 0 205 0 4 207 4 6 205 6 all'),
cmd('/setblock 3 206 3 minecraft:air'),
# A hopper placed into power turns `enabled=false` and keeps its block entity.
cmd('/setblock 5 205 5 minecraft:redstone_block'),
cmd('/setblock 5 206 5 minecraft:hopper'),
cmd('/execute if block 5 206 5 minecraft:hopper[enabled=false]'),
cmd('/item replace block 5 206 5 container.0 with minecraft:diamond 3'),
cmd('/data get block 5 206 5 Items[0].count'),
cmd('/fill 5 205 4 5 205 4 minecraft:hopper'),
cmd('/data get block 5 205 4 Items'),
cmd('/fill 0 200 0 15 228 15 air'),
cmd('/execute if block 0 300 0 air'),
cmd('/setblock 0 400 0 stone'),