From 14c68eb5ba16774f581d95a39e64a7b303954ffc Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Sat, 26 Sep 2026 17:05:36 +1200 Subject: migration to 26.2 - run migrateMappings with old loom then bring it back to new --- .../arslaansmagichax/commands/CrashCommand.java | 49 ------ .../arslaansmagichax/commands/HackGive.java | 46 ------ .../arslaansmagichax/commands/HackSetblock.java | 78 --------- .../arslaansmagichax/commands/HackTP.java | 184 --------------------- .../arslaansmagichax/commands/HackXP.java | 35 ---- .../commands/ModuleSuggestionProvider.java | 26 --- .../commands/ModuleToggleCommand.java | 44 ----- 7 files changed, 462 deletions(-) delete mode 100644 src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/CrashCommand.java delete mode 100644 src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackGive.java delete mode 100644 src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackSetblock.java delete mode 100644 src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackTP.java delete mode 100644 src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackXP.java delete mode 100644 src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/ModuleSuggestionProvider.java delete mode 100644 src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/ModuleToggleCommand.java (limited to 'src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands') diff --git a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/CrashCommand.java b/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/CrashCommand.java deleted file mode 100644 index 0129366..0000000 --- a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/CrashCommand.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.arslaancodes.arslaansmagichax.commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.client.MinecraftClient; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; - -public class CrashCommand { - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess access) { - dispatcher.register(ClientCommandManager.literal("surprise") - .executes(CrashCommand::run) - ); - } - - private static int run(CommandContext ctx) { - MinecraftClient client = MinecraftClient.getInstance(); - - client.execute(() -> { - client.player.playSound( - SoundEvent.of(Identifier.of("minecraft:entity.evoker.prepare_wololo")), - 1.0f, // volume - 1.0f // pitch - ); - }); - - new Thread(() -> { - try { Thread.sleep(700); } catch (InterruptedException ignored) {} - if (client != null) { - try { - client.player = null; - client.cameraEntity = null; - client.currentScreen = null; - client.crosshairTarget = null; - client.targetedEntity = null; - } catch (Throwable ignored) {} - } - Runtime.getRuntime().halt(1); - }, "surprise-halt-thread").start(); - - return 1; - } -} diff --git a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackGive.java b/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackGive.java deleted file mode 100644 index ea2e1d9..0000000 --- a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackGive.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.arslaancodes.arslaansmagichax.commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.block.Block; -import net.minecraft.client.MinecraftClient; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; - -public class HackGive { - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess access) { - dispatcher.register(ClientCommandManager.literal("hackgive") - .then(ClientCommandManager.argument("item", StringArgumentType.string()) - .then(ClientCommandManager.argument("amount", IntegerArgumentType.integer(1)) - .executes(HackGive::run) - ) - ) - ); - } - - private static int run(CommandContext context) throws CommandSyntaxException { - MinecraftClient client = MinecraftClient.getInstance(); - if (client.world == null || client.player == null) return 0; - - String itemId = StringArgumentType.getString(context, "item"); - int amount = IntegerArgumentType.getInteger(context, "amount"); - Item item = Registries.ITEM.get(Identifier.of(itemId)); - if (item == null) { - context.getSource().sendError(Text.literal("Unknown item: " + itemId)); - return 0; - } - - ItemStack stack = new ItemStack(item, amount); - client.player.getInventory().insertStack(stack); - return 1; - } -} diff --git a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackSetblock.java b/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackSetblock.java deleted file mode 100644 index aba8bb6..0000000 --- a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackSetblock.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.arslaancodes.arslaansmagichax.commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.context.CommandContext; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.registry.Registries; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; - -public class HackSetblock { - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess access) { - dispatcher.register(ClientCommandManager.literal("hacksetblock") - .then(ClientCommandManager.argument("block", StringArgumentType.string()) - // Case: just block -> place at player's feet - .executes(HackSetblock::runAtFeet) - - // Case: block + xyz -> place at given position - .then(ClientCommandManager.argument("x", IntegerArgumentType.integer()) - .then(ClientCommandManager.argument("y", IntegerArgumentType.integer()) - .then(ClientCommandManager.argument("z", IntegerArgumentType.integer()) - .executes(HackSetblock::runAtPos) - ) - ) - ) - ) - ); - } - - private static int runAtFeet(CommandContext context) { - MinecraftClient client = MinecraftClient.getInstance(); - if (client.world == null || client.player == null) return 0; - - String blockId = StringArgumentType.getString(context, "block"); - Block block = Registries.BLOCK.get(Identifier.of(blockId)); - if (block == null) { - context.getSource().sendError(Text.literal("Unknown block: " + blockId)); - return 0; - } - - BlockPos pos = client.player.getBlockPos(); - BlockState blockState = block.getDefaultState(); - - client.world.setBlockState(pos, blockState); - - return 1; - } - - private static int runAtPos(CommandContext context) { - MinecraftClient client = MinecraftClient.getInstance(); - if (client.world == null) return 0; - - String blockId = StringArgumentType.getString(context, "block"); - int x = IntegerArgumentType.getInteger(context, "x"); - int y = IntegerArgumentType.getInteger(context, "y"); - int z = IntegerArgumentType.getInteger(context, "z"); - - Block block = Registries.BLOCK.get(Identifier.of(blockId)); - if (block == null) { - context.getSource().sendError(Text.literal("Unknown block: " + blockId)); - return 0; - } - - BlockPos pos = new BlockPos(x, y, z); - BlockState blockState = block.getDefaultState(); - - client.world.setBlockState(pos, blockState); - - return 1; - } -} diff --git a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackTP.java b/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackTP.java deleted file mode 100644 index 8e11635..0000000 --- a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackTP.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.arslaancodes.arslaansmagichax.commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; -import net.minecraft.text.Text; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.LinkedList; -import java.util.Queue; - -public class HackTP { - private static final Queue stepQueue = new LinkedList<>(); - private static int packetsPerTick = 5; - - public static BlockPos findClosestAirNearPosition(int x, int y, int z) { - World world = MinecraftClient.getInstance().world; - if (world == null) return null; - - for (int blockY = y; blockY <= world.getHeight(); blockY++) { - BlockPos pos = new BlockPos(x, blockY, z); - if (world.getBlockState(pos).isAir() && world.getBlockState(pos.up()).isAir()) { - return pos; - } - } - - for (int blockY = y; blockY >= 0; blockY--) { - BlockPos pos = new BlockPos(x, blockY, z); - if (world.getBlockState(pos).isAir() && world.getBlockState(pos.up()).isAir()) { - return pos; - } - } - return null; - } - - private static int computeSafePacketsPerTick(int requestedSpeed) { - final int STEP_HORIZ = 2; - final double SAFE_HORIZ = 8.5; // server maximum horizontal move - - int allowed = (int) Math.floor(SAFE_HORIZ / STEP_HORIZ); - if (allowed < 1) allowed = 1; - - return Math.max(1, Math.min(requestedSpeed, allowed)); - } - - private static double parseCoordinate(String arg, double current) { - if (arg.startsWith("c")) { - if (arg.length() == 1) return current; - return current + Double.parseDouble(arg.substring(1)); - } else { - return Double.parseDouble(arg); - } - } - - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess access) { - dispatcher.register(ClientCommandManager.literal("hacktp") - .then(ClientCommandManager.argument("x", StringArgumentType.word()) - .then(ClientCommandManager.argument("y", StringArgumentType.word()) - .then(ClientCommandManager.argument("z", StringArgumentType.word()) - .then(ClientCommandManager.argument("speed", IntegerArgumentType.integer(0, 25)) - .executes(HackTP::run) - ) - ) - ) - ) - ); - -// ClientTickEvents.END_CLIENT_TICK.register(client -> { -// if (!stepQueue.isEmpty() && client.player != null) { -// double[] pos = stepQueue.poll(); -// -// client.getNetworkHandler().sendPacket( -// new PlayerMoveC2SPacket.PositionAndOnGround(pos[0], pos[1], pos[2], true, client.player.horizontalCollision) -// ); -// -// client.player.setPos(pos[0], pos[1], pos[2]); -// -// client.player.sendMessage(Text.literal("Teleported to " + pos[0] + " " + pos[1] + " " + pos[2]), false); -// } -// }); - ClientTickEvents.END_CLIENT_TICK.register(client -> { - if (!stepQueue.isEmpty() && client.player != null) { - for (int i = 0; i < packetsPerTick && !stepQueue.isEmpty(); i++) { - double[] pos = stepQueue.poll(); - -// client.getNetworkHandler().sendPacket( -// new PlayerMoveC2SPacket.PositionAndOnGround( -// pos[0], pos[1], pos[2], true, client.player.horizontalCollision -// ) -// ); - - client.player.setPos(pos[0], pos[1], pos[2]); - - client.player.sendMessage(Text.literal("Teleported to " + pos[0] + " " + pos[1] + " " + pos[2] + " with packetsPerTick/speed " + packetsPerTick), false); - } - } - }); - } - - private static int run(CommandContext context) throws CommandSyntaxException { - int speed = IntegerArgumentType.getInteger(context, "speed"); - - ClientPlayerEntity player = context.getSource().getPlayer(); - if (player == null) { - context.getSource().sendFeedback(Text.literal("No player found.")); - return -1; - } - - double currentX = player.getX(); - double currentY = player.getY(); - double currentZ = player.getZ(); - - String xArg = context.getArgument("x", String.class); - String yArg = context.getArgument("y", String.class); - String zArg = context.getArgument("z", String.class); - - double targetX = parseCoordinate(xArg, currentX); - double targetY = parseCoordinate(yArg, currentY); - double targetZ = parseCoordinate(zArg, currentZ); - - if (speed < 1) { - packetsPerTick = computeSafePacketsPerTick(packetsPerTick); - } else { - packetsPerTick = computeSafePacketsPerTick(speed); - } - - context.getSource().sendFeedback(Text.literal("Using " + packetsPerTick + " packets/tick (requested " + speed + ")")); - - int stepX = (targetX > currentX) ? 2 : -2; - int stepY = (targetY > currentY) ? 2 : -2; - int stepZ = (targetZ > currentZ) ? 2 : -2; - - for (int i = 1; i <= 8; i++) { - stepQueue.add(new double[]{currentX, currentY, currentZ}); // I don't know how this works but it makes Y more reliable (go through more blocks on the Y axis?) - } - while ((stepY > 0 && currentY < targetY) || (stepY < 0 && currentY > targetY)) { - currentY += stepY; - if ((stepY > 0 && currentY > targetY) || (stepY < 0 && currentY < targetY)) currentY = targetY; - stepQueue.add(new double[]{currentX, currentY, currentZ}); - context.getSource().sendFeedback(Text.literal( - "Queued teleport to " + currentX + " " + currentY + " " + currentZ - )); - } - - while ((stepX > 0 && currentX < targetX) || (stepX < 0 && currentX > targetX)) { - currentX += stepX; - if ((stepX > 0 && currentX > targetX) || (stepX < 0 && currentX < targetX)) currentX = targetX; - - BlockPos airPos = findClosestAirNearPosition((int) currentX, (int) currentY, (int) currentZ); - if (airPos != null) currentY = airPos.getY(); - - stepQueue.add(new double[]{currentX, currentY, currentZ}); - context.getSource().sendFeedback(Text.literal( - "Queued teleport to " + currentX + " " + currentY + " " + currentZ - )); - } - - while ((stepZ > 0 && currentZ < targetZ) || (stepZ < 0 && currentZ > targetZ)) { - currentZ += stepZ; - if ((stepZ > 0 && currentZ > targetZ) || (stepZ < 0 && currentZ < targetZ)) currentZ = targetZ; - - BlockPos airPos = findClosestAirNearPosition((int) currentX, (int) currentY, (int) currentZ); - if (airPos != null) currentY = airPos.getY(); - - stepQueue.add(new double[]{currentX, currentY, currentZ}); - context.getSource().sendFeedback(Text.literal( - "Queued teleport to " + currentX + " " + currentY + " " + currentZ - )); - } - - return 1; - } -} diff --git a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackXP.java b/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackXP.java deleted file mode 100644 index bbfb818..0000000 --- a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/HackXP.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.arslaancodes.arslaansmagichax.commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.client.MinecraftClient; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.inventory.StackWithSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.network.packet.s2c.play.ExperienceBarUpdateS2CPacket; -import net.minecraft.storage.WriteView; - -public class HackXP { - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess access) { - dispatcher.register(ClientCommandManager.literal("hackxp") - .then(ClientCommandManager.argument("xp", IntegerArgumentType.integer()) - .executes(HackXP::run) - ) - ); - } - - private static int run(CommandContext context) throws CommandSyntaxException { - int xp = IntegerArgumentType.getInteger(context,"xp"); - - if (MinecraftClient.getInstance().player == null) return -1; - MinecraftClient.getInstance().player.experienceLevel += xp; - - return 1; - } -} diff --git a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/ModuleSuggestionProvider.java b/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/ModuleSuggestionProvider.java deleted file mode 100644 index 881ddd6..0000000 --- a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/ModuleSuggestionProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.arslaancodes.arslaansmagichax.commands; - -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.brigadier.suggestion.SuggestionProvider; -import com.mojang.brigadier.suggestion.Suggestions; -import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import com.arslaancodes.arslaansmagichax.modules.Module; -import com.arslaancodes.arslaansmagichax.modules.ModuleManager; - -import java.util.List; -import java.util.concurrent.CompletableFuture; - -public class ModuleSuggestionProvider implements SuggestionProvider { - @Override - public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) throws CommandSyntaxException { - List modules = ModuleManager.getAllModules(); - - for (Module module : modules) { - builder.suggest(module.getName()); - } - - return builder.buildFuture(); - } -} \ No newline at end of file diff --git a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/ModuleToggleCommand.java b/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/ModuleToggleCommand.java deleted file mode 100644 index 6453e4c..0000000 --- a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/commands/ModuleToggleCommand.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.arslaancodes.arslaansmagichax.commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import com.arslaancodes.arslaansmagichax.modules.ModuleManager; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.text.Text; - -public class ModuleToggleCommand { - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess access) { - dispatcher.register( - ClientCommandManager.literal("module") - .then( - ClientCommandManager.literal("toggle") - .then( - ClientCommandManager.argument("moduleName", StringArgumentType.word()) - .suggests(new ModuleSuggestionProvider()) - .executes(ModuleToggleCommand::run) - ) - ) - ); - } - - private static int run(CommandContext context) throws CommandSyntaxException { - String moduleName = StringArgumentType.getString(context, "moduleName"); - - ModuleManager.getAllModules().stream() - .filter(m -> m.getName().equalsIgnoreCase(moduleName)) - .findFirst() - .ifPresentOrElse(module -> { - module.toggle(); - context.getSource().sendFeedback(Text.literal( - "Toggled module " + module.getName() + " to " + (module.isEnabled() ? "ON" : "OFF") - )); - }, () -> context.getSource().sendError(Text.literal("Module not found: " + moduleName))); - - return 1; - } -} -- cgit v1.2.3