How to generate a predetermined number of pulses?

Motivation: I have a grinder that spawns spiders which are then moved to a very small space. When they accumulate in big enough numbers, I pull a lever and let a piston crush them 11 times. Then I can kill them with one hit and harvest experience.

This becomes a problem once there are a lot of spiders – the game starts to lag and it is difficult (if not impossible) to have the precise number of hits.

Question: For some n, how do I create a circuit that generates n impulses before shutting down?
Or in this case, how do I make a piston hit exactly 11 times?

Answer

Lightweight version
It seems I overcomplicated things a bit on the first attempt, this version should be better and more compact, at least for smaller numbers (first example produces 4 pulses). It’s also possible to connect the “start” for another pulse straight from the second torch).

Improved version

For this setup to work with a high pulse count you will need to put repeaters every 15 blocks in the redstone line, and for each of those repeaters there will need to be extra ticks between all stone blocks. This exact setup will work for your 11 pulses (last 6 blocks of 11 shown):

11 pulses

Heavy version (no limit)
Basically an outer “zig-zag” circuit that will send a new pulse straight through the middle line each time it passes a stone block. I tested it with up to 11 pulses, and you can just extend it as much as needed. Obviously it gets quite clumsy with a large number of pulses.

Start button set up to send a single short pulse into the circuit

enter image description here

Attribution
Source : Link , Question Author : ver , Answer Author : Hex

Leave a Comment