Why I don't like Barrels, explained in Python

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Greyed

New Member
Jul 29, 2019
445
0
0
In several different topics people have applauded the barrels + tubes sorting method, presenting it as a solution to a problem, and then boggled at my dislike for that method. I have struggled to find a way to explain why I dislike it and recently some serendipity while watching DW20 current videos gave me a way.

In his first base he has a sorting system which uses traditional(ish) chests whereas in his new base he uses the barrels. Notice in his first base he is able to sort (almost) everything into ~15 chests with a smattering of barrels. His new base, however, requires 81 barrels and doesn't catch as much as his previous 15 chests.

Where is the serendipity? The frame quarry the built in between. To control the quarry he wrote a script which allows him to run a command. To catch the command he chains a series of if statements, like this (example in Python since I know that syntax and is quasi-legible to non-programmers):

Code:
if command == "moveFoward":
    forward()
elif command == "moveBack":
    back()
elif command == "moveLeft":
    left()
elif command == "moveRight":
    right()
elif command == "Dig"l
    dig()
else:
    print("No such command!")

Readable? Yes. Understandable? Sure. Extensible? Nope. Which is why in the comments I lamented that he should be using an array look-up. Someone else pointed out that DW20 never claimed to be a master programmer and I retorted that in today's day and age, esp. in scripting languages like Lua (the language ComputerCraft uses) array lookups are a dead simple concept. I then pointed out he seemed to have a grasp of the idea even if only in terms of Minecraft objects.

What's an array lookup and why is it better? Well, it looks like this.

Code:
commands = { "moveForward" : forward,
                      "moveBack" : back,
                      "moveLeft" : left,
                      "moveRight" : right,
                      "Dig" : dig
}
 
if command in commands:
    commands[command]()
else:
    print("No such command!")

Why is this form considered better. Well, for starters, it is a heck of a lot shorter. We're not constantly testing the command variable, we're checking it once against the array, commands, so it runs faster If it is in there, we use it to call that command. But secondly, it is easily expandable. To add "moveUp" and "moveDown" to the if chain we require 4 more lines and make the logic of the code quite a bit longer. To do the same for the array is 2 lines which are clear, we assign the commands to the functions in the array. The logic later on is untouched.

Ok, but what does this have to do with barrels? Barrels accept one, and only one, thing. Running a tube past a series of barrels is like checking the command variable against the chained if statement. "If it fits here, insert, else if it fits here, insert, else if it fits here, insert..." Is it simple to set up? Sure, but as the system grows the run times slow down (look how long it takes his Xycraft stuff to filter), it gets harder to extend (requiring far more space) and harder to modify as it grows. Barrels and tubes are the Minecraft physical representation of the chained if statement.
 
  • Like
Reactions: FlukeSDS and IpOnly

thezeronumber

New Member
Jul 29, 2019
69
0
0
The problem is that half of the items in FTB we do not want to be counted as a solitary "thing". Barrels for huge quantities (cobble, dirt, saplings), sure. Barrels for items you commonly use (sticks, various ores), all right. But barrels for stuff which can be lumped together (pipes, bees, tools), not so much. The best way of going about it is to have a split of chests and barrels but that still leaves the problem of how you are going to automatically sort items.

There's routers for barrels and BuildCraft pipes for both but the general consensus seems to be to "wait for RedPower" and use their own sorting system.
 

Harro

New Member
Jul 29, 2019
27
0
1
I will be using a hybrid system:

Sorter -> Stuff I'll have a lot of to barrels, other stuff to another sorter which will pup it in specific chests.

Right now without redpower I just have barrels and chests and do it manually or with diamond pipes (expensive !) to put it into specific barrels.
 

thezeronumber

New Member
Jul 29, 2019
69
0
0
If you work out where you want items to be and place a single unit of that in each barrel before you run the system you wouldn't need to have diamond pipes. As long as none of the barrels running beneath the (cobble)stone line are empty any items which don't match will simply continue onwards until it finds where it should be or hits a dead-end. It's a shame such a thing is nowhere near as simple when it comes to chests.
 

Harro

New Member
Jul 29, 2019
27
0
1
True, but then I might make barrels empty from time to time (simply using all the items)

Also pipes are round robin, so then the items continues on until it find another empty barrel and before you know it all your barrels are filled with dirt/cobble :S
 

Evil Hamster

New Member
Jul 29, 2019
768
0
0
Barrels are great for bulk storage of common objects- cobble, dirt, gravel. Chests are better for ingots/ores/other stuff.

Each has it's purpose, and best use.
 

Antivyris

New Member
Jul 29, 2019
92
0
0
Actually, isn't the entire system connected to tube considered an array? What your explaining sounds more like buildcraft pipes, tubes in my understanding 'find' the nearest inventory that will accept the item. I used to remember how to actually showcase this wasn't just 'if's, but I'd have to load up my old tekkit and danged if I ever want to log back into that.

I believe the way tubes are handles is an array system, that's the only way I could see Manager's working, since they could be put higher in a 'first' array, and the rest in a second array since it understands what is down the pipe.

As a final note, barrels are also better for those that work better graphically than memory-wise. I've found barrels to be a big help for items that I use often, like brick and glass, simply because I can walk in the room and pick it out. It also helps my server-mates as I can tell them to 'Go grab me some wood and stone pipes' and they can find them very fast even being very much still vanilla players.
 

b0bst3r

New Member
Jul 29, 2019
2,195
0
1
Not forgetting that the max a chest can hold is 108 stacks (diamond) and the max a barrel can hold is 1024 stacks
 
  • Like
Reactions: Odenite

eculc

New Member
Jul 29, 2019
163
0
0
Greyed, you are correct, but I'd like to present the opposite side of the field.

You are right in the first case, that an array lookup would be more easily expandable and editable, and you mention that people defend him by saying he's not a "master programmer" and you're correct that array lookups are simple. And yet, for someone who has an _extremely_ limited or even nonexistent previous knowledge of the programming language (or programming in general) a set of chained if-statements is a lot easier than trying to understand _another_ new concept to make your code more efficient, especially when the convenience of having the computer in the first place is more important than having your code as efficient as could be.

In the second case, where barrels aren't the best idea for a sorting system -- They work much in the way you described, and that makes them slower than other systems. if you look at peoples' comments in this thread (and even in how Dire's system is set up) you can see that in this case a combination system is effective -- incredibly easy access to commonly-used things, and the rest sorted into a series of chests since they're either not used often or only one-off items that don't need an entire barrel to themselves.
 

Greyed

New Member
Jul 29, 2019
445
0
0
The best way of going about it is to have a split of chests and barrels but that still leaves the problem of how you are going to automatically sort items.

There's routers for barrels and BuildCraft pipes for both but the general consensus seems to be to "wait for RedPower" and use their own sorting system.

Or, not limit oneself to FTB. LP sorting is phenomenal. Even when RP comes to fruition I'll keep on keeping on with LP because the byzantine hoops people have to jump through to replicate its most basic of functionality is staggering. Similarly, I have held off on many convenience projects involving redstone because I have no intention of fighting the horrible way redstone is placed nor the lack of RP's gates which achieve in 1-2 blocks what might otherwise take 20.

In the second case, where barrels aren't the best idea for a sorting system -- They work much in the way you described, and that makes them slower than other systems. if you look at peoples' comments in this thread (and even in how Dire's system is set up) you can see that in this case a combination system is effective -- incredibly easy access to commonly-used things, and the rest sorted into a series of chests since they're either not used often or only one-off items that don't need an entire barrel to themselves.

IE, the barrel is best in the "else" portion, the fail-over. Except even then a chest does a more than adequate job. Of the responses thus far the one I think that has the most merit is Antivyris' point that some people are visually oriented.

Not forgetting that the max a chest can hold is 108 stacks (diamond) and the max a barrel can hold is 1024 stacks

Which I haven't. In all the worlds I've played as well as all the LPs I have watched of Minecraft do you know how many times I've had the desire for, or have seen someone have accumulated 108 stacks of an item where they want it in a single location, let alone 1024?

0.

Coe with his hording rarely had a double-chest worth of any single item in any given location. DW20 running quarries, in the two series I have watched thus far, started dumping cobble into the recyclers long before filling up a diamond.

I'm not denying that there may be people who find that as a must have feature, more power to'em. But I started this topic to explain why I found barrels to be not to my liking, so their rather large storage side isn't a consideration.
 

Mikey_R

New Member
Jul 29, 2019
382
0
0
I had an extra dimensional barrel taking the wood from a Steve's cart tree farm. I thought to myself it shouldn't fill up and I can sort out what I want to do with it tomorrow. Go to bed, come back the next day and I have a barrel full of Wood, yes, 1024 stacks of wood overnight.

No idea what I could use it for, but, in the case of wood (and saplings) it isn't hard to get a full barrels worth of them.
 

Hydra

New Member
Jul 29, 2019
1,869
0
0
Funny how you used an analogy that LESS people understand to explain your problem. Typically someone would use the barrels as an example on how to explain if-statements. Just an observation from a programmer ;)
 

Fuubar

New Member
Jul 29, 2019
60
0
0
Although I understand what you're saying TC, I disagree about barrels being the less extensible system. The fact that all of the items are compared locally means you only need to plop down another barrel+tube and the system is expanded. Any other system would require a chest (likely one that exceeds the cost of a barrel by a large amount), a tube/pipe, and additional machinery such a filter, a logistics chassis + modules, or possibly a sorter (due to slot limitations).

In terms of extensibility, the only other comparable systems would be using filters at each chest (which is fundamentally the same but allows 9 item types per chest) or logistics pipes and polymorphic item sinks. Sure they're smaller systems and the items flow a bit faster, but they cost diamonds and gold. They also take more time to expand as you need to craft more complex machines. Since wood and space are two things most players have in abundance and you rarely stand around waiting for an item to sort (why throw it in the sorter if you need it right now?) the barrel system makes sense in a some cases.

Unlike your example of an array lookup, there are benefits and disadvantages to the various sorting systems. You just need to decide what is most important to you out of space, complexity (build time), resources, sorting speed, and aesthetics. Depending on what is most important in your build, some sorting systems will make sense and some wont.

Personally, I'll be using barrels once RP2 releases because I can have the system set up on the first or second minecraft day (depending on how lucky I get with my location) and then quickly expand it as needed. All it takes is a timer, a filter, some barrels, and some tubes.
 

Yos

New Member
Jul 29, 2019
10
0
0
I think your issue is the fact that you're not understanding how pneumatic tubes actually interact with things. Tubes know, before an item is put in them, where all valid inventories for a particular item are and sends the item to the first valid inventory as the item is sent through the tube system. The tubes also know where the item came from to return to if there is any problem. A tube will attempt to push the item into that first valid inventory, and if for some reason that inventory isn't valid at the point the item gets there, it will then send it to the next valid inventory OR the origin if there isn't another inventory available, at which point it will "jam" that origin, halting all action until there is a valid inventory for that item. This jamming happens also when there isn't a valid inventory for the object at the point that the object is being originally sent into the system.

There is no if-elseif while items are inside the tubes, unless the tube network changes (you add tubing or more inventories), at which it will do a quick recalculation for each item inside the tubes. This method is one reason why tubes lag less, there is no constant location calculation.

So, part of your problem with barrels + tubes is largely caused by a lack of understanding. Sure, you can disagree with barrels anyway for whatever reason you have still (like your previous quote "In all the worlds I've played as well as all the LPs I have watched of Minecraft do you know how many times I've had the desire for, or have seen someone have accumulated 108 stacks of an item where they want it in a single location, let alone 1024?"), but a misunderstanding due to applying Buildcraft pipe logic to pneumatic tubes isn't a valid argument.

Of course, only Eloraam herself can give the correct explanation, but this is how I have known things to work from making some pretty intricate sorting systems in the past and some previous explanations in videos/forums/wikis (exact sources unknown, its been a while).
 

Vvector

New Member
Jul 29, 2019
23
0
0
When chests can display the count and quantity of the contents on the side of the chests, I might consider dropping barrels. Another big plus is the single click deposit/withdrawal actions. The sorting aspect is just a bonus. Crystal chests are too expensive and can cause lag to use en masse.
 

Froghandler

New Member
Jul 29, 2019
44
0
0
I had an extra dimensional barrel taking the wood from a Steve's cart tree farm. I thought to myself it shouldn't fill up and I can sort out what I want to do with it tomorrow. Go to bed, come back the next day and I have a barrel full of Wood, yes, 1024 stacks of wood overnight.

No idea what I could use it for, but, in the case of wood (and saplings) it isn't hard to get a full barrels worth of them.

1024 stacks x 64 = 65536 logs, which makes 1,198,372 scaffolds, which makes 898,779,428 EU in a generator, which makes 52 UU Matter in a Matterfabricator. Get burning XD
 

Golrith

Over-Achiever
Trusted User
Nov 11, 2012
3,834
2,137
248
If you work out where you want items to be and place a single unit of that in each barrel before you run the system you wouldn't need to have diamond pipes. As long as none of the barrels running beneath the (cobble)stone line are empty any items which don't match will simply continue onwards until it finds where it should be or hits a dead-end. It's a shame such a thing is nowhere near as simple when it comes to chests.
Actually, just do the same thing with chests. Put an item into each slot, then you have a chest with a predefined stock level. Excess items cant go into the container, and pass on/overflow (depending on setup).
Just requires that you always leave at least 1 item in each chest slot.
 

Flip

New Member
Jul 29, 2019
59
0
0
Most of the complaint about barrels in the OP actually seem to be a complaint about one method of sorting into inventories, which may or may not be barrels. You could devise a much more sophisticated way to sort, even with LogPipes as the OP suggests, and still have barrels as the target inventory. Sorting systems are more or less container-agnostic, thanks to Forge.

As for barrels themselves, I think that there are many pros and cons. The interface and display are awesome, but I wish you could get those some features in a block that wasn't overpowered. The fact that they can store ~38 times as many items in the same amount of space as a chest is borderline cheating.
 

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
Personally, I'm not a big fan of barrels because they don't really hold a whole lot, and are inconvenient to deal with.

I might use them for things like cobble, dirt, sand, gravel... that kind of thing. But I'll just stick to iron chests for everything else.

Really, though, Factorization in general doesn't really play well with other mods. It's got its own power system which is not compatible with any other mod, most of the machines in the mod don't do anything that has synergy with any other mod, so it pretty much sits in its own little corner. Sure, you can theoretically triple your ore output, but it takes forever to do so. And it takes stacks of Silver and at least a stack of Lead to get started on any of the machines, so it rather discourages people from playing around with it.
 

Bagman817

New Member
Jul 29, 2019
832
0
0
For me, the biggest attraction to barrels, outside of obvious uses like cobble, is the cost. You can make a barrel for a few pieces of wood, which is essentially free once you have a tree farm, as opposed to 8 iron (or whatever) for an upgraded chest. This makes rooms full of barrels fairly attractive for storage, to say nothing of the handy picture on the front.

@ Greyed, it's not really fair to just casually mention you're using Logistics Pipes, lol. Certainly that's going to be a far superior system to, well, pretty much anything else =)