Advertisement
Vodka51200

affichageminingnether

Jul 7th, 2017 (edited)
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.01 KB | None | 0 0
  1. local channel = 8899 -- numéro de canal personnalisé
  2.  
  3. local program_path = shell.getRunningProgram()
  4. print("The path to this program is: " .. program_path)
  5.  
  6. mon = peripheral.find("monitor")
  7. mon.setBackgroundColor(colors.black)
  8. mon.clear()
  9. rednet.open("top")
  10. w,h = mon.getSize()
  11.  
  12. if not w == 57 and not h == 38 then
  13. print("monitor required 3*3")
  14. else
  15. term.redirect(mon)
  16. mon.setTextScale(0.5)
  17.  
  18. local function centerTextTop(text)
  19.     mon.setCursorPos(math.floor(w/2-text:len()/2+.5), 1)
  20.     mon.write(text)
  21. end
  22.  
  23. local function centerTextBottom(text)
  24.     mon.setCursorPos(math.floor(w/2-text:len()/2+.5), h)
  25.     mon.write(text)
  26. end
  27.  
  28. function printText(txt1, color1)
  29. local oldColor = term.getTextColor() -- sauvegarde de la couleur courante
  30.   term.setTextColor(color1)
  31.   print(txt1)
  32.   term.setTextColor(oldColor) -- restauration de la couleur courante
  33. end
  34.  
  35. function doubleTextColor(txt1, color1, txt2, color2)
  36.   local oldColor = term.getTextColor()
  37.   term.setTextColor(color1)
  38.   term.write(txt1)
  39.   term.setTextColor(color2)
  40.   term.write(txt2)
  41.   term.setTextColor(oldColor)
  42. end
  43.  
  44. function centerDoubleTextTop(txt1, color1, txt2, color2)
  45.   local text = txt1 .. txt2
  46.   centerTextTop(text)
  47.   local oldX, oldY = term.getCursorPos()
  48.   term.setCursorPos(oldX - text:len(), oldY)
  49.   doubleTextColor(txt1, color1, txt2, color2)
  50. end
  51.  
  52. function centerDoubleTextBottom(txt1, color1, txt2, color2)
  53.   local text = txt1 .. txt2
  54.   centerTextBottom(text)
  55.   local oldX, oldY = term.getCursorPos()
  56.   term.setCursorPos(oldX - text:len(), oldY)
  57.   doubleTextColor(txt1, color1, txt2, color2)
  58. end
  59.  
  60. local Info = {}
  61.  
  62. --mon.setPaletteColour(colors.blue, 0x018281) -- win 95/98
  63. while true do
  64. --mon.clear()
  65. --mon.setCursorPos(1,1)
  66. mon.setTextColor(colors.black)
  67.  
  68. paintutils.drawFilledBox(1,1,57,1,colors.lightGray)
  69.  
  70. paintutils.drawFilledBox(1,h-1,57,h,colors.lightGray)
  71.  
  72. --centerTextTop("computer ID: "..os.getComputerID())
  73. --centerTextBottom("size: L x".. w .." : H x".. h)
  74. centerDoubleTextTop("computer ID: ", colors.black, ""..os.getComputerID(), colors.yellow)
  75. centerDoubleTextBottom("taille: ", colors.black, "L x".. w .." : H x".. h, colors.yellow)
  76.  
  77. mon.setCursorPos(50, h)
  78. doubleTextColor(" V.",colors.black, "1.3.2",colors.yellow)
  79. --write(" V.1.3.2")
  80.  
  81. paintutils.drawFilledBox(2,5,19,11,colors.cyan) --cyan
  82.  
  83. paintutils.drawFilledBox(21,5,37,11,colors.white)
  84.  
  85. paintutils.drawFilledBox(39,5,56,11,colors.yellow)
  86.  
  87. paintutils.drawFilledBox(21,13,37,17,colors.purple)
  88.  
  89. paintutils.drawFilledBox(2,19,56,35,colors.orange) -- 1.12.2
  90. --paintutils.drawFilledBox(2,35,56,19,colors.orange) -- 1.16.5
  91.  
  92. mon.setBackgroundColor(colors.black)
  93. mon.setTextColor(colors.white)
  94. mon.setCursorPos(21,3)
  95. if (Info.Etat or "Waiting") ~= "In progress" then
  96. mon.setTextColor(colors.red)
  97. else
  98. mon.setTextColor(colors.green)
  99. end
  100. mon.clearLine()
  101. print("State: " ..(Info.Etat or "Waiting"))
  102. mon.setTextColor(colors.black)
  103. mon.setBackgroundColor(colors.cyan)
  104. Info.LigneEnCour = (Info.LigneEnCour or 0)
  105. mon.setCursorPos(3,6)
  106. print("Line: "..(Info.LigneEnCour or 0) .. "/"..(Info.ligneMax or 0))
  107. mon.setCursorPos(3,8)
  108. print("Column: " ..(Info.Colonne or 0) .. "/"..(Info.colonneMax or 0))
  109. mon.setCursorPos(3,10)
  110. print("Depth: " ..(Info.Profondeur or 0) .. "/" ..(Info.ProfondeurMax or 0))
  111. mon.setBackgroundColor(colors.white)
  112. mon.setTextColor(colors.black)
  113. mon.setCursorPos(22,6)
  114. mon.setTextColor(colors.blue)
  115. print("Cobalt: " ..(Info.Cobalt or 0))
  116. mon.setCursorPos(22,7)
  117. mon.setTextColor(colors.orange)
  118. print("Ardite: " ..(Info.Ardite or 0))
  119. mon.setCursorPos(22,8)
  120. mon.setTextColor(colors.brown)
  121. print("Debris: " ..(Info.Debris or 0))
  122. mon.setCursorPos(22,9)
  123. mon.setTextColor(colors.green)
  124. print("Vibranium: " ..(Info.Vibranium or 0))
  125. mon.setBackgroundColor(colors.purple)
  126. mon.setTextColor(colors.black)
  127. mon.setCursorPos(22,14)
  128. print(Info.Tourne or "I do nothing")
  129. mon.setCursorPos(22,16)
  130. print(Info.Descend or "I do nothing")
  131. mon.setBackgroundColor(colors.yellow)
  132. mon.setTextColor(colors.black)
  133. mon.setCursorPos(40,6)
  134. print("Lvl Fuel: " ..(Info.NivFuel or 0))
  135. mon.setCursorPos(40,8)
  136. print("Coal: " ..(Info.Charbon or 0))
  137. mon.setCursorPos(40,10)
  138. print("Mob: " ..(Info.Monstre or "No Mob"))
  139.  
  140. local function centerTextX3(text)
  141.     mon.setCursorPos(math.floor(w/2-text:len()/2+.5), 20)
  142.     mon.setTextColor(colors.gray)
  143.     mon.write(text)
  144. end
  145.  
  146. mon.setBackgroundColor(colors.lightGray)
  147. centerTextX3(" Inventory ")
  148.  
  149. -- mon.setBackgroundColor(colors.black)
  150. -- mon.setTextColor(colors.white)
  151.  
  152. testtxt = "Empty"
  153.  
  154. if Info.slot ~= nil then
  155.     for i = 1,13 do
  156.         mon.setBackgroundColor(colors.orange)
  157.         mon.setTextColor(colors.black)
  158.         mon.setCursorPos(4,21 + i)
  159.         if Info.slot[i] ~= nil then
  160.             -- if Info.slot[i].name == "minecraft:netherrack" then
  161.             -- name = "netherrack"
  162.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  163.             -- elseif Info.slot[i].name == "minecraft:blackstone" then
  164.             -- name = "blackstone"
  165.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  166.             -- elseif Info.slot[i].name == "mysticalagriculture:soulstone_cobble" then
  167.             -- name = "soulstone_cobble"
  168.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  169.             -- elseif Info.slot[i].name == "biomesoplenty:flesh" then
  170.             -- name = "flesh"
  171.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  172.             -- elseif Info.slot[i].name == "minecraft:nether_wart_block" then
  173.             -- name = "nether_wart_block"
  174.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  175.             -- elseif Info.slot[i].name == "silentgear:raw_crimson_iron" then
  176.             -- name = "raw_crimson_iron"
  177.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  178.             -- elseif Info.slot[i].name == "minecraft:obsidian" then
  179.             -- name = "obsidian"
  180.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  181.             -- elseif Info.slot[i].name == "tconstruct:cobalt_ore" then
  182.             -- name = "cobalt"
  183.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  184.             -- elseif Info.slot[i].name == "rftoolsbase:dimensionalshard" then
  185.             -- name = "dimensionalshard"
  186.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  187.             -- elseif Info.slot[i].name == "minecraft:gravel" then
  188.             -- name = "gravel"
  189.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  190.             -- elseif Info.slot[i].name == "minecraft:soul_sand" then
  191.             -- name = "soul_sand"
  192.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  193.             -- elseif Info.slot[i].name == "minecraft:flint" then
  194.             -- name = "flint"
  195.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  196.             -- elseif Info.slot[i].name == "minecraft:quartz" then
  197.             -- name = "quartz"
  198.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  199.             -- elseif Info.slot[i].name == "minecraft:shroomlight" then
  200.             -- name = "shroomlight"
  201.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  202.             -- elseif Info.slot[i].name == "minecraft:crimson_hyphae" then
  203.             -- name = "crimson_hyphae"
  204.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  205.             -- elseif Info.slot[i].name == "minecraft:gold_nugget" then
  206.             -- name = "gold_nugget"
  207.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  208.             -- elseif Info.slot[i].name == "minecraft:magma_block" then
  209.             -- name = "magma_block"
  210.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  211.             -- elseif Info.slot[i].name == "mysticalagriculture:inferium_essence" then
  212.             -- name = "inferium_essence"
  213.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  214.             -- elseif Info.slot[i].name == "mysticalagriculture:prosperity_shard" then
  215.             -- name = "prosperity_shard"
  216.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  217.             -- elseif Info.slot[i].name == "mysticalagriculture:soulium_dust" then
  218.             -- name = "soulium_dust"
  219.             -- print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  220.             -- elseif Info.slot[i].name == "biomesoplenty:fleshchunk" then
  221.             --else
  222.             --print(i .. ". " .. Info.slot[i].name .. " x" .. Info.slot[i].count)
  223.             --end
  224.             local colonIndex = string.find(Info.slot[i].name, ":", 1, true)
  225.             name = string.sub(Info.slot[i].name, colonIndex + 1)
  226.             print(i .. ". " .. name .. " x" .. Info.slot[i].count)
  227.         else
  228.             --print(i .. ".", testtxt) -- colorTextVide("vide")
  229.             doubleTextColor(i .. ". ", colors.black, testtxt, colors.red)
  230.         end
  231.  
  232. -- print(Info.slot[1].name .. " x" .. Info.slot[1].count)
  233. -- print(Info.slot[2].name .. " x" .. Info.slot[2].count)
  234. -- print(Info.slot[3].name .. " x" .. Info.slot[3].count)
  235.     -- for k,v in pairs(Info.slot) do
  236.         -- for i,n in pairs(v) do
  237.         -- print(i,n)
  238.         -- end
  239.     -- end
  240.     end
  241. end
  242.  
  243. mon.setBackgroundColor(colors.black)
  244. id,message = rednet.receive()
  245. Info = textutils.unserialise(message)
  246.  
  247. -- local printerSide = "bottom" -- Remplacez "top" par le côté de votre imprimante
  248.  
  249. -- local id, message = rednet.receive()
  250. -- local info = textutils.unserialize(message)
  251. --   -- Définition du texte à imprimer
  252. -- local text = "Tourne : " .. tostring(info.Tourne) .. "\n" ..
  253. --            "Descend : " .. tostring(info.Descend) .. "\n" ..
  254. --            "NivFuel : " .. tostring(info.NivFuel) .. "\n" ..
  255. --            "Monstre : " .. tostring(info.Monstre) .. "\n" ..
  256. --            "Cobalt : " .. tostring(info.Cobalt) .. "\n" ..
  257. --            "Ardite : " .. tostring(info.Ardite) .. "\n" ..
  258. --            "Vibranium : " .. tostring(info.Vibranium) .. "\n" ..
  259. --            "Debris : " .. tostring(info.Debris) .. "\n" ..
  260. --            "LigneEnCour : " .. tostring(info.LigneEnCour) .. "\n" ..
  261. --            "Colonne : " .. tostring(info.Colonne) .. "\n" ..
  262. --            "Profondeur : " .. tostring(info.Profondeur) .. "\n" ..
  263. --            "Etat : " .. tostring(info.Etat) .. "\n" ..
  264. --            "ProfondeurMax : " .. tostring(info.ProfondeurMax) .. "\n" ..
  265. --            "colonneMax : " .. tostring(info.colonneMax) .. "\n" ..
  266. --            "ligneMax : " .. tostring(info.ligneMax) .. "\n" ..
  267. --            "Charbon : " .. tostring(info.Charbon) .. "\n" ..
  268. --            "slot : " .. tostring(info.slot)
  269.  
  270. -- -- Impression du texte
  271. -- local printer = peripheral.wrap(printerSide)
  272. -- printer.newPage()
  273. -- printer.setPageTitle("Info")
  274. -- printer.write(text)
  275. -- printer.endPage()
  276.  
  277.  
  278. --local senderId, message = rednet.receive(channel) -- recevoir les données envoyées sur le canal personnalisé
  279. --print("Données reçues de l'ordinateur "..senderId..":")
  280. --print(textutils.serialise(message)) -- afficher les données reçues
  281. end
  282. end
  283.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement