This PR addresses two issues with Hidden Switches. Please refer to (or construct) the following:
Issue 1
Problem: The behavior of the levers is different depending on which side of the red block (with the sign) you click. If you click on the front (with the sign) or back (opposite the sign), all 3 levers flip and all 3 redstone lamps toggle. However if you click on the left side of the red block, then only the levers on the white and yellow blocks flip -- the lever on the green block doesn't flip nor does the redstone lamp next to the green block's lever toggle.
Analysis: The search for surrounding levers is based on the face of the block clicked, not the location of the sign.
Solution: I updated toggleSwitches to search around the orientation of the sign, not the face that was clicked.
Issue 2
Problem: Redstone surrounding the lever or button does not update. Clicking the red block toggles the lever on the green block but this does not toggle the redstone torch. Whereas, if you click the lever directly it does toggle the redstone torch. This behavior is also seen with other components (I tested redstone wire and repeaters but I suspect it applies generally).
Analysis: Since 1.13, myBlock.setBlockData(myBlock.getBlockData(), true) does not force an update of the surrounding redstone.
Solution: To force an update, I implemented a workaround that momentarily swaps the block material, which does cause an update to the surrounding redstone. While this is admittedly a hack, I have not experienced any problems with it. The placeholder block (dirt or stone) never appears, and these placeholders don't have interesting behavior. You can swap the levers for buttons in the sample structure for confirmation.
Note: I also tried the approach in ICUtil.java for this but that didn't work either.
This PR addresses two issues with Hidden Switches. Please refer to (or construct) the following:
Issue 1
Problem: The behavior of the levers is different depending on which side of the red block (with the sign) you click. If you click on the front (with the sign) or back (opposite the sign), all 3 levers flip and all 3 redstone lamps toggle. However if you click on the left side of the red block, then only the levers on the white and yellow blocks flip -- the lever on the green block doesn't flip nor does the redstone lamp next to the green block's lever toggle.
Analysis: The search for surrounding levers is based on the face of the block clicked, not the location of the sign.
Solution: I updated
toggleSwitches
to search around the orientation of the sign, not the face that was clicked.Issue 2
Problem: Redstone surrounding the lever or button does not update. Clicking the red block toggles the lever on the green block but this does not toggle the redstone torch. Whereas, if you click the lever directly it does toggle the redstone torch. This behavior is also seen with other components (I tested redstone wire and repeaters but I suspect it applies generally).
Analysis: Since 1.13,
myBlock.setBlockData(myBlock.getBlockData(), true)
does not force an update of the surrounding redstone.Solution: To force an update, I implemented a workaround that momentarily swaps the block material, which does cause an update to the surrounding redstone. While this is admittedly a hack, I have not experienced any problems with it. The placeholder block (dirt or stone) never appears, and these placeholders don't have interesting behavior. You can swap the levers for buttons in the sample structure for confirmation.
Note: I also tried the approach in ICUtil.java for this but that didn't work either.