fabric: Fully implement a registry entry argument type
This commit is contained in:
parent
98aea50d3c
commit
91b433c14b
10 changed files with 649 additions and 138 deletions
|
|
@ -739,6 +739,10 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
|
|||
return this.defaultDescription;
|
||||
}
|
||||
|
||||
protected final @NonNull TypeToken<T> getValueType() {
|
||||
return this.valueType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import java.util.List;
|
|||
import java.util.Queue;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
final class MappedArgumentParser<C, I, O> implements ArgumentParser<C, O> {
|
||||
public final class MappedArgumentParser<C, I, O> implements ArgumentParser<C, O> {
|
||||
private final ArgumentParser<C, I> base;
|
||||
private final BiFunction<CommandContext<C>, I, ArgumentParseResult<O>> mapper;
|
||||
|
||||
|
|
@ -44,6 +44,15 @@ final class MappedArgumentParser<C, I, O> implements ArgumentParser<C, O> {
|
|||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parser this one is derived from.
|
||||
*
|
||||
* @return the base parser
|
||||
*/
|
||||
public ArgumentParser<C, I> getBaseParser() {
|
||||
return this.base;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull ArgumentParseResult<@NonNull O> parse(
|
||||
@NonNull final CommandContext<@NonNull C> commandContext,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue