Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- --- Desc: A utility to get the inventory slots of a connected peripheral (using for mapping crafting recipes)
- ---
- --By: hornedcommando
- -- Define the peripheral
- local peripheralName = "tconstruct:crafting_station_0" -- Change this to your peripheral name
- local peripheral = peripheral.wrap(peripheralName)
- -- Function to list inventory slots
- local function listInventorySlots(peripheral)
- for slot = 1, peripheral.size() do
- local itemDetail = peripheral.getItemDetail(slot)
- if itemDetail then
- print("Slot: " .. slot .. ", Item: " .. itemDetail.name .. ", Count: " .. itemDetail.count)
- else
- print("Slot: " .. slot .. " is empty.")
- end
- end
- end
- -- Main function
- local function main()
- if peripheral then
- print("Peripheral connected: " .. peripheralName)
- listInventorySlots(peripheral)
- else
- print("Peripheral not found: " .. peripheralName)
- end
- end
- -- Start the main function
- main()
Add Comment
Please, Sign In to add comment