Affects Version/s: Minecraft 1.14.2
Fix Version/s: None
Environment:I'm running on a Macbook Air for Java Edition 1.14.2
I'm having trouble trying to use the /setblock command with Command Blocks to switch back and forth between sloped rails and powered rails. I needed this to work to run a merry-go-round I was making.
What I expected to happen was when a redstone current passes through the command block programmed with the /setblock command, the command would run and I would get either a sloping regular rail or powered rail at the co-ordinates I set it to, alternating between them back and forth via hopper clock.
What actually happened was that when the current would pass through, the command blocks would not change the regular rail into a powered one, or conversely a powered rail into a regular one at that particular place.
To make sense of this, you'll need to do these things:
1. Make a 5-block long rail line, with a 1-block difference in elevation on either end, 1 block away from the middle. Be sure to get the co-ordinates of both slanted rails (they'll play a key part in what's to come!)
2. Set up a hopper clock nearby. Here's a link for an image reference on the hopper clock I was using: https://bugs.mojang.com/secure/attachment/179126/2018-08-07_14.34.30.png
3. Connect the hopper clock to 4 command blocks placed side by side with repeaters and redstone dust. On the end closest to the redstone block being pushed back and forth, place one redstone dust on one side, with a repeater facing towards the command blocks placed beside it (tick delay doesn't matter here).
4. In the first command block, type in the command: /setblock (insert co-ordinates of the slanted rail on one side) minecraft:rail[shape=ascending_(*insert direction here*)]. Repeat this command in the second command block next in the line of the redstone current, using the co-ordinates of the slanted rail on the other side, and entering the opposite direction of the first.
5. On the other side, using the command block beside the first one, type the command: /setblock (insert same co-ordinates the first command block is using) minecraft:powered_rail[shape=ascending_(*insert direction here*)]. Repeat second half of Step 4., using minecraft:powered_rail as the block to be placed with the /setblock command.
If the rail does not switch back and forth, then you have found the problem! Hopefully this might be enough to help you fix this to the best of your abilities, and thank you so much for taking the time to read this!