Advertisement
Guest User

PainCraft0.004

a guest
Mar 3rd, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --           Variables
  2.  
  3. -- slots
  4.  
  5. local slot = 0
  6. local slotActuel = 0
  7. local slotsMax = 16
  8. local nbItemSlot = 0
  9. -- bucket
  10.  
  11. local bucketSlot = 0
  12. local bucketSlotFound = false;
  13. local bucketEmpty = "minecraft:bucket"
  14. local bucketFull = "minecraft:water_bucket"
  15. local bucketPlein = false;
  16.  
  17.  
  18. --          Fonctions
  19.  
  20. -- Main
  21.  
  22. function main()
  23.  
  24. findBucketSlot()
  25.  
  26.  
  27.  
  28. end
  29.  
  30.  
  31. -- Slot
  32.  
  33. function selectSlot(a)
  34.  
  35. turtle.select(a)
  36.  
  37.     if itemInSlot() then
  38.     majSlot()
  39.     end
  40. end
  41.  
  42. function majSlot()  -- A LANCER APRES CHAQUE DEPLACEMENT
  43.  
  44. slotActuel = turtle.getSelectedSlot()
  45. slot = turtle.getDetailItem()
  46.  
  47. end
  48.  
  49. function firstSlot()
  50.  
  51.     selectSlot(1)
  52.  
  53. end
  54.  
  55. function upSlot()
  56.    
  57.     selectSlot(slotActuel + 1)
  58.  
  59. end
  60.  
  61.  
  62. function slotIsBucket()
  63.  
  64.     if slot.name == bucketEmpty or slot.name == bucketFull then
  65.     return true
  66.     else
  67.     return false
  68.     end
  69.  
  70.  
  71. end
  72.  
  73.  
  74. function itemInSlot()
  75.  
  76.     nbItemSlot = turtle.getItemCount()
  77.  
  78.     if nbItemSlot > 0 then
  79.     return true
  80.     else
  81.     return false
  82.     end
  83.  
  84. end
  85.  
  86.  
  87. -- Bucket
  88.  
  89.  
  90. function findBucketSlot()
  91.  
  92.  
  93.  
  94.  
  95. end
  96.  
  97.  
  98. function bEtat()
  99.  
  100.     selectSlot(bucketSlot)
  101.  
  102.     if bIsEmpty() then
  103.     bucketPlein = false;
  104.    
  105.     elseif bIsFull() then
  106.     bucketPlein = true;
  107.  
  108.     end
  109.    
  110.  
  111. end
  112.  
  113. function bIsEmpty()
  114.  
  115.     if slot.name == bucketEmpty then
  116.    
  117.     return true
  118.     else
  119.     return false
  120.     end
  121.  
  122. end
  123.  
  124.  
  125. function bIsFull()
  126.  
  127.     if slot.name == bucketFull then
  128.  
  129.     return true
  130.     else
  131.     return false
  132.     end
  133.  
  134. end
  135.  
  136.  
  137.  
  138. --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement