Commands: a placed block keeps its block entity when a neighbour update changes its state
/setblock created the block entity only when the state that landed matched the
requested state exactly. HopperBlock.onPlace sets enabled=false while the block is
being placed, so a hopper put into power had no inventory: /data get block answered
"not a block entity", items dropped into it stayed item entities, and
/setblock hopper{Items:[...]} dropped the NBT as well.
Compare the block at the position with the block that was placed, the way vanilla
does when it creates the entity from the placed state, before the neighbour updates
run.
Fixes #1506.
Co-Authored-By: Hermes Agent (Nous Research) <noreply@nousresearch.com>
This commit is contained in:
@@ -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 arrives `enabled=false` and must keep its block entity.
|
||||
cmd('/setblock 5 205 5 minecraft:redstone_block'),
|
||||
cmd('/setblock 5 206 5 minecraft:hopper[facing=down]'),
|
||||
cmd('/data get block 5 206 5 Items'),
|
||||
cmd('/item replace block 5 206 5 container.0 with minecraft:diamond 3'),
|
||||
cmd('/data get block 5 206 5 Items[0].count'),
|
||||
cmd('/setblock 5 206 5 minecraft:air'),
|
||||
cmd('/setblock 5 205 5 minecraft:air'),
|
||||
cmd('/fill 0 200 0 15 228 15 air'),
|
||||
cmd('/execute if block 0 300 0 air'),
|
||||
cmd('/setblock 0 400 0 stone'),
|
||||
|
||||
Reference in New Issue
Block a user