Enums
Entity anchor argument
Section titled “Entity anchor argument”The entity anchor argument has two valid inputs: feet and eyes. The resulting LookAnchor is mainly used for methods like
Entity#lookAt(Position, LookAnchor) or
Player#lookAt(Entity, LookAnchor, LookAnchor).
Example usage
Section titled “Example usage”Commands.argument("anchor", ArgumentTypes.entityAnchor()) .executes(context -> { final LookAnchor anchor = context.getArgument("anchor", LookAnchor.class);
context.getSource().getSender().sendRichMessage("You chose <aqua><anchor></aqua>!", Placeholder.unparsed("anchor", anchor.name()) ); return Command.SINGLE_SUCCESS; })In-game preview
Section titled “In-game preview”GameMode argument
Section titled “GameMode argument”The game mode argument works the same way as the first argument of the Vanilla /gamemode <gamemode> command. It accepts any of the 4 valid game modes, returning
a GameMode enum to use in code.
Example usage
Section titled “Example usage”Commands.argument("mode", ArgumentTypes.gameMode()) .executes(context -> { final GameMode mode = context.getArgument("mode", GameMode.class); final Player player = context.getSource().getPlayerOrThrow();
player.setGameMode(mode); player.sendRichMessage("Your gamemode has been set to <red><mode></red>!", Placeholder.component("mode", Component.translatable(mode)) ); return Command.SINGLE_SUCCESS; })In-game preview
Section titled “In-game preview”HeightMap argument
Section titled “HeightMap argument”The HeightMap argument consists of the following, valid inputs: motion_blocking, motion_blocking_no_leaves, ocean_floor, and world_surface. It is often
used for declaring relative positioning for data packs or the /execute positioned over <height_map> command. E.g. world_surface
would mean that the Y coordinate of the surface of the world on the set X/Z values should be used.
Example usage
Section titled “Example usage”Commands.argument("height_map", ArgumentTypes.heightMap()) .executes(context -> { final HeightMap heightMap = context.getArgument("height_map", HeightMap.class);
context.getSource().getSender().sendRichMessage("You selected <gold><selection></gold>", Placeholder.unparsed("selection", heightMap.name()) ); return Command.SINGLE_SUCCESS; })In-game preview
Section titled “In-game preview”Scoreboard display slot argument
Section titled “Scoreboard display slot argument”This argument allows you to retrieve a DisplaySlot enum value from the user.
Example usage
Section titled “Example usage”Commands.argument("slot", ArgumentTypes.scoreboardDisplaySlot()) .executes(context -> { final DisplaySlot slot = context.getArgument("slot", DisplaySlot.class);
context.getSource().getSender().sendPlainMessage("You selected: " + slot.toString()); return Command.SINGLE_SUCCESS; })In-game preview
Section titled “In-game preview”Template mirror argument
Section titled “Template mirror argument”Here, the user has 3 valid input possibilities: front_back, left_right, and none. You can retrieve the result of
the argument as a Mirror enum value.
Example usage
Section titled “Example usage”Commands.argument("mirror", ArgumentTypes.templateMirror()) .executes(context -> { final Mirror mirror = context.getArgument("mirror", Mirror.class);
context.getSource().getSender().sendPlainMessage("You selected: " + mirror.name()); return Command.SINGLE_SUCCESS; })In-game preview
Section titled “In-game preview”Template rotation argument
Section titled “Template rotation argument”For the template rotation argument, the user has 4 valid input possibilities: 180, clockwise_90, counterclockwise_90, and none. You can retrieve the result
of the argument as a StructureRotation enum value.
Example usage
Section titled “Example usage”Commands.argument("rotation", ArgumentTypes.templateRotation()) .executes(context -> { final StructureRotation rotation = context.getArgument("rotation", StructureRotation.class);
context.getSource().getSender().sendPlainMessage("You selected: " + rotation.name()); return Command.SINGLE_SUCCESS; })