From f024d2c95abb11e5151eae70da45064d4904f8cd Mon Sep 17 00:00:00 2001 From: Tryfle Date: Sat, 25 Nov 2023 15:53:17 -0500 Subject: [PATCH] :heart: BedNuker, NoItemRelease, NoRotate, etc. --- .../stormy/client/module/ModuleManager.java | 1 + .../module/modules/combat/Killaura.java | 6 ++- .../module/modules/movement/Flight.java | 35 ++++++++++++---- .../module/modules/movement/NoSlow.java | 23 ++++++++++- .../module/modules/player/BedNuker.java | 24 ++++++++++- .../module/modules/player/NoRotate.java | 21 ++++++++++ .../stormy/client/utils/world/WorldUtils.java | 40 +++++++++++++++++++ 7 files changed, 137 insertions(+), 13 deletions(-) create mode 100644 src/main/java/dev/stormy/client/module/modules/player/NoRotate.java create mode 100644 src/main/java/dev/stormy/client/utils/world/WorldUtils.java diff --git a/src/main/java/dev/stormy/client/module/ModuleManager.java b/src/main/java/dev/stormy/client/module/ModuleManager.java index 7107ded..f960d0f 100644 --- a/src/main/java/dev/stormy/client/module/ModuleManager.java +++ b/src/main/java/dev/stormy/client/module/ModuleManager.java @@ -47,6 +47,7 @@ public ModuleManager() { addModule(new ClickGuiModule()); addModule(new ClosetSpeed()); addModule(new Blink()); + addModule(new NoRotate()); addModule(new Bhop()); addModule(new Killaura()); addModule(new AntiVoid()); diff --git a/src/main/java/dev/stormy/client/module/modules/combat/Killaura.java b/src/main/java/dev/stormy/client/module/modules/combat/Killaura.java index 6aebc7a..26d7099 100644 --- a/src/main/java/dev/stormy/client/module/modules/combat/Killaura.java +++ b/src/main/java/dev/stormy/client/module/modules/combat/Killaura.java @@ -16,6 +16,7 @@ import net.weavemc.loader.api.event.*; import org.lwjgl.input.Mouse; +import java.util.Objects; import java.util.Optional; @SuppressWarnings("unused") @@ -33,7 +34,7 @@ public Killaura() { this.registerSetting(new DescriptionSetting("Probably doesn't bypass much.")); this.registerSetting(range = new SliderSetting("Range", 3, 3, 6, 0.1)); this.registerSetting(frequency = new SliderSetting("CPS", 10, 1, 20, 0.5)); - this.registerSetting(hurtTimeAmt = new SliderSetting("Ignore before hurt time", 0, 0, 20, 1)); + this.registerSetting(hurtTimeAmt = new SliderSetting("Ignore before hurt time", 1, 1, 20, 1)); this.registerSetting(rotRand = new SliderSetting("Rotation Randomization", 2, 0, 3, .01)); this.registerSetting(rots = new TickSetting("Rotations (for bypassing)", false)); this.registerSetting(whenLooking = new TickSetting("Only when looking at player", false)); @@ -56,7 +57,7 @@ public boolean aBooleanCheck() { if (!whenLooking.isToggled()) return false; MovingObjectPosition result = mc.objectMouseOver; if (result != null && result.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && result.entityHit instanceof EntityPlayer targetPlayer) { - return whenLooking.isToggled() && PlayerUtils.lookingAtPlayer(mc.thePlayer, targetPlayer, range.getInput()); + return whenLooking.isToggled() && PlayerUtils.lookingAtPlayer(mc.thePlayer, targetPlayer, range.getInput() + 1); } else return false; } @@ -70,6 +71,7 @@ public void experiMental(UpdateEvent.Pre e) { if (target.isPresent()) { if (mc.thePlayer.isBlocking() || mc.thePlayer.isEating()) return; if (whenLooking.isToggled() && !aBooleanCheck()) return; + if (target.get().deathTime > 0) return; mc.thePlayer.swingItem(); mc.playerController.attackEntity(mc.thePlayer, target.get()); timer.reset(); diff --git a/src/main/java/dev/stormy/client/module/modules/movement/Flight.java b/src/main/java/dev/stormy/client/module/modules/movement/Flight.java index c80ee90..899c7d9 100644 --- a/src/main/java/dev/stormy/client/module/modules/movement/Flight.java +++ b/src/main/java/dev/stormy/client/module/modules/movement/Flight.java @@ -1,19 +1,20 @@ package dev.stormy.client.module.modules.movement; +import dev.stormy.client.module.Module; import dev.stormy.client.module.setting.impl.ComboSetting; +import dev.stormy.client.module.setting.impl.DescriptionSetting; import dev.stormy.client.module.setting.impl.SliderSetting; import dev.stormy.client.module.setting.impl.TickSetting; +import dev.stormy.client.utils.math.MathUtils; +import dev.stormy.client.utils.player.MoveUtils; import dev.stormy.client.utils.player.PlayerUtils; import net.weavemc.loader.api.event.SubscribeEvent; import net.weavemc.loader.api.event.TickEvent; -import dev.stormy.client.module.Module; -import dev.stormy.client.module.setting.impl.DescriptionSetting; @SuppressWarnings("unused") public class Flight extends Module { public ComboSetting flightMode; - private int counter, ticks; private boolean started; public final SliderSetting airspeed; public final TickSetting gs, ascend, descend; @@ -34,26 +35,46 @@ public void onDisable() { } } - @SubscribeEvent public void airTrafficControl(TickEvent e) { if (!PlayerUtils.isPlayerInGame()) return; if (gs.isToggled()) mc.thePlayer.onGround = true; switch (flightMode.getMode()) { - case AirWalk: { + case AirWalk -> { mc.thePlayer.motionY = 0.0F; mc.thePlayer.speedInAir = (float) airspeed.getInput() * 2 / 100; if (ascend.isToggled() && mc.gameSettings.keyBindJump.isKeyDown()) { mc.thePlayer.onGround = true; mc.thePlayer.jumpTicks = 0; - } + } if (descend.isToggled() && mc.gameSettings.keyBindSneak.isKeyDown()) { mc.thePlayer.motionY = -0.5F; + } + } + case VerusGlide -> { + mc.timer.timerSpeed = 1.0F; + if (mc.thePlayer.fallDistance > 0.5F) { + mc.thePlayer.motionY = -0.09800000190735147; + MoveUtils.strafe(); + if (mc.thePlayer.fallDistance < 3.0F) { + MoveUtils.motionMult(1.03F); + } + if (mc.thePlayer.fallDistance > 3.0F) { + MoveUtils.motionMult(1.0105F); + }; + mc.thePlayer.speedInAir = (float) (MathUtils.randomInt(1, 1.4) * 2) / 100; + if (ascend.isToggled() && mc.gameSettings.keyBindJump.isKeyDown()) { + mc.thePlayer.motionY += 1; + } + if (descend.isToggled() && mc.gameSettings.keyBindSneak.isKeyDown()) { + mc.thePlayer.motionY -= 0.5F; } } } } + } + public enum modeee { - AirWalk + AirWalk, VerusGlide } } \ No newline at end of file diff --git a/src/main/java/dev/stormy/client/module/modules/movement/NoSlow.java b/src/main/java/dev/stormy/client/module/modules/movement/NoSlow.java index b775707..5fb4a30 100644 --- a/src/main/java/dev/stormy/client/module/modules/movement/NoSlow.java +++ b/src/main/java/dev/stormy/client/module/modules/movement/NoSlow.java @@ -1,5 +1,6 @@ package dev.stormy.client.module.modules.movement; +import dev.stormy.client.module.setting.impl.ComboSetting; import dev.stormy.client.module.setting.impl.DescriptionSetting; import dev.stormy.client.module.setting.impl.SliderSetting; import dev.stormy.client.module.setting.impl.TickSetting; @@ -10,6 +11,8 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemPotion; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.weavemc.loader.api.event.PacketEvent; import net.weavemc.loader.api.event.SubscribeEvent; import dev.stormy.client.module.Module; import net.weavemc.loader.api.event.TickEvent; @@ -17,6 +20,7 @@ public class NoSlow extends Module { public static SliderSetting speed; public static TickSetting autosprint, noweapons, noconsumables; + public static ComboSetting mode; public TimerUtils timer = new TimerUtils(); int rmb = mc.gameSettings.keyBindUseItem.getKeyCode(); int sprint = mc.gameSettings.keyBindSprint.getKeyCode(); @@ -29,11 +33,12 @@ public NoSlow() { this.registerSetting(autosprint = new TickSetting("Allow Sprint", false)); this.registerSetting(noweapons = new TickSetting("Blacklist Weapons", false)); this.registerSetting(noconsumables = new TickSetting("Blacklist Consumables", false)); + this.registerSetting(mode = new ComboSetting<>("Mode", modes.Regular)); } @SubscribeEvent public void onSlowdown(SlowdownEvent e) { - if (!PlayerUtils.isPlayerInGame()) return; + if (!PlayerUtils.isPlayerInGame() || mode.getMode() != modes.Regular) return; if (noweapons.isToggled() && PlayerUtils.isPlayerHoldingWeapon()) return; if (noconsumables.isToggled() && consumableCheck()) return; e.setCancelled(true); @@ -52,16 +57,30 @@ public void onSlowdown(SlowdownEvent e) { } @SubscribeEvent public void reBlock(TickEvent e) { - if (shouldFinishBlock && timer.hasReached(100 + Utils.Java.randomInt(-10, 10))) { + if (mode.getMode() != modes.Regular && shouldFinishBlock && timer.hasReached(100 + Utils.Java.randomInt(-10, 10))) { shouldFinishBlock = false; KeyBinding.setKeyBindState(rmb, true); KeyBinding.onTick(rmb); timer.reset(); } } + public static boolean consumableCheck() { if (mc.thePlayer.getHeldItem() != null) { return noconsumables.isToggled() && (mc.thePlayer.getHeldItem().getItem() instanceof ItemFood || mc.thePlayer.getHeldItem().getItem() instanceof ItemPotion); } else return false; } + + @SubscribeEvent + public void onPacket(PacketEvent.Send e) { + if (!PlayerUtils.isPlayerInGame() || mode.getMode() != modes.NoItemRelease) return; + if (noweapons.isToggled() && PlayerUtils.isPlayerHoldingWeapon()) return; + if (noconsumables.isToggled() && consumableCheck()) return; + if (e.getPacket() instanceof C07PacketPlayerDigging && ((C07PacketPlayerDigging) e.getPacket()).getStatus() == C07PacketPlayerDigging.Action.RELEASE_USE_ITEM) { + e.setCancelled(true); + } + } + public enum modes { + Regular, NoItemRelease + } } diff --git a/src/main/java/dev/stormy/client/module/modules/player/BedNuker.java b/src/main/java/dev/stormy/client/module/modules/player/BedNuker.java index 4b328e6..2a2da3d 100644 --- a/src/main/java/dev/stormy/client/module/modules/player/BedNuker.java +++ b/src/main/java/dev/stormy/client/module/modules/player/BedNuker.java @@ -2,12 +2,32 @@ import dev.stormy.client.module.Module; import dev.stormy.client.module.setting.impl.DescriptionSetting; +import dev.stormy.client.utils.world.WorldUtils; +import me.tryfle.stormy.events.UpdateEvent; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.weavemc.loader.api.event.SubscribeEvent; public class BedNuker extends Module { public BedNuker() { super("BedNuker", ModuleCategory.Player, 0); - this.registerSetting(new DescriptionSetting("No logic YET")); + this.registerSetting(new DescriptionSetting("Breaks beds.")); } -} + @SubscribeEvent + public void onUpdate(UpdateEvent e) { + if (mc.thePlayer != null) { + breakBlock(WorldUtils.findNearestBedPos(mc.theWorld, mc.thePlayer.getPosition(), 6)); + } + } + + private void breakBlock(BlockPos pos) { + if (mc.thePlayer != null) { + try { + mc.playerController.onPlayerDamageBlock(pos, EnumFacing.NORTH); + mc.thePlayer.swingItem(); + } catch (Exception ignored) {} + } + } +} \ No newline at end of file diff --git a/src/main/java/dev/stormy/client/module/modules/player/NoRotate.java b/src/main/java/dev/stormy/client/module/modules/player/NoRotate.java new file mode 100644 index 0000000..f6f6fdf --- /dev/null +++ b/src/main/java/dev/stormy/client/module/modules/player/NoRotate.java @@ -0,0 +1,21 @@ +package dev.stormy.client.module.modules.player; + +import dev.stormy.client.module.Module; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.weavemc.loader.api.event.PacketEvent; +import net.weavemc.loader.api.event.SubscribeEvent; + +public class NoRotate extends Module { + public NoRotate() { + super("NoRotate", ModuleCategory.Player, 0); + } + @SubscribeEvent + public void onPacket(PacketEvent.Receive event) { + final Packet packet = event.getPacket(); + if (packet instanceof S08PacketPlayerPosLook s08) { + s08.yaw = mc.thePlayer.rotationYaw; + s08.pitch = mc.thePlayer.rotationPitch; + } + } +} diff --git a/src/main/java/dev/stormy/client/utils/world/WorldUtils.java b/src/main/java/dev/stormy/client/utils/world/WorldUtils.java new file mode 100644 index 0000000..0b470b6 --- /dev/null +++ b/src/main/java/dev/stormy/client/utils/world/WorldUtils.java @@ -0,0 +1,40 @@ +package dev.stormy.client.utils.world; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldUtils { + public static BlockPos findNearestBedPos(World world, BlockPos playerPos, int searchRadius) { + BlockPos nearestBedPos = null; + double nearestDistanceSq = Double.MAX_VALUE; + + int minX = playerPos.getX() - searchRadius; + int minY = Math.max(0, playerPos.getY() - searchRadius); + int minZ = playerPos.getZ() - searchRadius; + int maxX = playerPos.getX() + searchRadius; + int maxY = Math.min(world.getHeight(), playerPos.getY() + searchRadius); + int maxZ = playerPos.getZ() + searchRadius; + + for (int x = minX; x <= maxX; x++) { + for (int y = minY; y <= maxY; y++) { + for (int z = minZ; z <= maxZ; z++) { + BlockPos currentPos = new BlockPos(x, y, z); + IBlockState blockState = world.getBlockState(currentPos); + Block block = blockState.getBlock(); + if (block == Blocks.bed) { + double distanceSq = playerPos.distanceSq(currentPos); + if (distanceSq < nearestDistanceSq) { + nearestBedPos = currentPos; + nearestDistanceSq = distanceSq; + } + } + } + } + } + + return nearestBedPos; + } +} \ No newline at end of file