Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@
import org.enginehub.linbus.stream.exception.NbtParseException;
import org.enginehub.linbus.tree.LinCompoundTag;

import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
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


/**
* Parses block input strings.
Expand Down Expand Up @@ -206,7 +208,23 @@ private static Map<Property<?>, Object> parseProperties(BlockType type, String[]
public Stream<String> getSuggestions(String input, ParserContext context) {
final int idx = input.lastIndexOf('[');
if (idx < 0) {
return SuggestionHelper.getNamespacedRegistrySuggestions(BlockType.REGISTRY, input);
List<String> suggestions = new ArrayList<>();

if ("pos1".startsWith(input)) {
suggestions.add("pos1");
}

if (context.getActor() != null && context.getActor().isPlayer()) {
for (String handSide : List.of("hand", "offhand")) {
if (handSide.startsWith(input)) {
suggestions.add(handSide);
}
}
}

return Stream.concat(
suggestions.stream(),
SuggestionHelper.getNamespacedRegistrySuggestions(BlockType.REGISTRY, input));
}
String blockType = input.substring(0, idx);
BlockType type = BlockTypes.get(blockType.toLowerCase(Locale.ROOT));
Expand Down
Loading