-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathClipper.js
More file actions
46 lines (43 loc) · 2.41 KB
/
Clipper.js
File metadata and controls
46 lines (43 loc) · 2.41 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
///api_version=2
(script = registerScript({
name: "Clipper",
version: "2.3",
authors: ["CzechHek"]
})).import("Core.lib");
list = [
clipdown = value.createFloat("Down", 10, 0, 10),
clipup = value.createFloat("Up", 2, 0, 10),
nomove = value.createBoolean("NoMove", true),
indicate = value.createBoolean("Indicate", true)
]
module = {
description: "VClips through blocks using space and shift.",
values: list,
onUpdate: function () {
if (mc.thePlayer.onGround) {
for (i = 2, down = 0; i <= clipdown.get() + 2; i += 0.125) if (mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(0,-i,0)).isEmpty() && !mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(0,-i-0.125,0)).isEmpty()) {
down = i; break;
}
for (i = 2, up = 0; i <= clipup.get() + 2; i += 0.125) if (mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(0,i,0)).isEmpty() && !mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, mc.thePlayer.getEntityBoundingBox().offset(0,i-0.125,0)).isEmpty()) {
up = i; break;
}
jumpStop = jumpStop && mc.gameSettings.keyBindJump.pressed;
mc.gameSettings.keyBindJump.pressed = !jumpStop && mc.gameSettings.keyBindJump.pressed;
}
},
onKey: function (k) {
if (mc.thePlayer.onGround && (!nomove.get() || !isMovingHorizontally()) && (key = k.getKey())) {
if (down && key == mc.gameSettings.keyBindSneak.getKeyCode()) {
mc.gameSettings.keyBindSneak.pressed = false;
mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY - down, mc.thePlayer.posZ);
} else if (up && key == mc.gameSettings.keyBindJump.getKeyCode()) {
mc.gameSettings.keyBindJump.pressed = false; jumpStop = true;
mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + up, mc.thePlayer.posZ);
}
}
},
onRender2D: function () {
indicate.get() && (up || down) && mc.ingameGUI.drawCenteredString(mc.fontRendererObj, (up ? "§8[§5▲ §dUp§8]" : "") + (up && down ? " " : "") + (down ? "§8[§5▼ §dDown§8]" : ""), mc.displayWidth / 4, mc.displayHeight / 2.5, -1);
}
}
up = down = 0; jumpStop = false;