@@ -49,7 +49,24 @@ export function openUI(player: Player, block: Block): void {
4949 for ( const stateName of stateNameList ) {
5050 const validVals = getStateValidValues ( stateName ) ;
5151 const selVal = validVals [ r . formValues [ i ++ + 2 ] as number ] ;
52- newStateObj [ stateName ] = selVal ;
52+ // BUG:
53+ //
54+ // in some cases where there are two property names referring to
55+ // the same thing, like 'cardinal_direction' and 'direction' on doors,
56+ // if you set one property but leave the other one unchanged,
57+ // whether BlockPermutation.resolve will choose the correct changed
58+ // property is undefined. internally, BlockPermutation.resolve might be
59+ // preferring the most-recently set key, or the last key letter
60+ // on the alphabet, but we dont know that since it's not documented.
61+ //
62+ // we also can't just blindly rely on this, as what if the player
63+ // changed a property but reverted it back to the previous value.
64+ // ideally, we must prefer the last property that the player has set,
65+ // but unfortunately it's not doable. though checking whether the property
66+ // differs from the current one has to be the most natural workaround.
67+ //
68+ if ( selVal != currStates [ stateName ] )
69+ newStateObj [ stateName ] = selVal ;
5370 }
5471
5572 delete newStateObj [ 'waterlogged' ] ; // temporary
0 commit comments