Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
import org.enginehub.linbus.stream.exception.NbtParseException;
import org.enginehub.linbus.tree.LinCompoundTag;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.*;
import java.util.stream.Stream;

/**
Expand Down Expand Up @@ -206,7 +204,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