Expandable Item Sorter / Storage Room

Started by MLGMilk, Nov 06, 2022, 11:52 AM

Previous topic - Next topic


Hello all,

If the title has you interested, here it is.

Small update, there was an error in "my" regular expression. long story short, it made it impossible to designate a chest to a specific block id. that has now been fixed.

pastebin get yswQbGaQ INSTALL

Here are a few things to note before you download or hop into the code

before running the installer, make sure the turtle is against a wall with a 1 block airgap between it and the ground (it's okay if it's not against a wall, it will just waste some time before placing the chests)

to expand the system, you must add a string array of length 6 to cA(Chest Array). You will also need to dig out the necessary blocks and place the necessary chests(or write a small script to do it with the function I wrote)

the checkFuel function is also not smart at all, if you don't keep fuel in slot 16, it will get stuck in place somewhere

at the moment, cA is equal to

{"cobblestone","dirt","ingot","stone","seed","wood log plank stick"}
{"ore","beef pork wheat slice fish chicken egg cake","bone flesh gun string","coal","diamond emerald lapis","junk gravel"}

basically, the turtle sucks up a stack of blocks from the starting chest, inspects it, and compares its name to every value in cA.

in the case of there being multiple words in one string, that string is split, and then it compares the name of the block to every word in that string. In this case, multiple items would go to the same chest.

This does cause some small problems, for one, there are multiple blocks with the id "minecraft:stone". Because of this, all of them will go to the stone chest.

Also, the placing of torches is very buggy. I believe its success is determined by the turtle's direction when placing the torches but I'm not sure.

Here's the code for the main program that runs in a loop: https://pastebin.com/U1UT7TxV

Ah, one last thing. To use the junk function to throw things away, first use the get function to bring what youre trying to throw away into the starting chest, then use junk to throw those things into the lava.

if you can get over that, you can expand this system as much as you like, even into the third dimension (although to do that, you'd have to heavily modify the get and place functions).

I tried to attach a pic of what the default setup looks like, but the image was too large for the site to accept it, you're not missing much aesthetically, however. If you're curious, why not download it and see it for yourself? :P