Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --set to gui open event
- local args = {...}
- if args[1] ~= "event" or args[2] ~= "GUIOpened" then
- log("&7Block crafting script should be set to the GUIOpened event")
- return
- end
- if args[4] ~= "crafting table" then
- return
- end
- local item = "minecraft:iron_ingot"
- local inv = openInventory()
- local map = inv.mapping[args[4]]
- local function findItem( inv, map, itemName )
- local matches = {}
- local n = 1
- for a,b in pairs( map.main ) do
- local item = inv.getSlot(b)
- if item and item.id==itemName then
- matches[n] = b
- n = n+1
- end
- end
- for a,b in pairs( map.hotbar ) do
- local item = inv.getSlot(b)
- if item and item.id==itemName then
- matches[n] = b
- n = n+1
- end
- end
- return matches
- end
- local function craftBlocks( inv, map, itemName )
- local matches = findItem( inv, map, itemName )
- while #matches >= 9 and args[3].isOpen() do
- local ready = true
- repeat
- ready = true
- matches = findItem( inv, map, itemName )
- for i = 1, 9 do
- if not inv.getSlot(map.craftingIn[i]) then
- ready = false
- inv.click( table.remove(matches,1))
- inv.click( map.craftingIn[i] )
- waitTick()
- end
- end
- until(ready)
- waitTick()
- inv.quick(map.craftOut )
- end
- end
- craftBlocks( inv, map, item )
Advertisement
Comments
-
- what is this supposted to do?
-
- Advanced Macros for Minecraft.
- This script waits for a user to open a crafting table then auto crafts iron blocks from ingots
-
- is it possible to change it to something else?
-
- Yea, around lines 43 & 44 you could look for specific items and put them in certain slots
- 43, replace itemName with the ingredient you need (or lookup in a table or whatever)
- You can move it into the for loop too which may make it easier to pick out items per slot based on `i`
Add Comment
Please, Sign In to add comment
Advertisement