-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAMotionFly.js
More file actions
123 lines (101 loc) · 3.66 KB
/
AMotionFly.js
File metadata and controls
123 lines (101 loc) · 3.66 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
var scriptName = "Demo Script";
var scriptVersion = 1.0;
var scriptAuthor = "Sms_Gamer";
var AMotionFly = new AMotionFly();
var AMotionFlyClient;
var Strafe = moduleManager.getModule("Strafe")
var C03PacketPlayer = Java.type('net.minecraft.network.play.client.C03PacketPlayer');
// Converts from degrees to radians.
Math.radians = function(degrees) {
return degrees * Math.PI / 180;
};
// Converts from radians to degrees.
Math.degrees = function(radians) {
return radians * 180 / Math.PI;
};
function vClip(offset) {
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + offset, mc.thePlayer.posZ);
}
function hClip(offset) {
var playerYaw = Math.radians(mc.thePlayer.rotationYaw);
mc.thePlayer.setPosition(mc.thePlayer.posX - (Math.sin(playerYaw) * offset), mc.thePlayer.posY, mc.thePlayer.posZ + (Math.cos(playerYaw) * offset));
}
function ivClip(offset) {
mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + offset, mc.thePlayer.posZ);
}
function ihClip(offset) {
var playerYaw = Math.radians(mc.thePlayer.rotationYaw);
mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX - (Math.sin(playerYaw) * offset), mc.thePlayer.posY, mc.thePlayer.posZ + (Math.cos(playerYaw) * offset));
}
function hMotion(offset) {
mc.thePlayer.motionX = parseFloat(Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)) * offset)
mc.thePlayer.motionZ = parseFloat(Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)) * offset)
}
function AMotionFly() {
var spoofGround = value.createBoolean("SpoofGround", false);
var staticMotionY = value.createBoolean("StaticMotionY", true);
var fallSpeed = value.createFloat("FallSpeed", 0.0, 0.0, 5.0);
var initSpeed = value.createFloat("InitSpeed", 1.5, 0.0, 5.0);
var reduceSpeed = value.createFloat("ReduceSpeed", 0.05, 0.0, 5.0);
var minSpeed = value.createFloat("MinSpeed", 0.2, 0.0, 5.0);
var type = value.createList("Type", ["Motion", "hClip", "instantHClip"], "Motion");
var motion;
this.getName = function() {
return "AMotionFly";
};
this.getDescription = function() {
return "A Motion Fly";
};
this.getCategory = function() {
return "Movement";
};
this.onEnable = function() {
motion = initSpeed.get();
}
this.onUpdate = function() {
if(staticMotionY.get()){
mc.thePlayer.motionY = -fallSpeed.get();
}
if(type.get().equals("Motion")){
hMotion(motion)
}
if(type.get().equals("hClip")){
hClip(motion)
}
if(type.get().equals("instantHClip")){
ihClip(motion)
}
if(motion > minSpeed.get()){
motion -= reduceSpeed.get();
}
if(spoofGround.get()){
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(true));
}
}
this.onDisable = function() {
mc.timer.timerSpeed = 1;
mc.thePlayer.motionX = 0;
mc.thePlayer.motionZ = 0;
if(mc.thePlayer.motionY > 0){
mc.thePlayer.motionY = 0;
}
}
this.addValues = function(values) {
values.add(spoofGround);
values.add(staticMotionY);
values.add(fallSpeed);
values.add(initSpeed);
values.add(reduceSpeed);
values.add(minSpeed);
values.add(type);
}
}
function onLoad() {
// Currently this event has to be in every script even if it is not directly needed.
};
function onEnable() {
AMotionFlyClient = moduleManager.registerModule(AMotionFly);
};
function onDisable() {
moduleManager.unregisterModule(AMotionFlyClient);
};