diff --git a/src/main/java/dev/coredoes/coreclient/ConnectionInterface.java b/src/main/java/dev/coredoes/coreclient/ConnectionInterface.java new file mode 100644 index 0000000..b5931e2 --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/ConnectionInterface.java @@ -0,0 +1,9 @@ +package dev.coredoes.coreclient; + +import net.minecraft.network.PacketCallbacks; +import net.minecraft.network.packet.Packet; +import org.jetbrains.annotations.Nullable; + +public interface ConnectionInterface { + void sendVolatile(Packet packet, @Nullable PacketCallbacks callbacks); +} diff --git a/src/main/java/dev/coredoes/coreclient/CoreClient.java b/src/main/java/dev/coredoes/coreclient/CoreClient.java index 41bdce3..bacf1c0 100644 --- a/src/main/java/dev/coredoes/coreclient/CoreClient.java +++ b/src/main/java/dev/coredoes/coreclient/CoreClient.java @@ -1,20 +1,31 @@ package dev.coredoes.coreclient; +import dev.coredoes.coreclient.commands.CommandManager; +import dev.coredoes.coreclient.event.TickEvent; import dev.coredoes.coreclient.gui.Category; import dev.coredoes.coreclient.gui.ClickGUI; import dev.coredoes.coreclient.gui.module.*; -import dev.coredoes.coreclient.module.bypass.BotMovement; -import dev.coredoes.coreclient.module.bypass.PacketLogger; +import dev.coredoes.coreclient.module.bypass.*; +import dev.coredoes.coreclient.module.bypass.ButtonClicker; +import dev.coredoes.coreclient.module.movement.CreativeFlight; +import dev.coredoes.coreclient.module.movement.Jetpack; +import dev.coredoes.coreclient.module.misc.PacketLogger; +import dev.coredoes.coreclient.module.movement.NoFall; import meteordevelopment.orbit.EventBus; import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.networking.v1.ClientLoginNetworking; import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; +import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; import net.minecraft.client.MinecraftClient; +import net.minecraft.network.PacketByteBuf; import org.lwjgl.glfw.GLFW; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.invoke.MethodHandles; +import java.util.concurrent.CompletableFuture; public class CoreClient implements ClientModInitializer { public static final Logger LOGGER = LoggerFactory.getLogger("coreclient"); @@ -46,6 +57,14 @@ public class CoreClient implements ClientModInitializer { Category.HUD.modules.add(new LogoModule()); Category.BYPASS.modules.add(new BotMovement()); + Category.BYPASS.modules.add(new WorldguardMovebypass()); + Category.BYPASS.modules.add(new NewLOButton()); + + Category.MOVEMENT.modules.add(new CreativeFlight()); + Category.MOVEMENT.modules.add(new Jetpack()); + Category.MOVEMENT.modules.add(new NoFall()); + + Category.EXPLOITS.modules.add(new ButtonClicker()); Category.MISCELLANEOUS.modules.add(new PacketLogger()); @@ -65,11 +84,49 @@ public class CoreClient implements ClientModInitializer { if (i==ClickGUIModule.keybind.getKey()) gui.enterGUI(); if (i==HUDEditorModule.keybind.getKey()) gui.enterHUDEditor(); gui.handleKeyEvent(i); + + if (i == CreativeFlight.keybind.getKey()) { + CreativeFlight.getInstance().isEnabled().toggle(); + } + + if (i == Jetpack.keybind.getKey()) { + Jetpack.getInstance().isEnabled().toggle(); + } + + if (i == NoFall.keybind.getKey()) { + NoFall.getInstance().isEnabled().toggle(); + } } } } }); + LOGGER.info("[Stage 5/5: JoinChallengeInit] Registering join challenge"); + + ClientLoginNetworking.registerGlobalReceiver(JoinChallengeConstants.JOIN_PACKET_ID, (client, handler, buf, responseSender) -> { + String string = buf.readString(); + int a = buf.readInt(); + int b = buf.readInt(); + LOGGER.info("{} {} {}", string, a, b); + int resp = a + b; + PacketByteBuf buf2 = PacketByteBufs.create(); + buf2.writeInt(resp); + return CompletableFuture.completedFuture(buf2); + }); + + LOGGER.info("[Stage 6/6: LifecycleInit] Registering lifecycle tick events"); + + ClientTickEvents.START_CLIENT_TICK.register(client -> { + CoreClient.eventBus.post(TickEvent.Pre.get()); + }); + ClientTickEvents.END_CLIENT_TICK.register(client -> { + CoreClient.eventBus.post(TickEvent.Post.get()); + }); + + LOGGER.info("[Stage 7/7: CommandInit] Registering Brigadier commands"); + + ClientCommandRegistrationCallback.EVENT.register(CommandManager::registerCommands); + LOGGER.info("CoreClient loaded!"); } } diff --git a/src/main/java/dev/coredoes/coreclient/JoinChallengeConstants.java b/src/main/java/dev/coredoes/coreclient/JoinChallengeConstants.java new file mode 100644 index 0000000..85566b2 --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/JoinChallengeConstants.java @@ -0,0 +1,7 @@ +package dev.coredoes.coreclient; + +import net.minecraft.util.Identifier; + +public class JoinChallengeConstants { + public static final Identifier JOIN_PACKET_ID = new Identifier("liveoverflowmod", "join"); +} diff --git a/src/main/java/dev/coredoes/coreclient/commands/CommandManager.java b/src/main/java/dev/coredoes/coreclient/commands/CommandManager.java new file mode 100644 index 0000000..59f6043 --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/commands/CommandManager.java @@ -0,0 +1,12 @@ +package dev.coredoes.coreclient.commands; + +import com.mojang.brigadier.CommandDispatcher; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.minecraft.command.CommandRegistryAccess; + +public class CommandManager { + public static void registerCommands(CommandDispatcher dispatcher, CommandRegistryAccess registryAccess) { + VClipCommand.register(dispatcher); + ShowHandCommand.register(dispatcher); + } +} diff --git a/src/main/java/dev/coredoes/coreclient/commands/ShowHandCommand.java b/src/main/java/dev/coredoes/coreclient/commands/ShowHandCommand.java new file mode 100644 index 0000000..f03916a --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/commands/ShowHandCommand.java @@ -0,0 +1,48 @@ +package dev.coredoes.coreclient.commands; + +import com.mojang.brigadier.Command; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.context.CommandContext; +import dev.coredoes.coreclient.CoreClient; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.minecraft.client.MinecraftClient; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.util.hit.HitResult; + +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.*; + +public class ShowHandCommand { + public static void register(CommandDispatcher dispatcher) { + dispatcher.register( + literal("showhand").executes(ShowHandCommand::execute) + ); + } + + private static int execute(CommandContext ctx) { + HitResult target = MinecraftClient.getInstance().crosshairTarget; + + if (target == null) { + ctx.getSource().sendError(Text.of("You aren't looking at anything.")); + return -1; + } + + if (!(target instanceof EntityHitResult)) { + ctx.getSource().sendError(Text.of("You aren't looking at an entity.")); + return -1; + } + + Entity entity = ((EntityHitResult) target).getEntity(); + + for (ItemStack item : entity.getHandItems() ) { + ctx.getSource().sendFeedback(Text.of("Item: " + item)); + if (item.getNbt() != null) { + ctx.getSource().sendFeedback(Text.of("NBT: " + item.getNbt().toString())); + } + } + + return Command.SINGLE_SUCCESS; + } +} diff --git a/src/main/java/dev/coredoes/coreclient/commands/VClipCommand.java b/src/main/java/dev/coredoes/coreclient/commands/VClipCommand.java new file mode 100644 index 0000000..7013851 --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/commands/VClipCommand.java @@ -0,0 +1,72 @@ +package dev.coredoes.coreclient.commands; + +import com.mojang.brigadier.Command; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.context.CommandContext; +import dev.coredoes.coreclient.ConnectionInterface; +import dev.coredoes.coreclient.CoreClient; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.minecraft.client.MinecraftClient; +import net.minecraft.network.ClientConnection; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; + +import java.util.Objects; + +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.*; + +public class VClipCommand { + public static void register(CommandDispatcher dispatcher) { + dispatcher.register( + literal("vclip") + .then( + argument("blocks", IntegerArgumentType.integer()) + .executes( + ctx -> { + int blocks = IntegerArgumentType.getInteger(ctx, "blocks"); + return VClipCommand.execute( + ctx, + blocks + ); + } + ) + ) + + ); + } + + private static int execute(CommandContext ctx, int blocks) { + CoreClient.LOGGER.info("vclipping {}", blocks); + assert MinecraftClient.getInstance().player != null; + int needed = Math.abs(blocks / 10 + 5); + + CoreClient.LOGGER.info("need {}", needed); + + ClientConnection conn = MinecraftClient.getInstance().getNetworkHandler().getConnection(); + ConnectionInterface c = (ConnectionInterface) conn; + + for (int i = 0; i < needed; i++) { + c.sendVolatile(new PlayerMoveC2SPacket.PositionAndOnGround( + MinecraftClient.getInstance().player.getX(), + MinecraftClient.getInstance().player.getY(), + MinecraftClient.getInstance().player.getZ(), + MinecraftClient.getInstance().player.isOnGround() + ), null); + } + + double x = MinecraftClient.getInstance().player.getX(); + double y = MinecraftClient.getInstance().player.getY() + blocks; + double z = MinecraftClient.getInstance().player.getZ(); + + c.sendVolatile(new PlayerMoveC2SPacket.PositionAndOnGround( + x, + y, + z, + MinecraftClient.getInstance().player.isOnGround() + ), null); + + MinecraftClient.getInstance().player.setPos(x, y, z); + + return Command.SINGLE_SUCCESS; + } +} diff --git a/src/main/java/dev/coredoes/coreclient/event/TickEvent.java b/src/main/java/dev/coredoes/coreclient/event/TickEvent.java new file mode 100644 index 0000000..1777101 --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/event/TickEvent.java @@ -0,0 +1,19 @@ +package dev.coredoes.coreclient.event; + +public class TickEvent extends Cancellable { + public static class Pre extends TickEvent { + private static final Pre INSTANCE = new Pre(); + + public static Pre get() { + return INSTANCE; + } + } + + public static class Post extends TickEvent { + private static final Post INSTANCE = new Post(); + + public static Post get() { + return INSTANCE; + } + } +} diff --git a/src/main/java/dev/coredoes/coreclient/gui/module/ClickGUIModule.java b/src/main/java/dev/coredoes/coreclient/gui/module/ClickGUIModule.java index ee7ec6d..cda5306 100644 --- a/src/main/java/dev/coredoes/coreclient/gui/module/ClickGUIModule.java +++ b/src/main/java/dev/coredoes/coreclient/gui/module/ClickGUIModule.java @@ -13,7 +13,7 @@ public class ClickGUIModule extends Module { public static final IntegerSetting animationSpeed=new IntegerSetting("Animation Speed","animationSpeed","The speed of GUI animations.",()->true,0,1000,200); public static final EnumSetting theme=new EnumSetting("Theme","theme","What theme to use.",()->true,Theme.GameSense,Theme.class); public static final EnumSetting layout=new EnumSetting("Layout","layout","What layout to use.",()->true,Layout.ClassicPanel,Layout.class); - public static final KeybindSetting keybind=new KeybindSetting("Keybind","keybind","The key to toggle the module.",()->true,GLFW.GLFW_KEY_TAB); + public static final KeybindSetting keybind=new KeybindSetting("Keybind","keybind","The key to toggle the module.",()->true,GLFW.GLFW_KEY_GRAVE_ACCENT); public ClickGUIModule() { super("ClickGUI","Module containing ClickGUI settings.",()->true,false); diff --git a/src/main/java/dev/coredoes/coreclient/mixin/ClientBrandRetrieverMixin.java b/src/main/java/dev/coredoes/coreclient/mixin/ClientBrandRetrieverMixin.java new file mode 100644 index 0000000..2e6b05b --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/mixin/ClientBrandRetrieverMixin.java @@ -0,0 +1,19 @@ +package dev.coredoes.coreclient.mixin; + +import net.minecraft.client.ClientBrandRetriever; +import net.minecraft.obfuscate.DontObfuscate; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; + +@Mixin(ClientBrandRetriever.class) +public class ClientBrandRetrieverMixin { + /** + * @author c0repwn3r + * @reason because liveoverflow + */ + @DontObfuscate + @Overwrite(remap = false) + public static String getClientModName() { + return "LiveOverflowMod"; + } +} diff --git a/src/main/java/dev/coredoes/coreclient/mixin/ClientConnectionMixin.java b/src/main/java/dev/coredoes/coreclient/mixin/ClientConnectionMixin.java index 80d823d..1ded19a 100644 --- a/src/main/java/dev/coredoes/coreclient/mixin/ClientConnectionMixin.java +++ b/src/main/java/dev/coredoes/coreclient/mixin/ClientConnectionMixin.java @@ -1,26 +1,40 @@ package dev.coredoes.coreclient.mixin; +import dev.coredoes.coreclient.ConnectionInterface; import dev.coredoes.coreclient.CoreClient; import dev.coredoes.coreclient.event.ConnectEvent; import dev.coredoes.coreclient.event.DisconnectEvent; import dev.coredoes.coreclient.event.PacketEvent; import net.minecraft.network.ClientConnection; +import net.minecraft.network.PacketCallbacks; import net.minecraft.network.listener.PacketListener; import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket; +import net.minecraft.network.packet.s2c.play.HealthUpdateS2CPacket; import net.minecraft.text.Text; +import net.minecraft.util.Identifier; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.net.InetSocketAddress; +import java.util.Objects; @Mixin(ClientConnection.class) -public class ClientConnectionMixin { +public abstract class ClientConnectionMixin implements ConnectionInterface { @Inject(method = "handlePacket", at = @At("HEAD"), cancellable = true) private static void onHandlePacket(Packet packet, PacketListener listener, CallbackInfo info) { if (CoreClient.eventBus.post(PacketEvent.Receive.get(packet)).isCancelled()) info.cancel(); + + if (packet instanceof HealthUpdateS2CPacket pkt) { + if (pkt.getHealth() == 0 && pkt.getFood() == 0 && pkt.getSaturation() == 0) { + info.cancel(); + } + } } @Inject(method = "send(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true) @@ -46,4 +60,20 @@ public class ClientConnectionMixin { private static void onConnect(InetSocketAddress address, boolean useEpoll, CallbackInfoReturnable info) { CoreClient.eventBus.post(ConnectEvent.get()); } + + @Inject(method = "sendImmediately", at = @At("HEAD"), cancellable = true) + private void sendImmediately(Packet packet, @Nullable PacketCallbacks callbacks, CallbackInfo ci) { + if (packet instanceof CustomPayloadC2SPacket pkt) { + if (Objects.equals(pkt.getChannel(), new Identifier("minecraft", "register"))) { + ci.cancel(); + return; + } + } + } + + @Shadow protected abstract void sendImmediately(Packet packet, @Nullable PacketCallbacks callbacks); + + public void sendVolatile(Packet packet, @Nullable PacketCallbacks callbacks) { + this.sendImmediately(packet, callbacks); + } } diff --git a/src/main/java/dev/coredoes/coreclient/mixin/ClientPlayerEntityAccessor.java b/src/main/java/dev/coredoes/coreclient/mixin/ClientPlayerEntityAccessor.java new file mode 100644 index 0000000..137934e --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/mixin/ClientPlayerEntityAccessor.java @@ -0,0 +1,11 @@ +package dev.coredoes.coreclient.mixin; + +import net.minecraft.client.network.ClientPlayerEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(ClientPlayerEntity.class) +public interface ClientPlayerEntityAccessor { + @Accessor("ticksSinceLastPositionPacketSent") + void setTicksSinceLastPositionPacketSent(int ticks); +} \ No newline at end of file diff --git a/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketAccessor.java b/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketAccessor.java new file mode 100644 index 0000000..434476d --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketAccessor.java @@ -0,0 +1,17 @@ +package dev.coredoes.coreclient.mixin; + +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(PlayerMoveC2SPacket.class) +public interface PlayerMoveC2SPacketAccessor { + @Mutable + @Accessor("y") + void setY(double y); + + @Mutable + @Accessor("onGround") + void setOnGround(boolean onGround); +} \ No newline at end of file diff --git a/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketFullMixin.java b/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketFullMixin.java index de9902b..f7307d1 100644 --- a/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketFullMixin.java +++ b/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketFullMixin.java @@ -1,6 +1,9 @@ package dev.coredoes.coreclient.mixin; +import dev.coredoes.coreclient.CoreClient; import dev.coredoes.coreclient.module.bypass.BotMovement; +import dev.coredoes.coreclient.module.bypass.WorldguardMovebypass; +import net.minecraft.client.MinecraftClient; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -11,6 +14,27 @@ import org.spongepowered.asm.mixin.injection.invoke.arg.Args; public abstract class PlayerMoveC2SPacketFullMixin { @ModifyArgs(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;(DDDFFZZZ)V")) private static void init(Args args) { + CoreClient.LOGGER.info("X: {}", (double) args.get(0)); + + assert MinecraftClient.getInstance().player != null; + + if (WorldguardMovebypass.getInstance().isEnabled().isOn()) { + if ((double) args.get(0) < 0) { args.set(0, MinecraftClient.getInstance().player.getPos().getX() - (double) WorldguardMovebypass.maxMoveAmount.getValue()); } + if ((double) args.get(0) > 0) { args.set(0, MinecraftClient.getInstance().player.getPos().getX() + (double) WorldguardMovebypass.maxMoveAmount.getValue()); } + + if ((double) args.get(1) < 0) { args.set(1, MinecraftClient.getInstance().player.getPos().getY() - WorldguardMovebypass.maxMoveAmount.getValue()); } + if ((double) args.get(1) > 0) { args.set(1, MinecraftClient.getInstance().player.getPos().getY() + WorldguardMovebypass.maxMoveAmount.getValue()); } + + if ((double) args.get(2) < 0) { args.set(2, MinecraftClient.getInstance().player.getPos().getZ() - WorldguardMovebypass.maxMoveAmount.getValue()); } + if ((double) args.get(2) > 0) { args.set(2, MinecraftClient.getInstance().player.getPos().getZ() + WorldguardMovebypass.maxMoveAmount.getValue()); } + + if ((double) args.get(3) < 0) { args.set(3, 0); } + if ((double) args.get(3) > 0) { args.set(3, 0); } + + if ((double) args.get(4) < 0) { args.set(4, 0); } + if ((double) args.get(4) > 0) { args.set(4, 0); } + } + if (BotMovement.getInstance().isEnabled().isOn()) { double newX = Math.round((double) args.get(0) * 100) / 100d; double newZ = Math.round((double) args.get(2) * 100) / 100d; diff --git a/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketLookMixin.java b/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketLookMixin.java index 7905aa1..ce40a30 100644 --- a/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketLookMixin.java +++ b/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketLookMixin.java @@ -1,5 +1,7 @@ package dev.coredoes.coreclient.mixin; +import dev.coredoes.coreclient.module.bypass.WorldguardMovebypass; +import net.minecraft.client.MinecraftClient; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -10,6 +12,25 @@ import org.spongepowered.asm.mixin.injection.invoke.arg.Args; public abstract class PlayerMoveC2SPacketLookMixin { @ModifyArgs(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;(DDDFFZZZ)V")) private static void init(Args args) { + assert MinecraftClient.getInstance().player != null; + + if (WorldguardMovebypass.getInstance().isEnabled().isOn()) { + if ((double) args.get(0) < 0) { args.set(0, MinecraftClient.getInstance().player.getPos().getX() - WorldguardMovebypass.maxMoveAmount.getValue()); } + if ((double) args.get(0) > 0) { args.set(0, MinecraftClient.getInstance().player.getPos().getX() + WorldguardMovebypass.maxMoveAmount.getValue()); } + + if ((double) args.get(1) < 0) { args.set(1, MinecraftClient.getInstance().player.getPos().getY() - WorldguardMovebypass.maxMoveAmount.getValue()); } + if ((double) args.get(1) > 0) { args.set(1, MinecraftClient.getInstance().player.getPos().getY() + WorldguardMovebypass.maxMoveAmount.getValue()); } + + if ((double) args.get(2) < 0) { args.set(2, MinecraftClient.getInstance().player.getPos().getZ() - WorldguardMovebypass.maxMoveAmount.getValue()); } + if ((double) args.get(2) > 0) { args.set(2, MinecraftClient.getInstance().player.getPos().getZ() + WorldguardMovebypass.maxMoveAmount.getValue()); } + + if ((double) args.get(3) < 0) { args.set(3, 0); } + if ((double) args.get(3) > 0) { args.set(3, 0); } + + if ((double) args.get(4) < 0) { args.set(4, 0); } + if ((double) args.get(4) > 0) { args.set(4, 0); } + } + /*if (((NoFall) ClientMod.moduleManager.getModuleById("NoFall")).isEnabled()) { args.set(5, true); }*/ diff --git a/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketOnGroundMixin.java b/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketOnGroundMixin.java index 2d86806..01e3cf4 100644 --- a/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketOnGroundMixin.java +++ b/src/main/java/dev/coredoes/coreclient/mixin/PlayerMoveC2SPacketOnGroundMixin.java @@ -1,6 +1,8 @@ package dev.coredoes.coreclient.mixin; import dev.coredoes.coreclient.module.bypass.BotMovement; +import dev.coredoes.coreclient.module.bypass.WorldguardMovebypass; +import net.minecraft.client.MinecraftClient; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -11,6 +13,25 @@ import org.spongepowered.asm.mixin.injection.invoke.arg.Args; public abstract class PlayerMoveC2SPacketOnGroundMixin { @ModifyArgs(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;(DDDFFZZZ)V")) private static void init(Args args) { + assert MinecraftClient.getInstance().player != null; + + if (WorldguardMovebypass.getInstance().isEnabled().isOn()) { + if ((double) args.get(0) < 0) { args.set(0, MinecraftClient.getInstance().player.getPos().getX() - WorldguardMovebypass.maxMoveAmount.getValue()); } + if ((double) args.get(0) > 0) { args.set(0, MinecraftClient.getInstance().player.getPos().getX() + WorldguardMovebypass.maxMoveAmount.getValue()); } + + if ((double) args.get(1) < 0) { args.set(1, MinecraftClient.getInstance().player.getPos().getY() - WorldguardMovebypass.maxMoveAmount.getValue()); } + if ((double) args.get(1) > 0) { args.set(1, MinecraftClient.getInstance().player.getPos().getY() + WorldguardMovebypass.maxMoveAmount.getValue()); } + + if ((double) args.get(2) < 0) { args.set(2, MinecraftClient.getInstance().player.getPos().getZ() - WorldguardMovebypass.maxMoveAmount.getValue()); } + if ((double) args.get(2) > 0) { args.set(2, MinecraftClient.getInstance().player.getPos().getZ() + WorldguardMovebypass.maxMoveAmount.getValue()); } + + if ((double) args.get(3) < 0) { args.set(3, 0); } + if ((double) args.get(3) > 0) { args.set(3, 0); } + + if ((double) args.get(4) < 0) { args.set(4, 0); } + if ((double) args.get(4) > 0) { args.set(4, 0); } + } + if (BotMovement.getInstance().isEnabled().isOn()) { double newX = Math.round((double) args.get(0) * 100) / 100d; double newZ = Math.round((double) args.get(2) * 100) / 100d; diff --git a/src/main/java/dev/coredoes/coreclient/module/bypass/NewLOButton.java b/src/main/java/dev/coredoes/coreclient/module/bypass/NewLOButton.java new file mode 100644 index 0000000..c721415 --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/module/bypass/NewLOButton.java @@ -0,0 +1,38 @@ +package dev.coredoes.coreclient.module.bypass; + +import com.lukflug.panelstudio.base.IBoolean; +import dev.coredoes.coreclient.CoreClient; +import dev.coredoes.coreclient.event.ConnectEvent; +import dev.coredoes.coreclient.event.PacketEvent; +import dev.coredoes.coreclient.gui.module.Module; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.client.MinecraftClient; +import net.minecraft.network.packet.s2c.play.*; + +public class NewLOButton extends Module { + private static NewLOButton instance; + + public NewLOButton() { + super("NewLOButton", "Solve the New LO button challenge (1337 -1337)", () -> true, true, false); + + CoreClient.eventBus.subscribe(this); + + instance = this; + } + + @EventHandler + public void onPacketRecieved(PacketEvent.Receive e) { + if (isEnabled().isOn()) { + if (e.packet instanceof UnloadChunkS2CPacket pkt) { + assert MinecraftClient.getInstance().player != null; + if (pkt.getX() == MinecraftClient.getInstance().player.getChunkPos().x && pkt.getZ() == MinecraftClient.getInstance().player.getChunkPos().z) { + e.cancel(); + } + } + } + } + + public static NewLOButton getInstance() { + return instance; + } +} diff --git a/src/main/java/dev/coredoes/coreclient/module/bypass/WorldguardMovebypass.java b/src/main/java/dev/coredoes/coreclient/module/bypass/WorldguardMovebypass.java new file mode 100644 index 0000000..303ba5c --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/module/bypass/WorldguardMovebypass.java @@ -0,0 +1,27 @@ +package dev.coredoes.coreclient.module.bypass; + +import dev.coredoes.coreclient.CoreClient; +import dev.coredoes.coreclient.gui.module.Module; +import dev.coredoes.coreclient.gui.setting.DoubleSetting; + +public class WorldguardMovebypass extends Module { + private static WorldguardMovebypass instance; + + public static DoubleSetting maxMoveAmount; + + public WorldguardMovebypass() { + super("WorldguardBypass", "Bypass worldguard movement", () -> true, true, false); + + maxMoveAmount = new DoubleSetting("Move amount", "moveAmount", "Maximum amount to move", () -> true, 0.0, 1.0, 0.0034); + + settings.add(maxMoveAmount); + + CoreClient.eventBus.subscribe(this); + + instance = this; + } + + public static WorldguardMovebypass getInstance() { + return instance; + } +} diff --git a/src/main/java/dev/coredoes/coreclient/module/exploit/ButtonClicker.java b/src/main/java/dev/coredoes/coreclient/module/exploit/ButtonClicker.java new file mode 100644 index 0000000..08569f5 --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/module/exploit/ButtonClicker.java @@ -0,0 +1,65 @@ +package dev.coredoes.coreclient.module.bypass; + +import com.lukflug.panelstudio.base.IToggleable; +import dev.coredoes.coreclient.CoreClient; +import dev.coredoes.coreclient.gui.module.Module; +import dev.coredoes.coreclient.gui.setting.DoubleSetting; +import dev.coredoes.coreclient.gui.setting.StringSetting; +import net.minecraft.client.MinecraftClient; +import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; + +public class ButtonClicker extends Module { + private static ButtonClicker instance; + + public static StringSetting x; + public static StringSetting y; + public static StringSetting z; + private boolean enabled; + + public ButtonClicker() { + super("ButtonClicker", "Click a button", () -> true, true, false); + + // 1336 66 -1335 + + x = new StringSetting("X", "x_coord", "X coordinate", () -> true, "1336"); + y = new StringSetting("Y", "y_coord", "Y coordinate", () -> true, "66"); + z = new StringSetting("Z", "z_coord", "Z coordinate", () -> true, "-1335"); + + settings.add(x); + settings.add(y); + settings.add(z); + + CoreClient.eventBus.subscribe(this); + + instance = this; + } + + public static ButtonClicker getInstance() { + return instance; + } + + @Override + public IToggleable isEnabled() { + return new IToggleable() { + @Override + public boolean isOn() { + return false; + } + + @Override + public void toggle() { + BlockPos blockPos = new BlockPos(Integer.parseInt(x.getValue()), Integer.parseInt(y.getValue()), Integer.parseInt(z.getValue())); + Direction direction = Direction.UP; + BlockHitResult blockHitResult = new BlockHitResult(new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()), direction, blockPos, false); + + assert MinecraftClient.getInstance().interactionManager != null; + MinecraftClient.getInstance().interactionManager.interactBlock(MinecraftClient.getInstance().player, Hand.MAIN_HAND, blockHitResult); + } + }; + } +} diff --git a/src/main/java/dev/coredoes/coreclient/module/misc/PacketLogger.java b/src/main/java/dev/coredoes/coreclient/module/misc/PacketLogger.java index 470bb76..7943d94 100644 --- a/src/main/java/dev/coredoes/coreclient/module/misc/PacketLogger.java +++ b/src/main/java/dev/coredoes/coreclient/module/misc/PacketLogger.java @@ -1,4 +1,4 @@ -package dev.coredoes.coreclient.module.bypass; +package dev.coredoes.coreclient.module.misc; import com.lukflug.panelstudio.base.IBoolean; import dev.coredoes.coreclient.CoreClient; @@ -6,6 +6,8 @@ import dev.coredoes.coreclient.event.ConnectEvent; import dev.coredoes.coreclient.event.PacketEvent; import dev.coredoes.coreclient.gui.module.Module; import meteordevelopment.orbit.EventHandler; +import net.minecraft.client.MinecraftClient; +import net.minecraft.network.packet.s2c.play.*; public class PacketLogger extends Module { private static PacketLogger instance; @@ -21,7 +23,22 @@ public class PacketLogger extends Module { @EventHandler public void onPacketRecieved(PacketEvent.Receive e) { if (isEnabled().isOn()) { - CoreClient.LOGGER.debug("pkt", e.packet); + if (e.packet instanceof PlayerListS2CPacket) return; + if (e.packet instanceof EntityS2CPacket) return; + if (e.packet instanceof EntityTrackerUpdateS2CPacket) return; + if (e.packet instanceof EntityVelocityUpdateS2CPacket) return; + if (e.packet instanceof EntitySetHeadYawS2CPacket) return; + if (e.packet instanceof EntityStatusS2CPacket) return; + if (e.packet instanceof EntityPositionS2CPacket) return; + if (e.packet instanceof HealthUpdateS2CPacket) return; + CoreClient.LOGGER.info("pkt received {}", e.packet.toString()); + + /*if (e.packet instanceof UnloadChunkS2CPacket pkt) { + assert MinecraftClient.getInstance().player != null; + if (pkt.getX() == MinecraftClient.getInstance().player.getChunkPos().x && pkt.getZ() == MinecraftClient.getInstance().player.getChunkPos().z) { + e.cancel(); + } + }*/ } } diff --git a/src/main/java/dev/coredoes/coreclient/module/movement/CreativeFlight.java b/src/main/java/dev/coredoes/coreclient/module/movement/CreativeFlight.java new file mode 100644 index 0000000..ee8e1ca --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/module/movement/CreativeFlight.java @@ -0,0 +1,176 @@ +package dev.coredoes.coreclient.module.movement; + +import com.lukflug.panelstudio.base.IToggleable; +import dev.coredoes.coreclient.CoreClient; +import dev.coredoes.coreclient.event.PacketEvent; +import dev.coredoes.coreclient.event.TickEvent; +import dev.coredoes.coreclient.gui.module.Module; +import dev.coredoes.coreclient.gui.setting.BooleanSetting; +import dev.coredoes.coreclient.gui.setting.DoubleSetting; +import dev.coredoes.coreclient.gui.setting.IntegerSetting; +import dev.coredoes.coreclient.gui.setting.KeybindSetting; +import dev.coredoes.coreclient.mixin.ClientPlayerEntityAccessor; +import dev.coredoes.coreclient.mixin.PlayerMoveC2SPacketAccessor; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.block.AbstractBlock; +import net.minecraft.client.MinecraftClient; +import net.minecraft.entity.Entity; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import org.lwjgl.glfw.GLFW; + +import java.util.Objects; + +public class CreativeFlight extends Module { + private static CreativeFlight instance; + private static boolean enabled; + + public static final KeybindSetting keybind=new KeybindSetting("Keybind","keybind","The key to toggle the module.",()->true, GLFW.GLFW_KEY_F25); + public static final BooleanSetting antikick = new BooleanSetting("Anti-Kick", "antikick", "Prevent vanilla antifly", () -> true, true); + public static final IntegerSetting delay = new IntegerSetting("Delay", "delay", "The amount of delay in ticks between flying down a bit and returning to original position", () -> true, 1, 200, 20); + public static final IntegerSetting offTime = new IntegerSetting("Off Time", "offtime", "The amount of delay, in milliseconds, to fly down a bit to reset floating ticks.", () -> true, 1, 20, 1); + + private int delayLeft = delay.getValue(); + private int offLeft = offTime.getValue(); + private boolean flip; + private float lastYaw; + private double lastPacketY = Double.MAX_VALUE; + + public CreativeFlight() { + super("CreativeFlight", "Enable creative mode flight", () -> true, true, false); + + settings.add(keybind); + settings.add(antikick); + settings.add(delay); + settings.add(offTime); + + enabled=false; + instance = this; + + CoreClient.eventBus.subscribe(this); + } + + @EventHandler + private void onPreTick(TickEvent.Pre e) { + if (MinecraftClient.getInstance().player == null) { + return; + } + assert MinecraftClient.getInstance().player != null; + float currentYaw = MinecraftClient.getInstance().player.getYaw(); + if (MinecraftClient.getInstance().player.fallDistance >= 3f && currentYaw == lastYaw && MinecraftClient.getInstance().player.getVelocity().length() < 0.003d) { + MinecraftClient.getInstance().player.setYaw(currentYaw + (flip ? 1 : -1)); + flip = !flip; + } + lastYaw = currentYaw; + } + + @EventHandler + private void onPostTick(TickEvent.Post e) { + if (MinecraftClient.getInstance().player == null) { + return; + } + + MinecraftClient.getInstance().player.getAbilities().allowFlying = enabled; + + if (delayLeft > 0) delayLeft--; + + if (offLeft <= 0 && delayLeft <= 0) { + delayLeft = delay.getValue(); + offLeft = offTime.getValue(); + + assert MinecraftClient.getInstance().player != null; + ((ClientPlayerEntityAccessor) MinecraftClient.getInstance().player).setTicksSinceLastPositionPacketSent(20); + } else if (delayLeft <= 0) { + if (offLeft == offTime.getValue()) { + assert MinecraftClient.getInstance().player != null; + ((ClientPlayerEntityAccessor) MinecraftClient.getInstance().player).setTicksSinceLastPositionPacketSent(20); + } + + offLeft--; + } + + if (MinecraftClient.getInstance().player.getYaw() != lastYaw) MinecraftClient.getInstance().player.setYaw(lastYaw); + } + + private boolean shouldFlyDown(double currentY, double lastY) { + if (currentY >= lastY) { + return true; + } else return lastY - currentY < 0.03130D; + } + + private boolean isEntityOnAir(Entity entity) { + return entity.getWorld().getStatesInBox(entity.getBoundingBox().expand(0.0625).stretch(0.0, -0.55, 0.0)).allMatch(AbstractBlock.AbstractBlockState::isAir); + } + + private void antiKickPacket(PlayerMoveC2SPacket packet, double currentY) { + // maximum time we can be "floating" is 80 ticks, so 4 seconds max + if (this.delayLeft <= 0 && this.lastPacketY != Double.MAX_VALUE && + shouldFlyDown(currentY, this.lastPacketY) && isEntityOnAir(MinecraftClient.getInstance().player)) { + // actual check is for >= -0.03125D, but we have to do a bit more than that + // due to the fact that it's a bigger or *equal* to, and not just a bigger than + + ((PlayerMoveC2SPacketAccessor) packet).setY(lastPacketY - 0.03130D); + } else { + lastPacketY = currentY; + } + } + + @EventHandler + private void onSendPacket(PacketEvent.Send e) { + if (MinecraftClient.getInstance().player == null) { + return; + } + + if (!(e.packet instanceof PlayerMoveC2SPacket packet) || !CreativeFlight.antikick.isOn()) return; + + double currentY = packet.getY(Double.MAX_VALUE); + + if (currentY != Double.MAX_VALUE) { + antiKickPacket(packet, currentY); + } else { + PlayerMoveC2SPacket fullPacket; + if (packet.changesLook()) { + assert MinecraftClient.getInstance().player != null; + fullPacket = new PlayerMoveC2SPacket.Full( + MinecraftClient.getInstance().player.getX(), + MinecraftClient.getInstance().player.getY(), + MinecraftClient.getInstance().player.getZ(), + packet.getYaw(0), + packet.getPitch(0), + packet.isOnGround() + ); + } else { + assert MinecraftClient.getInstance().player != null; + fullPacket = new PlayerMoveC2SPacket.PositionAndOnGround( + MinecraftClient.getInstance().player.getX(), + MinecraftClient.getInstance().player.getY(), + MinecraftClient.getInstance().player.getZ(), + packet.isOnGround() + ); + } + e.cancel(); + antiKickPacket(fullPacket, MinecraftClient.getInstance().player.getY()); + Objects.requireNonNull(MinecraftClient.getInstance().getNetworkHandler()).sendPacket(fullPacket); + } + } + + public static CreativeFlight getInstance() { + return instance; + } + + @Override + public IToggleable isEnabled() { + return new IToggleable() { + @Override + public boolean isOn() { + return enabled; + } + + @Override + public void toggle() { + if (toggleable) { + enabled=!enabled; + } + } + }; + } +} diff --git a/src/main/java/dev/coredoes/coreclient/module/movement/Jetpack.java b/src/main/java/dev/coredoes/coreclient/module/movement/Jetpack.java new file mode 100644 index 0000000..b923528 --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/module/movement/Jetpack.java @@ -0,0 +1,46 @@ +package dev.coredoes.coreclient.module.movement; + +import com.lukflug.panelstudio.base.IToggleable; +import dev.coredoes.coreclient.CoreClient; +import dev.coredoes.coreclient.gui.module.Module; +import dev.coredoes.coreclient.gui.setting.KeybindSetting; +import net.minecraft.client.MinecraftClient; +import org.lwjgl.glfw.GLFW; + +public class Jetpack extends Module { + private static Jetpack instance; + private static boolean enabled; + + public static final KeybindSetting keybind=new KeybindSetting("Keybind","keybind","The key to toggle the module.",()->true, GLFW.GLFW_KEY_F25); + + public Jetpack() { + super("Jetpack", "Zoom!", () -> true, true, false); + + enabled=false; + instance = this; + } + + // 1327 63 -1335 + // 1336 66 -1335 + + public static Jetpack getInstance() { + return instance; + } + + @Override + public IToggleable isEnabled() { + return new IToggleable() { + @Override + public boolean isOn() { + return enabled; + } + + @Override + public void toggle() { + if (toggleable) { + enabled=!enabled; + } + } + }; + } +} diff --git a/src/main/java/dev/coredoes/coreclient/module/movement/NoFall.java b/src/main/java/dev/coredoes/coreclient/module/movement/NoFall.java new file mode 100644 index 0000000..0cdbf47 --- /dev/null +++ b/src/main/java/dev/coredoes/coreclient/module/movement/NoFall.java @@ -0,0 +1,42 @@ +package dev.coredoes.coreclient.module.movement; + +import dev.coredoes.coreclient.CoreClient; +import dev.coredoes.coreclient.event.PacketEvent; +import dev.coredoes.coreclient.gui.module.Module; +import dev.coredoes.coreclient.gui.setting.KeybindSetting; +import dev.coredoes.coreclient.mixin.PlayerMoveC2SPacketAccessor; +import dev.coredoes.coreclient.module.misc.PacketLogger; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.minecraft.network.packet.s2c.play.*; +import org.lwjgl.glfw.GLFW; + +public class NoFall extends Module { + private static NoFall instance; + + public static final KeybindSetting keybind=new KeybindSetting("Keybind","keybind","The key to toggle the module.",()->true, GLFW.GLFW_KEY_F25); + + + public NoFall() { + super("NoFall", "Poof goes the fall damage", () -> true, true, false); + + CoreClient.eventBus.subscribe(this); + + settings.add(keybind); + + instance = this; + } + + @EventHandler + public void onPacketSend(PacketEvent.Send e) { + if (isEnabled().isOn()) { + if (e.packet instanceof PlayerMoveC2SPacket) { + ((PlayerMoveC2SPacketAccessor) e.packet).setOnGround(true); + } + } + } + + public static NoFall getInstance() { + return instance; + } +} diff --git a/src/main/resources/coreclient.mixins.json b/src/main/resources/coreclient.mixins.json index 7005870..3c74251 100644 --- a/src/main/resources/coreclient.mixins.json +++ b/src/main/resources/coreclient.mixins.json @@ -4,12 +4,17 @@ "package": "dev.coredoes.coreclient.mixin", "compatibilityLevel": "JAVA_17", "client": [ + "ClientBrandRetrieverMixin", + "ClientConnectionMixin", + "ClientPlayerEntityAccessor", "PlayerMoveC2SPacketFullMixin", "PlayerMoveC2SPacketLookMixin", - "PlayerMoveC2SPacketOnGroundMixin", - "ClientConnectionMixin" + "PlayerMoveC2SPacketOnGroundMixin" ], "injectors": { "defaultRequire": 1 - } + }, + "mixins": [ + "PlayerMoveC2SPacketAccessor" + ] }