Jump to content

Recommended Posts

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

Posted

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

  • Confused 1
Posted
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?

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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