Make CustomArgumentType use parse(reader,source) (#12191)

This commit is contained in:
Jake Potrebic
2025-02-26 04:12:23 -08:00
committed by GitHub
parent f63dbeafde
commit 9421f22372
2 changed files with 6 additions and 1 deletions

View File

@@ -366,6 +366,11 @@ public class VanillaArgumentProviderImpl implements VanillaArgumentProvider {
return this.converter.convert(this.nmsBase.parse(reader));
}
@Override
public <S> P parse(final StringReader reader, final S source) throws CommandSyntaxException {
return this.converter.convert(this.nmsBase.parse(reader, source));
}
@Override
public <S> CompletableFuture<Suggestions> listSuggestions(final CommandContext<S> context, final SuggestionsBuilder builder) {
return this.nmsBase.listSuggestions(context, builder);

View File

@@ -46,7 +46,7 @@ public class WrappedArgumentCommandNode<NMS, API> extends ArgumentCommandNode<Co
@Override
public void parse(final StringReader reader, final CommandContextBuilder<CommandSourceStack> contextBuilder) throws CommandSyntaxException {
final int start = reader.getCursor();
final API result = this.pureArgumentType.parse(reader); // Use the api argument parser
final API result = this.pureArgumentType.parse(reader, contextBuilder.getSource()); // Use the api argument parser
final ParsedArgument<CommandSourceStack, API> parsed = new ParsedArgument<>(start, reader.getCursor(), result); // Return an API parsed argument instead.
contextBuilder.withArgument(this.getName(), parsed);