-
Bug
-
Resolution: Unresolved
-
None
-
1.20.6, 1.21 Pre-Release 3, 1.21 Release Candidate 1, 1.21
-
None
-
Confirmed
-
Commands, Data Packs, Items
-
Normal
-
Platform
Block states specified as a block_state component for items are not taken into account when checking if a block can be placed.
Steps to reproduce:
- Run
/give @s oak_slab[block_state={type:"top"}] 10 - Place one slab on top of a block
- Place another slab on top of that same block
Observed result:
You can keep placing them in the same block, with one disappearing from the stack each time (and no change to the block itself, which remains top slab only). If you place the top slab in the same block as an existing bottom slab, the bottom slab disappears.
Expected result:
You are prevented from placing more top slabs where they already exist. If you place the top slab in the same block as an existing bottom slab, the block becomes a double slab.
This would suggest that the game doesn't take into account the block state component specified on the item when checking if it can be placed.
Something similar occurs with vines, where if you place a 'south vine'
/give @s vine[block_state={south:"true"}]
on a non-south face of a block, it will appear on both the face you clicked, and the south face. I would expect only the south face to be added in this scenario.
I believe the logic is currently as follows:
- Check if the block could normally be placed.
- Apply block placement logic
- Override block states specified in item's block_state component.
This works fine for most blocks. However, for blocks where the placement logic doesn't necessarily create a new block, but instead alters the block state of an existing block (e.g. setting 'type' of a slab to 'full' when adding a top slab to an existing bottom slab) this can cause issues.
For vines,
- the game checks if it could be placed on the face you clicked, then
- the placement code creates a new vine block / modifies an existing one to set e.g. 'east' to true (or whichever side you placed on), and then
- the block_state component logic overrides the block state with the specified values (also setting 'south' to true, if it wasn't already).
For slabs, there aren't separate 'top: true' and 'bottom: true' states, instead there is a 'type' state. Therefore, when placing a slab in the bottom half of a block where the top slab already exists, it will
- check if a regular slab could be placed,
- the placement code will modify the block state to set 'type: double'.
- The block state component code will then override the 'type' to be 'top', therefore removing the bottom half of the slab.
I could understand if this was desired behaviour, but I think it would make more sense if in such cases, both
- The block state were taken into account when determining if it can be placed (e.g. shouldn't be able to place a top slab in a block where a top slab already exists), and
- the block states should be combined intelligently upon successful placement (e.g. placing a top slab onto an existing bottom slab should combine to form a double slab).
For vines, I would have expected that when placing it would only add the sides specified in the block_state components if one exists (e.g. south), without setting the side you clicked on as well. (however you could achieve this affect currently by setting all other sides to false if truly desired)
Presumably affects any versions since items could have a specified block state for placing.
- is duplicated by
-
MC-273935 Issues placing specific blockstates into other blockstates using items
- Resolved