Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables
- -- slots
- local slot = 0
- local slotActuel = 0
- local slotsMax = 16
- local nbItemSlot = 0
- -- bucket
- local bucketSlot = 0
- local bucketSlotFound = false;
- local bucketEmpty = "minecraft:bucket"
- local bucketFull = "minecraft:water_bucket"
- local bucketPlein = false;
- local bucketFound = false;
- -- Fonctions
- -- Main
- function main()
- findBucketSlot()
- end
- -- Slot
- function selectSlot(a)
- turtle.select(a)
- majSlot()
- end
- function majSlot() -- A LANCER APRES CHAQUE DEPLACEMENT
- slotActuel = turtle.getSelectedSlot()
- if itemInSlot() then
- slot = turtle.getDetailItem()
- end
- end
- function firstSlot()
- selectSlot(1)
- end
- function upSlot()
- selectSlot(slotActuel + 1)
- end
- function slotIsBucket()
- if slot.name == bucketEmpty or slot.name == bucketFull then
- return true
- else
- return false
- end
- end
- function itemInSlot()
- nbItemSlot = turtle.getItemCount()
- if nbItemSlot > 0 then
- return true
- else
- return false
- end
- end
- -- Bucket
- function bucketCheckSlot()
- if itemInSlot() then
- if slotIsBucket() then
- bucketFound = true
- else
- end
- end
- end
- function findBucketSlot()
- firstSlot()
- while not bucketFound do
- bucketCheckSlot()
- upSlot()
- end
- end
- function bEtat()
- selectSlot(bucketSlot)
- if bIsEmpty() then
- bucketPlein = false;
- elseif bIsFull() then
- bucketPlein = true;
- end
- end
- function bIsEmpty()
- if slot.name == bucketEmpty then
- return true
- else
- return false
- end
- end
- function bIsFull()
- if slot.name == bucketFull then
- return true
- else
- return false
- end
- end
- -- exec
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement