ore-keeper.lua

36 lines · 898 B

Open raw

Copy & run

wget https://perlytiara.github.io/turtles.tips/raw/programs/BigGamingGamers/ore-keeper.lua
1local SLOT_COUNT = 16
2
3KEEP_ITEMS = {
4 "minecraft:diamond",
5 "minecraft:iron_ore",
6 "minecraft:gold_ore",
7 "thermalfoundation:ore",
8 "ic2:resource"
9}
10
11function dropItemsFromList()
12 print("Purging Inventory...")
13
14 for slot = 1, SLOT_COUNT, 1 do
15 local item = turtle.getItemDetail(slot)
16 local keepItem = false
17 if(item ~= nil) then
18 for keepItemIndex = 1, #KEEP_ITEMS, 1 do
19 if(item["name"] == KEEP_ITEMS[keepItemIndex]) then
20 keepItem = true
21 end
22
23 print(item["name"])
24 print(KEEP_ITEMS[keepItemIndex])
25 print(item["name"] == KEEP_ITEMS[keepItemIndex])
26
27 if(not keepItem) then
28 turtle.select(slot)
29 turtle.dropDown()
30 end
31 end
32 end
33 end
34end
35
36dropItemsFromList()