I'm trying to create a function that will generate a door, with random material, orientation and hinge placement. I have tackled the RNG part already, but cannot find a way to incrementally build the door so that I don't have to manually write down all of the possible combinations (aka 96 carefully-written commands).
I'm currently trying to achieve the following sequence:
- Roll the RNG to select the material for the next command
fill ~ ~ ~ ~ ~1 ~ minecraft:<?>_door replace
<set half = upper at ~ ~1 ~>
- Roll for orientation
<set facing = <?> at ~ ~ ~>,
<set facing = <?> at ~ ~1 ~>
- Roll for hinge placement
<set hinge = <?> at ~ ~ ~>,
<set hinge = <?> at ~ ~1 ~>
What I'm missing is the imaginary
<set state at> command. I've gathered that
setblock has some ability to update existing blocks but this seems to be both unreliable and restricted to tile entities, and requires to know what block exactly I'm replacing.
data is also explicitly restricted to tile entities.
How can I change the block state of an existing, unknown block?