-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathBlinkFall.js
151 lines (136 loc) · 6.81 KB
/
BlinkFall.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
151
///api_version=2
(script = registerScript({
name: "BlinkFall",
authors: ["CzechHek"],
version: "5.2"
})).import("Core.lib");
module = {
category: "Movement",
values: [
maxfalltime = value.createInteger("MaxFallTime", 1000, 0, 10000),
nofall = value.createBoolean("NoFall", false),
simulatedfall = value.createBoolean("SimulatedFall", true),
simulatedtimer = value.createFloat("SimulatedTimer", 2, 1, 10),
fakeplayer = value.createBoolean("FakePlayer", true),
line = value.createBoolean("Line", true)
],
onPacket: function (e) {
if (mc.thePlayer && catchPackets) {
if (e.getPacket() instanceof C03PacketPlayer) {
p = e.getPacket(); e.cancelEvent();
!isSending && p.isMoving() && (nofall.get() && (p.onGround = mc.thePlayer.fallDistance > 3) && (mc.thePlayer.fallDistance = 0), packets.put(timer.getTimePassed() / simulatedtimer.get(), p));
}
}
},
onMove: function (e) {
BlinkFallModule.tag = packets.size();
if (!catchPackets) {
if (canStand()) {
startPos = mc.thePlayer.getEntityBoundingBox();
if (catchPackets = !isSafe(e)) {
timer.reset();
if (fakeplayer.get()) {
fakePlayer = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());
fakePlayer.clonePlayer(mc.thePlayer, true);
fakePlayer.copyLocationAndAnglesFrom(mc.thePlayer);
fakePlayer.rotationYawHead = mc.thePlayer.rotationYawHead;
mc.theWorld.addEntityToWorld(-1, fakePlayer);
}
}
}
} else {
if (fakeplayer.get()) KillAuraModule.target = null;
if (!isSending && !isSafe(e)) {
if (!wasInAir) wasInAir = !mc.thePlayer.onGround;
else if (timer.hasTimePassed(maxfalltime.get())) {
mc.thePlayer.setPositionAndUpdate(startPos.minX + 0.3, startPos.minY, startPos.minZ + 0.3);
e.zero(); mc.thePlayer.motionX = mc.thePlayer.motionY = mc.thePlayer.motionZ = 0;
end();
}
} else if (mc.thePlayer.onGround || isSafe(e)) {
if (!isSending) {
isSending = true;
timer.reset();
lastKey = tailField.get(packets).getKey();
packets.forEach(function (delay, packet) {
timeout(simulatedfall.get() ? delay : 0, function () {
sendPacket(packet);
fakeplayer.get() && (packet.getRotating() ? fakePlayer.setPositionAndRotation(packet.x, packet.y, packet.z, packet.yaw, packet.pitch) : fakePlayer.setPosition(packet.x, packet.y, packet.z));
if (delay == lastKey) end();
});
});
} else if (timer.hasTimePassed(lastKey * 2)) end();
e.zeroXZ(); e.setY(-1e-14);
}
}
},
onRender3D: function () {
if (line.get() && catchPackets) {
color = BreadcrumbsModule.colorRainbow.get() ? ColorUtils.rainbow() : new Color(BreadcrumbsModule.colorRedValue.get(), BreadcrumbsModule.colorGreenValue.get(), BreadcrumbsModule.colorBlueValue.get());
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_DEPTH_TEST);
mc.entityRenderer.disableLightmap();
GL11.glBegin(GL11.GL_LINE_STRIP);
RenderUtils.glColor(color);
renderPosX = mc.getRenderManager().viewerPosX;
renderPosY = mc.getRenderManager().viewerPosY;
renderPosZ = mc.getRenderManager().viewerPosZ;
packets.forEach(function (delay, packet) GL11.glVertex3d(packet.x - renderPosX, packet.y - renderPosY, packet.z - renderPosZ));
GL11.glColor4d(1, 1, 1, 1);
GL11.glEnd();
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
}
},
onDisable: function () {
end();
}
}
function isSafe(e) {
if (mc.thePlayer.isSpectator() || !mc.thePlayer.capabilities.allowEdit || mc.thePlayer.capabilities.allowFlying || mc.thePlayer.capabilities.disableDamage || FlyModule.state || ScaffoldModule.state || TowerModule.state || !canStand(startPos) || mc.thePlayer.isOnLadder() || mc.thePlayer.isInWater() || mc.thePlayer.isInWeb) return true;
if (!catchPackets || mc.thePlayer.onGround) {
if (mc.thePlayer.onGround && (wasInAir || mc.thePlayer.isSneaking() || !isMovingHorizontally())) return true;
yaw = MovementUtils.getDirection();
speed = MovementUtils.getSpeed();
if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(-Math.sin(yaw) * speed, -2, Math.cos(yaw) * speed).expand(0, 2, 0)).isEmpty()) return true;
blockPos = new BlockPos(mc.thePlayer.posX - Math.sin(yaw) * speed, mc.thePlayer.posY + 2, mc.thePlayer.posZ + Math.cos(yaw) * speed);
for (i = -1; i++ < 6;) if (!mc.theWorld.isAirBlock(blockPos.down(i))) return true;
}
}
function ATimer() {
this.time = System.currentTimeMillis();
this.hasTimePassed = function (ms) System.currentTimeMillis() >= this.time + ms;
this.getTimePassed = function () System.currentTimeMillis() - this.time;
this.reset = function () this.time = System.currentTimeMillis();
}
function end() {
catchPackets = isSending = wasInAir = false;
fakeplayer.get() && fakePlayer && mc.theWorld.removeEntity(fakePlayer);
packets.clear();
}
function canStand(bb) {
bb = bb || mc.thePlayer.getEntityBoundingBox();
minX = Math.floor(bb.minX);
maxX = Math.floor(bb.maxX + 1);
minZ = Math.floor(bb.minZ);
maxZ = Math.floor(bb.maxZ + 1);
if (!mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, bb).isEmpty()) return false;
for (x = minX; x < maxX; ++x) {
for (z = minZ; z < maxZ; ++z){
if (!mc.theWorld.isAirBlock(bp = new BlockPos(x, bb.minY - 1e-14, z))) return true
}
}
}
System = Java.type("java.lang.System");
EntityOtherPlayerMP = Java.type("net.minecraft.client.entity.EntityOtherPlayerMP");
Color = Java.type("java.awt.Color");
GL11 = Java.type("org.lwjgl.opengl.GL11");
tailField = getField(LinkedHashMap, "tail");
var packets = new LinkedHashMap(), catchPackets, lastPos = [], timer = new ATimer(), isSending, wasInAir, fakePlayer;