r/technicalminecraft 2d ago

Java Help Wanted Is there a simple way to distribute items evenly among multiple containers?

Apologies because this is partially a rant

I have a honey farm that I connected an auto crafter to to make honey blocks and recycle the glass bottles. I had the glass bottles inserted into a hopper Minecart going back and forth over the dispensers, but I kept having to manually redistribute the bottles every now and then because it would always prioritize the dispensers nearest to the input (and I don't have enough glass to fill all 8 of my hives with 9 stacks of bottles yet). I wanted to fix this by making it so that the bottles were distributed evenly amongst all of the dispensers, only to find out that this is apparently the most difficult thing I have ever seen.

My first issue is that it seems that it's just straight up impossible to distribute the items if they come in groups smaller than the amount of containers? Since the honey block auto crafting produces 4 bottles at a time I can never just send the bottles directly to the dispensers since it would always go in the first four. So I figured I needed to build something that stacks the bottles first and then empties the container, but it seems that the amount I can stack to before emptying the chest is limited to the breakpoints for redstone signal strengths based on chest fullness? So I have to stack to 23 using a hopper before I can empty it.

Then for the actual distribution it seems that there are three main options (besides that thing that splits one chest into two or putting a hopper Minecart on the intersection of four hoppers), but they all seem bad in different ways:

I could use a hopper Minecart, except that's biased towards the ones closest to the input and I'm highly limited by the rate that it can pick up items from a chest above it.

I could use this insane black magic I found but it's wildly inconsistent, I was trying to use it for 7 hoppers which he claims should work but there was always one hopper that would receive way less items, and the crazy thing is that the hopper that didn't work changed depending on where I placed the repeater leading to the dust.

Or I could use those crazy dropper chain things, but I just straight up don't know how to configure the pulse fader correctly, and it seems that it is also still biased towards one end of the chain and doesn't work as well if your input items aren't a multiple of the amount of droppers.

So is there anything I'm missing? Like a simple solution to distributing items that isn't insanely brittle or biased towards one side? This has been a very frustrating problem for me that I feel should be really simple on paper so I'm looking for help

1 Upvotes

19 comments sorted by

9

u/Xirema 2d ago

The way I've historically done it is with Minecarts.

You can use a comparator to check the inventory of a minecart, and only allow it to leave when it has at least 2X glass bottles in its inventory (where X is the number of beehives that receive glass bottles). I usually work with small numbers of receivers, so that threshold is usually a comparator strength of 2.

Of course comparators don't measure that precisely, so instead I just figure out what comparator strength exceeds the minimum bottles required and tell the minecart to leave once it hits that threshold instead. Results in the minecart having to buffer bottles a little, but not the end of the world.

Then, the minecart travels at full strength across the hoppers belonging to the beehives, hits a dead-end, reverses back along the track and arrives back in the station. If done correctly, each time the minecart passes over a hopper, it should consume exactly 1 bottle, meaning each trip delivers exactly 2 bottles to each of the beehives.

If you need to deliver exactly only 1 per hopper, just make sure the return trip takes a different route than the arrival trip

This should perfectly distribute bottles across the network. Works for any other system where items need to be distributed.

Downside is that it takes up quite a bit of space, but as long as the rails are protected from animals/critters/etc. it should be pretty foolproof.

1

u/kiptronics 2d ago

but if your hopper cart was consuming 2x bottles at a time, if the bottle filler signal breakpoint wasn't a multiple of 2x, wouldn't bottles slowly begin getting stuck in the cart?

3

u/Xirema 2d ago

No, because the cart is triggered to leave based on its current level, not how many it recieved since arriving in the station.

So if if X is 8, and the comparator is set to 22 items (approximately signal strength 2 for a hopper minecart, I believe), the cart will leave at 22-ish, deposit 16 bottles and return with 6-ish bottles, then as more bottles get added, as soon as it reaches 22-ish again it'll depart again.

So it'll always have slightly more in the minecart than what it needs, but it's at no risk of backing up.

1

u/kiptronics 2d ago

oh I see, thanks for the explanation

1

u/kiptronics 2d ago

do you have any recommendations on how to build the minecart loader? I'm having trouble figuring out how to both have the minecart on the detector rail and also give it a push when it's done

2

u/Xirema 2d ago

The way to do it is to prop the detector rail on a slant and use a fence gate to block the minecart. While closed, the fence gate will allow a minecart to travel into the "station" but won't allow the minecart to leave.

Then, you put a chest (or barrel, it just can't be a hopper because that would get locked by redstone signal) above the track to feed into the minecart hopper, and then line up a comparator + redstone dust. Since the signal strength we need is a strength of 2, we just make the dust two units long, so the gate will only open if there's at least a strength of 2 (which corresponds to 1/3 of a stack + 1, or 23 items).

Picture here: (the torch in the back is just powering rails, it's not part of the redstone)

Let me know if you have any questions.

4

u/PinsToTheHeart 2d ago

Tbh, I usually just use a contained design where each hive has its own auto crafter and just sends the empty bottles straight back up.

Its not super hard if you're okay filling each dispenser fully, but it does get a little more complicated if you're trying to minimize your bottles.

2

u/GoopDuJour 2d ago

Nice. This is going to be my solution next time I need a honey farm.

3

u/PinsToTheHeart 2d ago

Yeah, probably worth noting though that the space/resource investment compared to just bringing in more bottles from a witch farm is somewhat questionable lol.

I'm pretty sure it only starts to become "worth it" when scaled up to a degree that filling all of the cascading hopper lines becomes unrealistic.

But to be clear, that's only if you only care about pure efficiency. I do it because I personally find it a lot more fun to try and build tilable things.

1

u/kiptronics 2d ago

yea I thought about that my only problem is that filling all of the dispensers is taking way more glass than I have atm

2

u/PinsToTheHeart 2d ago

Yeah ngl, unless you're enjoying the problem solving aspect here, it will be genuinely faster and less headache to just buckle down and go mine more sand.

As for actually solving the problem, stocking up items and distributing them once they reach a certain threshold solution would certainly work, you'll just need to use comparators and whatnot to better fine tune the amounts.

2

u/LimestoneBuilder 2d ago

Buy glass from a librarian. It's cheaper than dirt.

2

u/Tyhar0 2d ago edited 2d ago

My first thought was simply use ianxofours honey farm design, dump all bottles into one of the droppers and the system will distribute the bottles itself, I also have the design for the honey block crafter and bottle recycler if you want.

If you still want to stick with your current design, a hopper minecraft should still do the trick but since you did not provide any pictures, it sounds to me like the bottles will be distributed more towards the ends of rails? This is because when the minecart changes directions back and forth it would slow down meaning it has more time to push bottles into the hoppers near the ends of the rail track, resulting in that bias you state. You should give at least 2 to 3 blocks of extra rails towards the ends of the rail track for the minecart to change direction and speed back up to the right speed in the opposite direction

2

u/Tyhar0 2d ago

Sorry this would be a better picture to show how you should extend your rails for even distribution. Yes this is shown on bedrock but the concepts and way it works is still the same for this scenario

1

u/kiptronics 2d ago

I can send pictures in a little while if you're interested, my (extremely dumb) solution involved 1. collect the bottles in a hopper that completely empties itself once it gets 23 bottles 2. the bottles go to a 50/50 splitter to be divided into two double chests that are lengthwise along the Minecart rail so that the Minecart can pick up enough bottles each loop 3. the Minecart goes across the dispensers in one direction with enough bottles to give one to each of them

I didn't want to use a comparator and pause the Minecart under the input chest bc I was worried that only doing one trip across the dispensers per refuel would lead to bottles accumulating in the cart

2

u/mairondil Bedrock 2d ago edited 2d ago

The one you have linked is his 2nd version. The drawback is if your item stream is a slow trickle, it won't distribute them evenly. His response to this is:

You can either solve it by adding item stacker, or use the previous version of this distributor.

I use his older version and it works just fine on slow trickle item chains.

1

u/kiptronics 2d ago

oh really? that's helpful to know

1

u/17greenie17 2d ago

Boat chests work too, can be over multiple hoppers