Skip to content

Conversation

@Adrien5902
Copy link

resolves #2868

@Adrien5902 Adrien5902 requested a review from a team as a code owner December 30, 2025 12:39
Copy link
Member

@me4502 me4502 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, I'm just a little confused about a few parts of this so I've left a few comments :)


var actor = context.getActor();
if (actor instanceof Player player) {
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused by these try statements wrapping it, and why you're calling the getBlockInHand methods here? if it's a player, you should be able to always add hand and offhand to this list.

For pos1, it's realistically better to just always provide it as well. It's not only players who can have selections, so pos1 is always a valid selection. It's better to suggest it and have it give the "need to select a region" message upon running it, as that informs the user that it's actually possible.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right I wanted to remove it if the player is holding an item rather than a block, but letting it every time informs the user that it's actually possible as you said, so we could let it being suggested every time

@Adrien5902
Copy link
Author

just like so then ?

Copy link
Member

@me4502 me4502 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me. I'll just leave it overnight before merging in case others want to review also :)

if (idx < 0) {
return SuggestionHelper.getNamespacedRegistrySuggestions(BlockType.REGISTRY, input);
return Stream.concat(
Stream.of("hand", "offhand", "pos1"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't hand/offhand only be suggested if the actor is a player? This can be called in a console context so I don't think you can assume it's a player.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right I did check if the actor is a player but then removed it in 2157820 I shouldn't have done so

@Adrien5902
Copy link
Author

Should I also check if "hand".startsWith(input) (same for pos1 and offhand) before suggesting them ? Because I just realized it's now suggesting them even if I'm don't wanna type them in

image

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently breaking the build, can you please revert the change to the imports?

import java.util.Locale;
import java.util.Map;
import java.util.stream.Stream;
import java.util.Locale;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like these imports are still out of order- Locale shouldn't have moved; it's probably worth ensuring that it builds locally and making the fixes until it actually builds first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants