ghost mode

This commit is contained in:
C10udburst
2022-01-16 11:32:18 +01:00
parent 140066873a
commit a781b9f0f0
3 changed files with 68 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
modules.add(new Confuse());
modules.add(new CoordLogger());
modules.add(new CustomPackets());
modules.add(new GhostMode());
modules.add(new InteractionMenu());
modules.add(new Lavacast());
modules.add(new NewChunks());

View File

@@ -0,0 +1,66 @@
package anticope.rejects.modules;
import meteordevelopment.meteorclient.events.game.GameJoinedEvent;
import meteordevelopment.meteorclient.events.game.OpenScreenEvent;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.client.gui.screen.DeathScreen;
import anticope.rejects.MeteorRejectsAddon;
public class GhostMode extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final Setting<Boolean> fullFood = sgGeneral.add(new BoolSetting.Builder()
.name("full-food")
.description("Sets the food level client-side to max.")
.defaultValue(true)
.build()
);
public GhostMode() {
super(MeteorRejectsAddon.CATEGORY, "ghost-mode", "Allows you to keep playing after you die. Works on Forge, Fabric and Vanilla servers.");
}
private boolean active = false;
@Override
public void onDeactivate() {
super.onDeactivate();
active = false;
warning("You are no longer in a ghost mode!");
if (mc.player != null && mc.player.networkHandler != null) {
mc.player.requestRespawn();
info("Respawn request has been sent to the server.");
}
}
@EventHandler
private void onGameJoin(GameJoinedEvent event) {
active = false;
}
@EventHandler
private void onTick(TickEvent.Pre event) {
if (mc.player.getHealth() < 1f) mc.player.setHealth(20f);
if (fullFood.get() && mc.player.getHungerManager().getFoodLevel() < 20) {
mc.player.getHungerManager().setFoodLevel(20);
}
}
@EventHandler
private void onOpenScreen(OpenScreenEvent event) {
if (event.screen instanceof DeathScreen) {
event.cancel();
if (!active) {
active = true;
info("You are now in a ghost mode. ");
}
}
}
}