blob: 024f5c47d474168152061bfdc88d87b88c6045e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
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.Minecraft;
import net.minecraft.commands.CommandBuildContext;
public class HackXP {
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandBuildContext access) {
dispatcher.register(ClientCommandManager.literal("hackxp")
.then(ClientCommandManager.argument("xp", IntegerArgumentType.integer())
.executes(HackXP::run)
)
);
}
private static int run(CommandContext<FabricClientCommandSource> context) throws CommandSyntaxException {
int xp = IntegerArgumentType.getInteger(context,"xp");
if (Minecraft.getInstance().player == null) return -1;
Minecraft.getInstance().player.experienceLevel += xp;
return 1;
}
}
|