Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true do
- --term.clear()
- local items = {}
- local max = 27
- local colors2 = {
- ["Block of Diamond"] = colors.blue,
- ["Iron Ingot"] = colors.gray,
- ["Gold Ore"] = colors.yellow,
- ["Gold Ingot"] = colors.yellow,
- ["Block of Gold"] = colors.yellow,
- -- Ajouter autant de blocs que vous le souhaitez avec leur couleur correspondante
- }
- local p = peripheral.wrap("left")
- local function getItems(items, max)
- for slot = 1, max do
- --if p.getStackInSlot(slot) ~= nil then
- --if p.getItemMeta(slot) ~= nil then
- --local scan = p.getStackInSlot(slot)
- local scan = p.getItemMeta(slot)
- if scan then
- items[scan.displayName] = (items[scan.displayName] or 0) + (scan.count or 0) -- display_name qty
- end
- --end
- end
- end
- local function displayItems(items, side)
- local monitor = peripheral.wrap(side)
- term.setBackgroundColor(colors.cyan)
- --monitor.setTextScale(0.5)
- --term.setCursorPos(1,1)
- term.clear()
- local y = 1
- for k,v in pairs(items) do
- term.setTextColor(colors2[k] or colors.white) -- Utiliser la couleur de la table ou la couleur blanche par défaut
- term.setCursorPos(1, y)
- print(y.. " " ..k.." x"..v)
- y = y + 1
- end
- end
- getItems(items, max)
- displayItems(items, "right")
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement