Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.4] How can I create a command with multiple arguments?


Recommended Posts

My command is in a seperate class and are registered in another class.

I want to make a command that goes about like this:

/modid commandname [argument]

 

I also want the commandname to be in the autocomplete, so i use:

public static ArgumentBuilder<CommandSource, ?> register(CommandDispatcher<CommandSource> dispatcher) {
	return Commands.literal("commandname")
		.requires(cs -> cs.hasPermissionLevel(0))
		.executes(CMD);
}

CMD is a private static final Instance of the class of the Command.

 

How can I get [argument]? Thank you in advance for any tips.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Finally!!! Thank you! It worked perfectly! I run "gradlew reobfShadowJar" and it worked perfectly! Thanks for your help!
    • By using shadow you now have a 2nd jar task: shadowJar. You already told ForgeGradle to reobfuscate it (by adding shadowJar to the reobf block), but you then need to actually use the now present reobfShadowJar task. The default build.gradle already does this for the normal jar task: jar.finalizedBy('reobfJar'), you need to do the same for the shadow jar.
    • Crash Report UUID: f40f8196-aa62-4bc4-957e-a1dfe1e8c2af[11:39:06] [main/FATAL] [minecraft/Main]: Failed to start the minecraft server net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [         Structurize (structurize) has failed to load correctly §7java.lang.IncompatibleClassChangeError: Inconsistent constant pool data in classfile for class com/ldtteam/structurize/api/blocks/IBlockCollection. Method 'net.minecraft.block.Block lambda$create$0(com.ldtteam.structurize.api.blocks.BlockType)' at index 147 is CONSTANT_MethodRef and should be CONSTANT_InterfaceMethodRef ]         at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:263) ~[forge:?] {re:classloading}         at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:230) ~[forge:?] {re:classloading}         at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:188) ~[forge:?] {re:classloading}         at net.minecraftforge.fml.server.ServerModLoader.load(ServerModLoader.java:44) ~[forge:?] {re:classloading}         at net.minecraft.server.Main.main(Main.java:95) ~[?:?] {re:classloading}         at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}         at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {}         at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}         at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] {}         at net.minecraftforge.fml.loading.FMLServerLaunchProvider.lambda$launchService$0(FMLServerLaunchProvider.java:51) ~[forge-1.16.5-36.1.4.jar:36.1] {}         at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}         at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}         at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}         at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {re:classloading}         at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {re:classloading}         at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63) [forge-1.16.5-36.1.4.jar:?] {}         at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60) [forge-1.16.5-36.1.4.jar:?] {}         at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) [forge-1.16.5-36.1.4.jar:?] {} Can someone help me with this error? Running the the server on a vServer and tried to install the Valhelsia Modpack but it doesnt work. Greadings Luca.
    • Crash Report UUID: f40f8196-aa62-4bc4-957e-a1dfe1e8c2af[11:39:06] [main/FATAL] [minecraft/Main]: Failed to start the minecraft server net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [         Structurize (structurize) has failed to load correctly §7java.lang.IncompatibleClassChangeError: Inconsistent constant pool data in classfile for class com/ldtteam/structurize/api/blocks/IBlockCollection. Method 'net.minecraft.block.Block lambda$create$0(com.ldtteam.structurize.api.blocks.BlockType)' at index 147 is CONSTANT_MethodRef and should be CONSTANT_InterfaceMethodRef ]         at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:263) ~[forge:?] {re:classloading}         at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:230) ~[forge:?] {re:classloading}         at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:188) ~[forge:?] {re:classloading}         at net.minecraftforge.fml.server.ServerModLoader.load(ServerModLoader.java:44) ~[forge:?] {re:classloading}         at net.minecraft.server.Main.main(Main.java:95) ~[?:?] {re:classloading}         at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}         at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {}         at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}         at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] {}         at net.minecraftforge.fml.loading.FMLServerLaunchProvider.lambda$launchService$0(FMLServerLaunchProvider.java:51) ~[forge-1.16.5-36.1.4.jar:36.1] {}         at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}         at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}         at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}         at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {re:classloading}         at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {re:classloading}         at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63) [forge-1.16.5-36.1.4.jar:?] {}         at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60) [forge-1.16.5-36.1.4.jar:?] {}         at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) [forge-1.16.5-36.1.4.jar:?] {} Can someone help me with this error? Running the the server on a vServer and tried to install the Valhelsia Modpack but it doesnt work. Greadings Luca.
    • I didn't know I had to reobfuscate the mod, I created it using: "gradlew shadowJar"
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.