Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.15.2] Command doesn't exist after inputting arguments
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
MyRedAlien43

[1.15.2] Command doesn't exist after inputting arguments

By MyRedAlien43, March 22, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

MyRedAlien43    0

MyRedAlien43

MyRedAlien43    0

  • Tree Puncher
  • MyRedAlien43
  • Members
  • 0
  • 37 posts
Posted March 22, 2020 (edited)

So I want to create a command to teleport between dimensions, for testing, but when I try to run it, the game says

"Unknown Command"
"...dimension_name_here <--[HERE]"
And I also tried using breakpoints but they didn't trigger whatsoever??

Command Class:
 

public class TeleportDimensionCommand {
    public static void register(CommandDispatcher<CommandSource> dispatcher) {
        LiteralArgumentBuilder<CommandSource> builder = Commands.literal("teleport_dimension").requires(source -> source.hasPermissionLevel(2));
        builder.then(Commands.argument("dimension", DimensionArgument.getDimension()));
        builder.executes(TeleportDimensionCommand::teleport); //Only breakpoint which triggered
        LiteralCommandNode<CommandSource> teleport_dimension = dispatcher.register(builder);
        dispatcher.register(Commands.literal("tp_dim").requires(source -> source.hasPermissionLevel(2)).redirect(teleport_dimension));
    }

    private static int teleport(CommandContext<CommandSource> context) {
        ServerPlayerEntity player;
        try {
            player = context.getSource().asPlayer(); //Put a breakpoint here..
            player.sendMessage(new StringTextComponent("Attempting teleport...")); //When I didn't put any arguments, this popped up in chat
        } catch (CommandSyntaxException e) {
            Main.getLogger().error(Markers.ERROR, "Could not get player from source");
            e.printStackTrace();
            return 0; //Also tried a breakpoint here
        }
        if(player.changeDimension(DimensionArgument.getDimensionArgument(context, "dimension")) == null) {
            Main.getLogger().error(Markers.ERROR, "Could not teleport player"); //Put a breakpoint here
            player.sendMessage(new StringTextComponent("Could not teleport"));
        } else {
            player.sendMessage(new StringTextComponent("Teleported!")); //Put a breakpoint here
        }
        return 1;
    }
}

In my main class:

package sdt.undergroundadditions;

//Imports here...

@Mod("undergroundadditions")
public class Main {
    public Main() {
      	//Some more code here..
        IEventBus forge = MinecraftForge.EVENT_BUS;

        //Adding listeners here...
        forge.addListener(this::serverStarting);
    }
  	//Some more methods in between here
    private void serverStarting(FMLServerStartingEvent event) {
        TeleportDimensionCommand.register(event.getCommandDispatcher());
        logger.info(Markers.SERVER_STARTING, "Initialized server starting events");
    }
}

And, there's no error in the logs too. What's wrong?

Edited March 24, 2020 by MyRedAlien43
  • Quote

Share this post


Link to post
Share on other sites

MyRedAlien43    0

MyRedAlien43

MyRedAlien43    0

  • Tree Puncher
  • MyRedAlien43
  • Members
  • 0
  • 37 posts
Posted March 24, 2020

bump

  • Quote

Share this post


Link to post
Share on other sites

Ugdhar    232

Ugdhar

Ugdhar    232

  • World Shaper
  • Ugdhar
  • Members
  • 232
  • 2215 posts
Posted March 24, 2020
On 3/22/2020 at 5:14 PM, MyRedAlien43 said:

And I also tried using breakpoints but they didn't trigger whatsoever??

Did you launch the project in debug mode? I don't know how intellij does it, but I know with eclipse you have to run the project in debug mode, not normal run, to get breakpoints to work. If it still doesn't break, set a breakpoint somewhere you KNOW the code is reaching, just to make sure it's debugging properly.

Beyond that not sure about  commands, not something I've messed with yet, but if you can get debug to work I'm sure that'll help!

  • Quote

Share this post


Link to post
Share on other sites

MyRedAlien43    0

MyRedAlien43

MyRedAlien43    0

  • Tree Puncher
  • MyRedAlien43
  • Members
  • 0
  • 37 posts
Posted March 24, 2020 (edited)
2 minutes ago, Ugdhar said:

Did you launch the project in debug mode? I don't know how intellij does it, but I know with eclipse you have to run the project in debug mode, not normal run, to get breakpoints to work. If it still doesn't break, set a breakpoint somewhere you KNOW the code is reaching, just to make sure it's debugging properly.

Beyond that not sure about  commands, not something I've messed with yet, but if you can get debug to work I'm sure that'll help!

Yes I did press debug mode... Let me just use another breakpoint somewhere..

Edited March 24, 2020 by MyRedAlien43
improper grammar!
  • Quote

Share this post


Link to post
Share on other sites

MyRedAlien43    0

MyRedAlien43

MyRedAlien43    0

  • Tree Puncher
  • MyRedAlien43
  • Members
  • 0
  • 37 posts
Posted March 24, 2020

Okay, I added 2 more breakpoints, and the only one that triggered was the "executes" line. I will now edit the post to mark where I put the breakpoints

  • Quote

Share this post


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.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Thorius
      I don't know how forge works

      By Thorius · Posted 1 minute ago

      Did you run your server?  
    • Wintersky20
      Modifying / Replacing Vanilla Blocks (1.16.X)

      By Wintersky20 · Posted 3 minutes ago

      Ok guys .. So , I'm trying to replace a vanilla block in 1.16.4 but no luck! First I created a Workspace like I always do .. I created a block class for my replaced block: public class ExempleBlock extends CactusBlock /*just an ex.*/ { public ExempleBlock() { super(AbstractBlock.Properties.from(Blocks.CACTUS)); } } Then I tried to register it : First method( copied from an old 1.12 mod by rwTema ) @Mod.EventHandler/* not in 1.16*/ public void preinit(FMLPreInitializationEvent event) {/* not in 1.16 , I think*/ Block blockDietHopper = new BlockDietHopper(); ForgeRegistries.BLOCKS.register(blockDietHopper); } Then I tried to do this with a new registry event //from the exemple mod private void setup(final FMLCommonSetupEvent event){ Block ex = new ExempleBlock(); ForgeRegistries.BLOCKS.register(ex); } no luck Then I tried this : @Mod(ExempleMain.MOD_ID) public class ExempleMain { public static final String MOD_ID = "id"; private static final Logger LOGGER = LogManager.getLogger(); public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "minecraft"); public static final RegistryObject<Block> BETTER_EXEMPLE = BLOCKS.register("exemple_block", () -> new ExempleBlock()); public ExempleMain() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.addListener(this::setup); ExempleMain.BLOCKS.register(bus); } private void setup(final FMLCommonSetupEvent event){} } No luck   The idea is , I want to modify the TileEntity or the TESR for the vanilla blocks (ex: tools hovering on enchanting table , Nethar anchor GUI, Composter GUI, etc)   Note: I use IntelliJ and mdk-1.16.4-35.1.37   And Thanks for every topic
    • Mark74
      I don't know how forge works

      By Mark74 · Posted 7 minutes ago

      I dont have that folder, should i create it?
    • poopoodice
      [1.16.4] How i can open a container by clicking on my mob

      By poopoodice · Posted 16 minutes ago

      Well, since  public Container createMenu(int id, PlayerInventory playerInventory, PlayerEntity playerEntity <--------) { return new MyModContainer(id,playerInventory, world,extraDataWriter); } you already have the player, why don't you just pass the player in? Also getEntityByID is using entityID not UUID, use ServerWorld#getEntityByUuid/getPlayerByUuid although it is not necessary because you've got the player already.  
    • MKR0902
      1.12.2 Forge Server Not starting with command arguements

      By MKR0902 · Posted 26 minutes ago

      trying to start the forge server with more memory using the command  java -Xmx1G -Xms1G -jar minecraftforge-universal-1.6.2-9.10.0.804.jar nogui but keep getting the error: launcher.lang.reflect.InvocationTargetException also happens if I use the megabyte version, so like 1024M.
  • Topics

    • Mark74
      4
      I don't know how forge works

      By Mark74
      Started 53 minutes ago

    • Wintersky20
      0
      Modifying / Replacing Vanilla Blocks (1.16.X)

      By Wintersky20
      Started 3 minutes ago

    • Klarks
      39
      [1.16.4] How i can open a container by clicking on my mob

      By Klarks
      Started Saturday at 09:56 PM

    • MKR0902
      0
      1.12.2 Forge Server Not starting with command arguements

      By MKR0902
      Started 26 minutes ago

    • Amazinwave
      0
      Amazinwave

      By Amazinwave
      Started 53 minutes ago

  • Who's Online (See full list)

    • Wintersky20
    • st4s1k
    • MKR0902
    • Mark74
    • CookieLukas
    • Joshthehoneskid
    • Thorius
    • Microcellule
    • vemerion
    • Amazinwave
    • adem
    • Nuparu00
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.15.2] Command doesn't exist after inputting arguments
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community