/
WTAPbot.js
150 lines (122 loc) · 4.71 KB
/
WTAPbot.js
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
//Copyright 2020 commandblock2 distributed under AGPL-3.0-or-later
RotationUtils = Java.type("net.ccbluex.liquidbounce.utils.RotationUtils")
PlayerExtension = Java.type("net.ccbluex.liquidbounce.utils.extensions.PlayerExtensionKt")
Class = Java.type("java.lang.Class")
var countDownClicks = 5
var target = null
var lasttarget = null
var isEnemy
var countDown = countDownClicks
var lastFrameLeftDown = false
var forEach = Array.prototype.forEach;
module =
{
name: "WTAPbot",
description: "Bot that uses WTAP(mostly legit), left click 5 times to start(facing the same target), right click to stop",
author: "commandblock2",
category: "combat",
values:
[
noBack = value.createBoolean("No S-Tap", false)
],
onRender3D: function () {
thisFrameLeftDown = mc.gameSettings.keyBindAttack.isKeyDown()
if (!lastFrameLeftDown && thisFrameLeftDown)
onLeftClick()
if (countDown == 0) {
if (target == null || PlayerExtension.getDistanceToEntityBox(mc.thePlayer, target) > maxDistance + 10 || mc.gameSettings.keyBindPickBlock.isKeyDown()) {
countDown = countDownClicks
chat.print("§c[WTAP]§7Lock release")
mc.gameSettings.keyBindForward.pressed = false
mc.gameSettings.keyBindBack.pressed = false
mc.thePlayer.setSprinting(false)
return
}
aim()
distance = PlayerExtension.getDistanceToEntityBox(mc.thePlayer, target)
reach = moduleManager.getModule("Reach");
var maxDistance = reach.state ? reach.getValue("CombatReach").get() : 3.0
if (distance < maxDistance - 0.5 && !noBack.get()) {
mc.gameSettings.keyBindBack.pressed = true
mc.gameSettings.keyBindForward.pressed = false
mc.thePlayer.setSprinting(false)
}
else if (distance > maxDistance - 0.2 && distance < maxDistance) {
mc.gameSettings.keyBindForward.pressed = true
mc.gameSettings.keyBindBack.pressed = false
mc.thePlayer.setSprinting(false)
}
else if (distance > maxDistance) {
mc.gameSettings.keyBindForward.pressed = true
mc.gameSettings.keyBindBack.pressed = false
mc.thePlayer.setSprinting(true)
}
else {
mc.gameSettings.keyBindForward.pressed = false
mc.gameSettings.keyBindBack.pressed = false
mc.thePlayer.setSprinting(false)
}
}
else {
autoClicker.state = false
mc.gameSettings.keyBindAttack.pressed = false
}
lastFrameLeftDown = thisFrameLeftDown
},
onEnable: function ()
{
isEnemy = killAura.class.getDeclaredMethod("isEnemy",Class.forName("net.minecraft.entity.Entity"))
isEnemy.setAccessible(true)
},
onDisable: function () { },
onPacket: function(event)
{
if (event.getPacket() instanceof S12PacketEntityVelocity && mc.theWorld.getEntityByID(event.getPacket().getEntityID()) == mc.thePlayer)
mc.thePlayer.setSprinting(false)
}
}
function aim() {
autoClicker.state = true
mc.gameSettings.keyBindAttack.pressed = true
RotationUtils.searchCenter(target.getEntityBoundingBox(), false, false, false, true).rotation.toPlayer(mc.thePlayer)
}
function onLeftClick() {
entities = mc.theWorld.loadedEntityList
mindiff = Number.MAX_VALUE
target = null
forEach.call(entities, function (elem) {
diff = RotationUtils.getRotationDifference(elem)
reach = moduleManager.getModule("Reach");
var maxDistance = reach.state ? reach.getValue("CombatReach").get() : 3.0
if (PlayerExtension.getDistanceToEntityBox(mc.thePlayer, elem) > maxDistance + 10)
return
if (elem == mc.thePlayer || !isEnemy.invoke(killAura, elem))
return
if (diff < mindiff) {
mindiff = diff
target = elem
}
})
if (lasttarget == target && target) {
if (countDown > 0)
countDown--
else
return
}
else {
countDown = countDownClicks
lasttarget = target
}
switch (countDown) {
case 2:
chat.print("§c[WTAP]§7Click 2 more time to lock target " + target.getName())
break;
case 0:
chat.print("§c[WTAP]§7Target §d" + target.getName() + " §7acquiring lock")
default:
break;
}
}
script.import("Core.lib")
autoClicker = LiquidBounce.moduleManager.getModule("autoClicker")
killAura = LiquidBounce.moduleManager.getModule("killaura")