GameTestInstance.java

net.minecraft.gametest.framework.GameTestInstance

信息

  • 全限定名:net.minecraft.gametest.framework.GameTestInstance
  • 类型:public abstract class
  • 包:net.minecraft.gametest.framework
  • 源码路径:src/main/java/net/minecraft/gametest/framework/GameTestInstance.java
  • 起始行号:L16
  • 职责:

    TODO

字段/常量

  • DIRECT_CODEC

    • 类型: Codec<GameTestInstance>
    • 修饰符: public static final
    • 源码定位: L17
    • 说明:

      TODO

  • info

    • 类型: TestData<Holder<TestEnvironmentDefinition<?>>>
    • 修饰符: private final
    • 源码定位: L18
    • 说明:

      TODO

内部类/嵌套类型

构造器

protected GameTestInstance(TestData<Holder<TestEnvironmentDefinition<?>>> info) @ L31

  • 构造器名:GameTestInstance
  • 源码定位:L31
  • 修饰符:protected

参数:

  • info: TestData<Holder<TestEnvironmentDefinition<?>>>

说明:

TODO

方法

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

public static MapCodec<?extends GameTestInstance> bootstrap(Registry<MapCodec<?extends GameTestInstance>> registry) @ L20

  • 方法名:bootstrap
  • 源码定位:L20
  • 返回类型:MapCodec<?extends GameTestInstance>
  • 修饰符:public static

参数:

  • registry: Registry<MapCodec<?extends GameTestInstance>>

说明:

TODO

private static MapCodec<?extends GameTestInstance> register(Registry<MapCodec<?extends GameTestInstance>> registry, String name, MapCodec<?extends GameTestInstance> codec) @ L25

  • 方法名:register
  • 源码定位:L25
  • 返回类型:MapCodec<?extends GameTestInstance>
  • 修饰符:private static

参数:

  • registry: Registry<MapCodec<?extends GameTestInstance>>
  • name: String
  • codec: MapCodec<?extends GameTestInstance>

说明:

TODO

public abstract void run(GameTestHelper helper) @ L35

  • 方法名:run
  • 源码定位:L35
  • 返回类型:void
  • 修饰符:public abstract

参数:

  • helper: GameTestHelper

说明:

TODO

public abstract MapCodec<?extends GameTestInstance> codec() @ L37

  • 方法名:codec
  • 源码定位:L37
  • 返回类型:MapCodec<?extends GameTestInstance>
  • 修饰符:public abstract

参数:

说明:

TODO

public Holder<TestEnvironmentDefinition<?>> batch() @ L39

  • 方法名:batch
  • 源码定位:L39
  • 返回类型:Holder<TestEnvironmentDefinition<?>>
  • 修饰符:public

参数:

说明:

TODO

public Identifier structure() @ L43

  • 方法名:structure
  • 源码定位:L43
  • 返回类型:Identifier
  • 修饰符:public

参数:

说明:

TODO

public int maxTicks() @ L47

  • 方法名:maxTicks
  • 源码定位:L47
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

public int setupTicks() @ L51

  • 方法名:setupTicks
  • 源码定位:L51
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

public boolean required() @ L55

  • 方法名:required
  • 源码定位:L55
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public boolean manualOnly() @ L59

  • 方法名:manualOnly
  • 源码定位:L59
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public int maxAttempts() @ L63

  • 方法名:maxAttempts
  • 源码定位:L63
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

public int requiredSuccesses() @ L67

  • 方法名:requiredSuccesses
  • 源码定位:L67
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

public boolean skyAccess() @ L71

  • 方法名:skyAccess
  • 源码定位:L71
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public Rotation rotation() @ L75

  • 方法名:rotation
  • 源码定位:L75
  • 返回类型:Rotation
  • 修饰符:public

参数:

说明:

TODO

public int padding() @ L79

  • 方法名:padding
  • 源码定位:L79
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

protected TestData<Holder<TestEnvironmentDefinition<?>>> info() @ L83

  • 方法名:info
  • 源码定位:L83
  • 返回类型:TestData<Holder<TestEnvironmentDefinition<?>>>
  • 修饰符:protected

参数:

说明:

TODO

protected abstract MutableComponent typeDescription() @ L87

  • 方法名:typeDescription
  • 源码定位:L87
  • 返回类型:MutableComponent
  • 修饰符:protected abstract

参数:

说明:

TODO

public Component describe() @ L89

  • 方法名:describe
  • 源码定位:L89
  • 返回类型:Component
  • 修饰符:public

参数:

说明:

TODO

protected MutableComponent describeType() @ L93

  • 方法名:describeType
  • 源码定位:L93
  • 返回类型:MutableComponent
  • 修饰符:protected

参数:

说明:

TODO

protected Component describeInfo() @ L97

  • 方法名:describeInfo
  • 源码定位:L97
  • 返回类型:Component
  • 修饰符:protected

参数:

说明:

TODO

protected MutableComponent descriptionRow(String translationKey, String value) @ L102

  • 方法名:descriptionRow
  • 源码定位:L102
  • 返回类型:MutableComponent
  • 修饰符:protected

参数:

  • translationKey: String
  • value: String

说明:

TODO

protected MutableComponent descriptionRow(String translationKey, MutableComponent value) @ L106

  • 方法名:descriptionRow
  • 源码定位:L106
  • 返回类型:MutableComponent
  • 修饰符:protected

参数:

  • translationKey: String
  • value: MutableComponent

说明:

TODO

代码

public abstract class GameTestInstance {
    public static final Codec<GameTestInstance> DIRECT_CODEC = BuiltInRegistries.TEST_INSTANCE_TYPE.byNameCodec().dispatch(GameTestInstance::codec, i -> i);
    private final TestData<Holder<TestEnvironmentDefinition<?>>> info;
 
    public static MapCodec<? extends GameTestInstance> bootstrap(Registry<MapCodec<? extends GameTestInstance>> registry) {
        register(registry, "block_based", BlockBasedTestInstance.CODEC);
        return register(registry, "function", FunctionGameTestInstance.CODEC);
    }
 
    private static MapCodec<? extends GameTestInstance> register(
        Registry<MapCodec<? extends GameTestInstance>> registry, String name, MapCodec<? extends GameTestInstance> codec
    ) {
        return Registry.register(registry, ResourceKey.create(Registries.TEST_INSTANCE_TYPE, Identifier.withDefaultNamespace(name)), codec);
    }
 
    protected GameTestInstance(TestData<Holder<TestEnvironmentDefinition<?>>> info) {
        this.info = info;
    }
 
    public abstract void run(GameTestHelper helper);
 
    public abstract MapCodec<? extends GameTestInstance> codec();
 
    public Holder<TestEnvironmentDefinition<?>> batch() {
        return this.info.environment();
    }
 
    public Identifier structure() {
        return this.info.structure();
    }
 
    public int maxTicks() {
        return this.info.maxTicks();
    }
 
    public int setupTicks() {
        return this.info.setupTicks();
    }
 
    public boolean required() {
        return this.info.required();
    }
 
    public boolean manualOnly() {
        return this.info.manualOnly();
    }
 
    public int maxAttempts() {
        return this.info.maxAttempts();
    }
 
    public int requiredSuccesses() {
        return this.info.requiredSuccesses();
    }
 
    public boolean skyAccess() {
        return this.info.skyAccess();
    }
 
    public Rotation rotation() {
        return this.info.rotation();
    }
 
    public int padding() {
        return this.info.padding();
    }
 
    protected TestData<Holder<TestEnvironmentDefinition<?>>> info() {
        return this.info;
    }
 
    protected abstract MutableComponent typeDescription();
 
    public Component describe() {
        return this.describeType().append(this.describeInfo());
    }
 
    protected MutableComponent describeType() {
        return this.descriptionRow("test_instance.description.type", this.typeDescription());
    }
 
    protected Component describeInfo() {
        return this.descriptionRow("test_instance.description.structure", this.info.structure().toString())
            .append(this.descriptionRow("test_instance.description.batch", this.info.environment().getRegisteredName()));
    }
 
    protected MutableComponent descriptionRow(String translationKey, String value) {
        return this.descriptionRow(translationKey, Component.literal(value));
    }
 
    protected MutableComponent descriptionRow(String translationKey, MutableComponent value) {
        return Component.translatable(translationKey, value.withStyle(ChatFormatting.BLUE)).append(Component.literal("\n"));
    }
}

引用的其他类

  • Holder

    • 引用位置: 参数/字段/返回值
  • Registry

    • 引用位置: 参数/方法调用
    • 关联成员: Registry.register()
  • GameTestHelper

    • 引用位置: 参数
  • TestData

    • 引用位置: 参数/字段/返回值
  • TestEnvironmentDefinition

    • 引用位置: 参数/字段/返回值
  • Component

    • 引用位置: 方法调用/返回值
    • 关联成员: Component.literal(), Component.translatable()
  • MutableComponent

    • 引用位置: 参数/返回值
  • Identifier

    • 引用位置: 方法调用/返回值
    • 关联成员: Identifier.withDefaultNamespace()
  • ResourceKey

    • 引用位置: 方法调用
    • 关联成员: ResourceKey.create()
  • Rotation

    • 引用位置: 返回值