-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVine.js
More file actions
193 lines (161 loc) · 5.23 KB
/
Vine.js
File metadata and controls
193 lines (161 loc) · 5.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
botMode = "mainSouth"
groupname = "shadnobot"
discordID = "96706920664006656"
const p = Player.getPlayer()
const abortKey = "a"
function Tick()
{
checkFell()
KeyBind.keyBind("key.sneak", true);
grabShears()
face()
checkManualAbort()
KeyBind.keyBind("key.attack", true);
KeyBind.keyBind('key.right', true)
checkMove()
}
mainSlot = 36
while (botMode != "terminate")
{
Tick()
Time.sleep(10)
}
if (botMode = "terminate")
{
KeyBind.keyBind("key.forward", false);
KeyBind.keyBind("key.attack", false);
KeyBind.keyBind("key.sneak", false);
KeyBind.keyBind("key.use", false);
KeyBind.keyBind('key.right', false);
if (terminateReason != "Player has pressed abort key.")
{
Chat.say("/logout")
Chat.say("/g" + groupname + " shadnobot")//Patar15 was here 12/27/2023
Chat.say("/g "+ groupname + " <@" + discordID + "> bot terminated. Reason: " + terminateReason)//Patar15 was here 12/27/2023
}
if (terminateReason = "Player has pressed abort key.")
{
Chat.log("Bot manually terminated")
}
World.playSound("entity.ghast.scream", 100, 0);
}
function checkManualAbort() {
if (KeyBind.getPressedKeys().contains("key.keyboard." + abortKey)) {
Chat.log("Player has pressed abort key. Terminating.")
terminateReason = "Player has pressed abort key."
botMode = "terminate"
}
}
function checkFell() {
y = p.getPos().y
if (y < 41)
{
terminateReason = "bot fell"
botMode = "terminate"
}
}
function checkMove() {
x = p.getPos().x
z = p.getPos().z
Time.sleep(150)
x2 = p.getPos().x
z2 = p.getPos().z
if (x == x2 && z == z2)
{
if (botMode == "mainSouth")
{
botMode = "mainNorth"
Time.sleep(100)
face()
}
else if (botMode == "mainNorth")
{
botMode = "mainSouth"
Time.sleep(100)
face()
}
}
}
function grabShears() {
// List of items the bot registers as pickaxes.
pickaxeItems = ["minecraft:shears"]
// Has the bot found a pickaxe yet?
pickFound = false
// Loop through hotbar, stop if end reached or pickaxe is found
let inv = Player.openInventory()
for (i = 0; i <= 9 && !pickFound; i++) {
// If a pickaxe is found in the hotbar, select it and terminate loop
if (pickaxeItems.includes(inv.getSlot(i+36).getItemId())) {
pickFound = true
inv.setSelectedHotbarSlotIndex(i);
}
}
for (i = 9; i <= 34 && !pickFound; i++) {//Patar15 was here 12/27/2023 Now checks off hand for block
// If a pickaxe block is found in the inventory, select it and terminate loop
if (pickaxeItems.includes(inv.getSlot(i).getItemId())) {
pickFound = true
inv.setSelectedHotbarSlotIndex(i);
pickFound = true
inv.swap(i,mainSlot)
}
}
if (!pickFound) {
terminateReason = 'Could not find shears in inventory.'//Patar15 was here 12/27/2023
botMode = "terminate"
}
}
validFood = ['minecraft:bread',"minecraft:cooked_porkchop","minecraft:cooked_mutton","minecraft:cooked_salmon","minecraft:cooked_beef",
"minecraft:baked_potato","minecraft:melon_slice","minecraft:carrot","minecraft:cooked_chicken","minecraft:cooked_cod",
"minecraft:cooked_rabbit","minecraft:cookie","minecraft:potato","minecraft:pumpkin_pie","minecraft:glow_berries","minecraft:tropical_fish"
,"minecraft:sweet_berries","minecraft:golden_carrot"]
function grabFood() {
// Has the bot found a placeable block yet?
foodFound = false
// Loop through hotbar, stop if end reached or block is found
let inv = Player.openInventory()
for (i = 0; i <= 9 && !foodFound; i++) { //Patar15 was here 12/27/2023 Now checks off hand for food
// If a placeable block is found in the hotbar, select it and terminate loop
if (validFood.includes(inv.getSlot(i+36).getItemId())) {
foodFound = true
inv.setSelectedHotbarSlotIndex(i);
}
}
for (i = 9; i <= 34 && !foodFound; i++) {//Patar15 was here 12/27/2023 Now checks off hand for block
// If a placeable block is found in the inventory, select it and terminate loop
if (validFood.includes(inv.getSlot(i).getItemId())) {
foodFound = true
inv.swap(i,mainSlot)
}
}
if (!foodFound) {
teminateReason = 'Could not find validFood in inventory.'//Patar15 was here 12/27/2023
botMode = "terminate"
}
}
minFoodLevel = 14
function eatCheck(){
if (p.getFoodLevel() < minFoodLevel) {
KeyBind.keyBind("key.attack", false);
Chat.log("Food level low, auto eating");
grabFood()
Client.waitTick(10);
KeyBind.key("key.mouse.right",true)
Client.waitTick(33);
KeyBind.key("key.mouse.right",false)
KeyBind.keyBind("key.attack", true);
grabPickaxe()
face()
}
}
function face() {
if (botMode == "mainSouth")
{
p.lookAt(0,7.4)
Time.sleep(400)
}
if (botMode == "mainNorth")
{
p.lookAt(180,7.4)
Time.sleep(400)
}
}