diff --git a/README.md b/README.md index 6aeb1c9..f2d8d01 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ - Confuse - Coord Logger (World events from [JexClient](https://github.com/DustinRepo/JexClient-main/blob/main/src/main/java/me/dustin/jex/feature/mod/impl/misc/CoordFinder.java)) - Custom Packets +- Ghost Mode (Taken from an [unmerged PR](https://github.com/MeteorDevelopment/meteor-client/pull/1932)) - InteractionMenu (Ported from [BleachHack](https://github.com/BleachDrinker420/BleachHack/pull/211)) - Lavacast - NewChunks (Ported from [BleackHack](https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.17/src/main/java/bleach/hack/module/mods/NewChunks.java)) diff --git a/src/main/java/anticope/rejects/MeteorRejectsAddon.java b/src/main/java/anticope/rejects/MeteorRejectsAddon.java index 11fe554..3e70646 100644 --- a/src/main/java/anticope/rejects/MeteorRejectsAddon.java +++ b/src/main/java/anticope/rejects/MeteorRejectsAddon.java @@ -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()); diff --git a/src/main/java/anticope/rejects/modules/GhostMode.java b/src/main/java/anticope/rejects/modules/GhostMode.java new file mode 100644 index 0000000..b16638a --- /dev/null +++ b/src/main/java/anticope/rejects/modules/GhostMode.java @@ -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 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. "); + } + } + } + +}