28 lines
1.2 KiB
Java
28 lines
1.2 KiB
Java
|
package com.thebrokenrail.reliccraft.mixin;
|
||
|
|
||
|
import com.mojang.brigadier.CommandDispatcher;
|
||
|
import com.thebrokenrail.reliccraft.RelicCraft;
|
||
|
import net.minecraft.server.command.CommandManager;
|
||
|
import net.minecraft.server.command.LocateCommand;
|
||
|
import net.minecraft.server.command.ServerCommandSource;
|
||
|
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;
|
||
|
|
||
|
@SuppressWarnings("unused")
|
||
|
@Mixin(LocateCommand.class)
|
||
|
public abstract class MixinLocateCommand {
|
||
|
@Shadow
|
||
|
private static int execute(ServerCommandSource source, String structure) {
|
||
|
throw new UnsupportedOperationException();
|
||
|
}
|
||
|
|
||
|
@Inject(method = "register", at = @At(value = "RETURN"))
|
||
|
private static void onRegister(CommandDispatcher<ServerCommandSource> dispatcher, CallbackInfo info) {
|
||
|
dispatcher.register(CommandManager.literal("locate").requires(source -> source.hasPermissionLevel(2))
|
||
|
.then(CommandManager.literal("RelicCraft_Time_Temple").executes(ctx -> execute(ctx.getSource(), RelicCraft.TIME_TEMPLE_ID))));
|
||
|
}
|
||
|
}
|