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