-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathAutoDisable.js
49 lines (48 loc) · 1.8 KB
/
AutoDisable.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
var fadeTimer = 0;
var reasons = ['Aura disabled due to server changes.', 'Aura disabled due to death.'];
var S06PacketUpdateHealth = Java.type('net.minecraft.network.play.server.S06PacketUpdateHealth');
var ScaledResolution = Java.type('net.minecraft.client.gui.ScaledResolution');
var KillAura = moduleManager.getModule('KillAura');
function getScaledWidth() {
var scaledWidth = new ScaledResolution(mc).getScaledWidth();
return scaledWidth;
}
function getScaledHeight() {
var scaledHeight = new ScaledResolution(mc).getScaledHeight();
return scaledHeight;
}
var script = registerScript({
name: 'AutoDisable',
version: '0.0.0',
authors: ['Shurpe']
});
script.registerModule({
name: 'AutoDisable',
description: 'Turns off KillAura module',
category: 'Fun'
}, function (module) {
module.on('packet', function (e) {
var packet = e.getPacket();
if (packet instanceof S06PacketUpdateHealth && packet.getHealth() <= 0 && KillAura.getState()) {
KillAura.setState(false); reason = reasons[1]; disabled = true;
}
});
module.on('update', function () {
mcWidth = getScaledWidth(); mcHeight = getScaledHeight();
disabled ? fadeTimer++ : fadeTimer = 0;
if (fadeTimer >= 50) {
disabled = false;
}
});
module.on('render2D', function () {
if (disabled) {
mc.fontRendererObj.drawStringWithShadow(reason, mcWidth / 2 - mc.fontRendererObj.getStringWidth(reason) / 2, 15, 0xFFFFFF);
mc.fontRendererObj.drawStringWithShadow('§cWarning!', mcWidth / 2 - mc.fontRendererObj.getStringWidth('Warning!') / 2, 5, 0xFFFFFF);
}
});
module.on('world', function () {
if (KillAura.getState()) {
reason = reasons[0]; KillAura.setState(false); disabled = true;
}
});
});