structure_block's block state must be set using {NBT data} instead of typical [block state]
I was trying to run the following command to set a structure block in the "LOAD" state, however it failed. Here is the basic command I tried:
/setblock ~ ~ ~ minecraft:structure_block[mode=load]{} destroy
I eventually found that this command achieved my goal:
/setblock ~ ~ ~ minecraft:structure_block[]\{mode:"LOAD"} destroy
The block state doesn't matter, it fails when any block state is specified in brackets '[' & ']', and defaults to the "DATA" block state.
The NBT data sets the block state. Is this inconsistent structure is intended?
These issues were reported as ~duplicates in older versions:
Linked issues
is duplicated by 1
Comments 3
Ok, so, a small update, this is no longer the case when ONLY setting block states; once you provide NBT, it'll use data mode, unless the mode NBT is provided.
This is really just a side effect of MC-114394 - the NBT is processed after the block state, and if it's empty, it will use the default mode, which is data. This is consistent with eg. zombies always defaulting to adults if a tag is provided, although I don't know if Mojang has ever stated that this defaulting is intended.
Confirmed for 1.17.1.