SHOW:
|
|
- or go back to the newest paste.
1 | -- Variables | |
2 | ||
3 | -- slots | |
4 | ||
5 | local slot = 0 | |
6 | local slotActuel = 0 | |
7 | local slotsMax = 16 | |
8 | local slot | |
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 | - | if slotIsBucket() then |
21 | + | |
22 | function main() | |
23 | - | print("Slot is Bucket!") |
23 | + | |
24 | findBucketSlot() | |
25 | ||
26 | ||
27 | ||
28 | end | |
29 | ||
30 | ||
31 | -- Slot | |
32 | ||
33 | function selectSlot(a) | |
34 | ||
35 | turtle.select(a) | |
36 | majSlot() | |
37 | ||
38 | end | |
39 | ||
40 | function majSlot() -- A LANCER APRES CHAQUE DEPLACEMENT | |
41 | ||
42 | slotActuel = turtle.getSelectedSlot() | |
43 | slot = turtle.getDetailItem() | |
44 | ||
45 | end | |
46 | ||
47 | function firstSlot() | |
48 | ||
49 | selectSlot(1) | |
50 | ||
51 | end | |
52 | ||
53 | function upSlot() | |
54 | ||
55 | selectSlot(slotActuel + 1) | |
56 | ||
57 | end | |
58 | ||
59 | ||
60 | function slotIsBucket() | |
61 | ||
62 | if slot.name == bucketEmpty or slot.name == bucketFull then | |
63 | return true | |
64 | else | |
65 | return false | |
66 | end | |
67 | ||
68 | ||
69 | end | |
70 | ||
71 | ||
72 | -- Bucket | |
73 | ||
74 | function findBucketSlot() | |
75 | ||
76 | firstSlot() | |
77 | - | firstSlot() |
77 | + | |
78 | while not slotIsBucket() do | |
79 | upSlot() | |
80 | end | |
81 | ||
82 | print("Slot actuel: " , slotActuel) | |
83 | ||
84 | end | |
85 | ||
86 | ||
87 | function bEtat() | |
88 | ||
89 | selectSlot(bucketSlot) | |
90 | ||
91 | if bIsEmpty() then | |
92 | bucketPlein = false; | |
93 | ||
94 | elseif bIsFull() then | |
95 | bucketPlein = true; | |
96 | ||
97 | end | |
98 | ||
99 | ||
100 | end | |
101 | ||
102 | function bIsEmpty() | |
103 | ||
104 | if slot.name == bucketEmpty then | |
105 | ||
106 | return true | |
107 | else | |
108 | return false | |
109 | end | |
110 | ||
111 | end | |
112 | ||
113 | ||
114 | function bIsFull() | |
115 | ||
116 | if slot.name == bucketFull then | |
117 | ||
118 | return true | |
119 | else | |
120 | return false | |
121 | end | |
122 | ||
123 | end | |
124 | ||
125 | ||
126 | ||
127 | -- |