Advertisement
Guest User

PainCraft0.005

a guest
Mar 3rd, 2015
194
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. local bucketFound = false;
  17.  
  18.  
  19. --          Fonctions
  20.  
  21. -- Main
  22.  
  23. function main()
  24.  
  25. findBucketSlot()
  26.  
  27.  
  28.  
  29. end
  30.  
  31.  
  32. -- Slot
  33.  
  34. function selectSlot(a)
  35.  
  36.     turtle.select(a)
  37.     majSlot()
  38.     end
  39. end
  40.  
  41. function majSlot()  -- A LANCER APRES CHAQUE DEPLACEMENT
  42.  
  43. slotActuel = turtle.getSelectedSlot()
  44.    
  45.     if itemInSlot() then
  46.     slot = turtle.getDetailItem()
  47.     end
  48.  
  49.  
  50. end
  51.  
  52. function firstSlot()
  53.  
  54.     selectSlot(1)
  55.  
  56. end
  57.  
  58. function upSlot()
  59.    
  60.     selectSlot(slotActuel + 1)
  61.  
  62. end
  63.  
  64.  
  65.  
  66. function slotIsBucket()
  67.  
  68.     if slot.name == bucketEmpty or slot.name == bucketFull then
  69.     bucketFound = true
  70.     return true
  71.     else
  72.     return false
  73.     end
  74.  
  75.  
  76. end
  77.  
  78.  
  79. function itemInSlot()
  80.  
  81.     nbItemSlot = turtle.getItemCount()
  82.  
  83.     if nbItemSlot > 0 then
  84.     return true
  85.     else
  86.     return false
  87.     end
  88.  
  89. end
  90.  
  91.  
  92. -- Bucket
  93.  
  94.  
  95. function findBucketSlot()
  96.  
  97.     while not bucketFound do
  98.    
  99.     end
  100.  
  101.  
  102. end
  103.  
  104.  
  105. function bEtat()
  106.  
  107.     selectSlot(bucketSlot)
  108.  
  109.     if bIsEmpty() then
  110.     bucketPlein = false;
  111.    
  112.     elseif bIsFull() then
  113.     bucketPlein = true;
  114.  
  115.     end
  116.    
  117.  
  118. end
  119.  
  120. function bIsEmpty()
  121.  
  122.     if slot.name == bucketEmpty then
  123.    
  124.     return true
  125.     else
  126.     return false
  127.     end
  128.  
  129. end
  130.  
  131.  
  132. function bIsFull()
  133.  
  134.     if slot.name == bucketFull then
  135.  
  136.     return true
  137.     else
  138.     return false
  139.     end
  140.  
  141. end
  142.  
  143.  
  144.  
  145. -- exec
  146.  
  147. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement