-
Notifications
You must be signed in to change notification settings - Fork 5
/
BaguettePhase.js
37 lines (35 loc) · 931 Bytes
/
BaguettePhase.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
/// api_version=2
var script = registerScript({
name: "Baguette Phase",
version: "1.2",
authors: ["Du_Couscous"]
});
var mode;
script.registerModule({
name: "BaguettePhase",
description: "Phase through a wall",
category: "Movement",
settings: {
Mode: Setting.list({
name: "Mode",
default: "Matrix",
values: ["Matrix"]
})
}
}, function (module) {
module.on("enable", function() {
dist = mc.thePlayer.posY;
})
module.on("motion", function () {
if (module.settings.Mode.get() == "Matrix" && dist-2 <= mc.thePlayer.posY) {
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY-3, mc.thePlayer.posZ);
setSpeed(0.1)
}
});
});
//functions
function setSpeed(_speed) {
var playerYaw = Math.radians(mc.thePlayer.rotationYaw);
mc.thePlayer.motionX = _speed * -Math.sin(playerYaw);
mc.thePlayer.motionZ = _speed * Math.cos(playerYaw);
}