ScoreboardSlotArgument.java
net.minecraft.commands.arguments.ScoreboardSlotArgument
信息
- 全限定名:net.minecraft.commands.arguments.ScoreboardSlotArgument
- 类型:public class
- 包:net.minecraft.commands.arguments
- 源码路径:src/main/java/net/minecraft/commands/arguments/ScoreboardSlotArgument.java
- 起始行号:L18
- 实现:ArgumentType
- 职责:
TODO
字段/常量
-
EXAMPLES- 类型:
Collection<String> - 修饰符:
private static final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
ERROR_INVALID_VALUE- 类型:
DynamicCommandExceptionType - 修饰符:
public static final - 源码定位:
L20 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
private ScoreboardSlotArgument() @ L24
- 构造器名:ScoreboardSlotArgument
- 源码定位:L24
- 修饰符:private
参数:
- 无
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static ScoreboardSlotArgument displaySlot() @ L27
- 方法名:displaySlot
- 源码定位:L27
- 返回类型:ScoreboardSlotArgument
- 修饰符:public static
参数:
- 无
说明:
TODO
public static DisplaySlot getDisplaySlot(CommandContext<CommandSourceStack> context, String name) @ L31
- 方法名:getDisplaySlot
- 源码定位:L31
- 返回类型:DisplaySlot
- 修饰符:public static
参数:
- context: CommandContext
- name: String
说明:
TODO
public DisplaySlot parse(StringReader reader) @ L35
- 方法名:parse
- 源码定位:L35
- 返回类型:DisplaySlot
- 修饰符:public
参数:
- reader: StringReader
说明:
TODO
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) @ L45
- 方法名:listSuggestions
- 源码定位:L45
- 返回类型:
CompletableFuture - 修饰符:public
参数:
- context: CommandContext
- builder: SuggestionsBuilder
说明:
TODO
public Collection<String> getExamples() @ L50
- 方法名:getExamples
- 源码定位:L50
- 返回类型:Collection
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public class ScoreboardSlotArgument implements ArgumentType<DisplaySlot> {
private static final Collection<String> EXAMPLES = Arrays.asList("sidebar", "foo.bar");
public static final DynamicCommandExceptionType ERROR_INVALID_VALUE = new DynamicCommandExceptionType(
value -> Component.translatableEscape("argument.scoreboardDisplaySlot.invalid", value)
);
private ScoreboardSlotArgument() {
}
public static ScoreboardSlotArgument displaySlot() {
return new ScoreboardSlotArgument();
}
public static DisplaySlot getDisplaySlot(CommandContext<CommandSourceStack> context, String name) {
return context.getArgument(name, DisplaySlot.class);
}
public DisplaySlot parse(StringReader reader) throws CommandSyntaxException {
String name = reader.readUnquotedString();
DisplaySlot result = DisplaySlot.CODEC.byName(name);
if (result == null) {
throw ERROR_INVALID_VALUE.createWithContext(reader, name);
} else {
return result;
}
}
@Override
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
return SharedSuggestionProvider.suggest(Arrays.stream(DisplaySlot.values()).map(DisplaySlot::getSerializedName), builder);
}
@Override
public Collection<String> getExamples() {
return EXAMPLES;
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
SharedSuggestionProvider.suggest()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Component.translatableEscape()
- 引用位置:
-
- 引用位置:
实现/方法调用/返回值 - 关联成员:
DisplaySlot.values()
- 引用位置: