Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello there,

my goal is to get the Direction enum as an argument into a command.

 

I tried this:

Commands.argument("isFacing", EnumArgument.enumArgument(Direction.class))
  .executes(source -> {
    return createShip(source.getSource(),
                      StringArgumentType.getString(source, "shipName"),
                      StringArgumentType.getString(source, "portName"),
                      BlockPosArgument.getBlockPos(source, "pos1"),
                      BlockPosArgument.getBlockPos(source, "pos2"),
                      source.getArgument("isFacing", Direction.class));
  }

 

But that suggests me all the Direction Names which when use autocomplete can't be referred to an enum.

Is there a way to get the suggestions in upper case letters?

Also I only want to display the horizontal Directions.

grafik.png.1440dfcbbfd07aa96f77dd69d0246326.png

Bumpay

builder.then(Commands.literal(direction))

where ArgumentBuilder is an instance of ArgumentBuilder, and direction is the argument you want to add to the command, which can be achieved using for loops

  • Author
2 minutes ago, poopoodice said:

builder.then(Commands.literal(direction))

where ArgumentBuilder is an instance of ArgumentBuilder, and direction is the argument you want to add to the command, which can be achieved using for loops

I don't get your way of implementing the argument.

You mean i should create a for loop to get all directions out of the Direction class? But the how do I add those as an argument?

For example

LiteralArgumentBuilder<CommandSource> command = Commands.literal("test");
for(int i=2;i<5;i++)
    command.then(Commands.literal(Direction.byIndex(i).getString()));
  • Author

Ah I see the problem with that is I do not use a literal Argument builder in the way you do.

 

I have my main Command class (TraSimCommands)

and they register a new command in this case the CreateDock class and in there the fourth argument is the enum.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.