CompoundTagArgument.java

net.minecraft.commands.arguments.CompoundTagArgument

信息

  • 全限定名:net.minecraft.commands.arguments.CompoundTagArgument
  • 类型:public class
  • 包:net.minecraft.commands.arguments
  • 源码路径:src/main/java/net/minecraft/commands/arguments/CompoundTagArgument.java
  • 起始行号:L12
  • 实现:ArgumentType
  • 职责:

    TODO

字段/常量

  • EXAMPLES
    • 类型: Collection<String>
    • 修饰符: private static final
    • 源码定位: L13
    • 说明:

      TODO

内部类/嵌套类型

构造器

private CompoundTagArgument() @ L15

  • 构造器名:CompoundTagArgument
  • 源码定位:L15
  • 修饰符:private

参数:

说明:

TODO

方法

下面的方法块按源码顺序生成。

public static CompoundTagArgument compoundTag() @ L18

  • 方法名:compoundTag
  • 源码定位:L18
  • 返回类型:CompoundTagArgument
  • 修饰符:public static

参数:

说明:

TODO

public static <S> CompoundTag getCompoundTag(CommandContext<S> context, String name) @ L22

  • 方法名:getCompoundTag
  • 源码定位:L22
  • 返回类型: CompoundTag
  • 修饰符:public static

参数:

  • context: CommandContext
  • name: String

说明:

TODO

public CompoundTag parse(StringReader reader) @ L26

  • 方法名:parse
  • 源码定位:L26
  • 返回类型:CompoundTag
  • 修饰符:public

参数:

  • reader: StringReader

说明:

TODO

public Collection<String> getExamples() @ L30

  • 方法名:getExamples
  • 源码定位:L30
  • 返回类型:Collection
  • 修饰符:public

参数:

说明:

TODO

代码

public class CompoundTagArgument implements ArgumentType<CompoundTag> {
    private static final Collection<String> EXAMPLES = Arrays.asList("{}", "{foo=bar}");
 
    private CompoundTagArgument() {
    }
 
    public static CompoundTagArgument compoundTag() {
        return new CompoundTagArgument();
    }
 
    public static <S> CompoundTag getCompoundTag(CommandContext<S> context, String name) {
        return context.getArgument(name, CompoundTag.class);
    }
 
    public CompoundTag parse(StringReader reader) throws CommandSyntaxException {
        return TagParser.parseCompoundAsArgument(reader);
    }
 
    @Override
    public Collection<String> getExamples() {
        return EXAMPLES;
    }
}

引用的其他类

  • CompoundTag

    • 引用位置: 实现/返回值
  • TagParser

    • 引用位置: 方法调用
    • 关联成员: TagParser.parseCompoundAsArgument()