6800c24c58
- Commands glue, highlight, and replaceInCommandBlocks now require OP level 2 instead of 0
33 lines
1.1 KiB
Java
33 lines
1.1 KiB
Java
package com.simibubi.create.foundation.command;
|
|
|
|
import com.mojang.brigadier.builder.ArgumentBuilder;
|
|
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity;
|
|
|
|
import net.minecraft.command.CommandSource;
|
|
import net.minecraft.command.Commands;
|
|
import net.minecraft.command.arguments.BlockPosArgument;
|
|
import net.minecraft.util.Direction;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.server.ServerWorld;
|
|
|
|
public class GlueCommand {
|
|
public static ArgumentBuilder<CommandSource, ?> register() {
|
|
return Commands.literal("glue")
|
|
.requires(cs -> cs.hasPermission(2))
|
|
.then(Commands.argument("pos", BlockPosArgument.blockPos())
|
|
//.then(Commands.argument("direction", EnumArgument.enumArgument(Direction.class))
|
|
.executes(ctx -> {
|
|
BlockPos pos = BlockPosArgument.getOrLoadBlockPos(ctx, "pos");
|
|
|
|
ServerWorld world = ctx.getSource().getLevel();
|
|
SuperGlueEntity entity = new SuperGlueEntity(world, pos, Direction.UP);
|
|
|
|
entity.playPlaceSound();
|
|
world.addFreshEntity(entity);
|
|
|
|
return 1;
|
|
}));
|
|
|
|
}
|
|
}
|