Minecraft – How to make a piston block swapper that isn’t flush with a wall

minecraft-java-editionminecraft-redstone

I'm trying to create a skeleton farm that can double as an xp grinder or an automatic mob killer. My plan to do this, is to put a hopper and then a stone block on top where the skeletons will fall, and then swap that stone block with a magma block on the push of a lever, so that the skeletons start to take automatic damage as soon as they land on the block.

However, all of the designs I've found so far are for flush designs, ones that remove a block from a wall/ceiling or floor and then push in a new block. I don't want this, all I need is two pistons that extend and retract at the correct times to push in the magma block and retract the stone block, or vice versa. The problem is, I don't understand how the redstone timings work well enough.

Here's my current set-up:

enter image description here
enter image description here
enter image description here

The left repeater is at 2 ticks, the right repeater at 4 ticks. This works correctly one way, as the left piston retracts before the right piston extends, but then once I turn the lever off, I want the right piston to retract before the left piston extends, but the left piston always activates first, because the repeater is set to 2 ticks.

How can I fix this so that the pistons activate at the correct times?

Best Answer

This seems to work, tested it with skeletons. It uses a button, but works the same

Tutorial on Youtube: Note: I did not make this redstone and i did not make this video.