Skip to content

Instantly share code, notes, and snippets.

@Densamisten
Created April 9, 2024 13:51
Show Gist options
  • Save Densamisten/85e293ef642d6e2cedd1dd01e9081e6f to your computer and use it in GitHub Desktop.
Save Densamisten/85e293ef642d6e2cedd1dd01e9081e6f to your computer and use it in GitHub Desktop.
public static void register(CommandDispatcher<ServerCommandSource> dispatcher,
CommandRegistryAccess ignoredCommandRegistryAccess,
CommandManager.RegistrationEnvironment ignoredRegistrationEnvironment)
{
dispatcher.register(LiteralArgumentBuilder
.<ServerCommandSource>literal("ls")
.then(CommandManager.argument("anyArgumentName", IntegerArgumentType.integer(-90, 90))
.executes(LsCommand::MethodToExecute)));
}
public static int MethodToExecute(CommandContext<ServerCommandSource> context) {
Objects.requireNonNull(MinecraftClient.getInstance().player)
.setPitch(IntegerArgumentType.getInteger(context, "anyArgumentName"));
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment