Minecraft – moving minecart once hopper has items, and then becomes empty

minecraft-java-edition

Here's a rough outline of what I want

Empty cart stays still under an empty hopper

Hopper gets x items in it, the cart stays still

Once the hopper has emptied all its items into the cart, the cart runs backwards and forwards along the track, putting its items into hoppers below it, once the hopper is empty, it stops again underneath the empty hopper

Is something like this currently possible? I have it at the moment that the cart always moves, except when the hopper has items, which works, but when the cart is empty the noise annoys me and the other people in the area.

I tried putting a detector rail underneath the hopper so I could tell when the cart is there, but that then powers the hopper so its items don't drop into the cart.

Best Answer

From your description it sounds like you are most concerned with testing the contents of a hopper that is filling a minecart (either a chest minecart or a hopper minecart) and performing an action based on its empty or full state. This is good because it is quite easy to test, as opposed to testing the contents of the cart itself.

Since you mention in a comment that you are basically building off of my previous design, but adding an automatic option to send the minecart instead of pressing a button, I'll show you how to modify it accordingly:

enter image description here

After adding a hopper above the cart, add a comparator which powers a redstone torch. This will turn on when the hopper empties. This signal then powers a rising edge detector circuit that consists of a dropper feeding another hopper, which in turn feeds back into the dropper. Place a single item in the dropper. A comparator tests the contents of the hopper, and a repeater feeds the signal into the powered rail. Whenever the feeding hopper empties, the rail powers and sends the cart along.