Git Product home page Git Product logo

minelib's Introduction

Everything in the "portable" folder is bundled and ready to pull into a CC: Tweaked computer using wget. You would want to grab the "raw" link for the file. An example:

wget https://raw.githubusercontent.com/zacharylott94/minelib/master/portable/example.lua

Looking for something specific?

Item and Fluid Router

Install by copying and pasting this into a CC: Tweaked computer:

wget https://raw.githubusercontent.com/zacharylott94/minelib/master/portable/updater_scripts/updateRouter.lua

call the update script from the shell and it will grab the latest version of the router.

updateRouter

Use

The software

create a file in the same directory as router.lua named routertable. routertable is in a CSV format. The headers are destination,source,item,reserve,limit,type (you can copy this line directly as your header)

Below your header, you list the routes you want items to take.

Destination and source will both be the names of the peripheral inventories you want to move to and from. They will look something like minecraft:chest_0. The easiest way to find this information is to go right click on the router attached to the inventory.

Item is the internal name of the item you want to move. It'll look like minecraft:stone.

Reserve is the amount of the item you want to stay in the source inventory. The software will not move any items if the amount left is at or below the reserve value. A value of 64 would keep a stack of most items, for example, but this number may be completely arbitrary.

Limit is the amount of the item you want to stay in the destination inventory. The software will attempt to keep up to this number of items in the destination of the route. Basically, you can keep the router from flooding an inventory. If you don't want a limit, a limit of 0 will let the router push as much as it can.

Fluids

fluids are now supported. To make a route a fluid, simply set the type field to "fluid". Below is what a fluid route looks like:

destination,source,item,reserve,limit,type
create:tank_0,create:tank_1,minecraft:water,1000,1000,fluid

The above routing table will move water from tank_1 to tank_0, but it will keep a bucket of water in tank_1 and not fill tank_0 past one bucket of water.

routertable example

destination,source,item,reserve,limit,type
minecraft:chest_0,minecraft:chest_1,minecraft:stone,64,10
minecraft:chest_2,minecraft:chest_1,minecraft:oak_log,64,128
create:tank_0,create:tank_1,minecraft:water,1000,1000,fluid

Note that, currently, if the route isn't a fluid and type is your last key, you can omit putting anything for the type.

Router Aliases

Aliasing of peripheral names and item names is now possible. Create a file named routeraliases in the same directory as router.lua. In it, put the alias and the actual peripheral name/ item internal name in pairs on a line. Here's an example:

cobble,minecraft:cobblstone
log,minecraft:oak_log
input,minecraft:chest_0
output,minecraft:chest_1

you can then use these aliases in a routertable

destination,source,item,reserve,limit,type
output,input,cobble,0,64
output,input,log,10,10

The Hardware

You will need a CC: Tweaked computer, some network cable, and a wired modem for each inventory you want to route to. Right click a modem after you set an inventory next to it, and it will tell you the names of the inventories that it has connected to the network. Your computer also needs a modem attach to it.


Where's the rest of the source code? There looks like there's missing libraries...

Correct! I'm new to Lua package management, and moving multiple files onto CC:T computers is a pain. I had to figure out a way to concatenate all of my source files. I'm using Luarocks to install these "portable" packages to my local machine where I can require them anywhere. I've failed to publish these packages onto Luarocks because I simply didn't feel like it. The repos do exist here under my profile, though.

Links for the lazy:

minelib's People

Contributors

zacharylott94 avatar

Watchers

 avatar

minelib's Issues

Item wildcards

It'd be nice to be able to not have to specify a specific item. A use case would be pulling any output from a furnace. It would be cumbersome to specify a route for every furnace recipe. It would be nice to be able to do something like this in a routertable

destination,source,item,reserve,limit
minecraft:chest_1,minecraft:furnace_0,*,0,0

The above table would pull any item out of chest 1 and put it into chest 0 with no limits. It will empty chest 1 if it can.

An issue I might see with this would be if the user wanted to route a specific item to a different location than the generic case, like so:

destination,source,item,reserve,limit
minecraft:furnace_0,minecraft:chest_1,minecraft:iron_ore,64,0
minecraft:chest_0,minecraft:chest_1,*,0,0

With the current implementation, this wouldn't be entirely possible because each route gets executed. On the first loop, iron ore would be moved to the desired destination, but then the second route is executed and iron ore could end up in chest 0 as well. Maybe some sort of not label would solve this?

destination,source,item,reserve,limit
minecraft:furnace_0,minecraft:chest_1,minecraft:iron_ore,64,0
minecraft:chest_0,minecraft:chest_1,!minecraft:iron_ore,0,0

I can see this being even more difficult to implement...

A way to push a specific amount of fluid or item per operation

It would be nice to specify in a route that the route should only be fulfilled if it can push the specified amount. As an example, pushing 144mb of molten iron into a Tinker's Construct casting table to cast an ingot. The route should only be fulfilled if all 144mb can be pushed. This would allow for automating casting of parts without leaving half filled castings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.