TelemetryEventInstance.java

net.minecraft.client.telemetry.TelemetryEventInstance

信息

  • 全限定名:net.minecraft.client.telemetry.TelemetryEventInstance
  • 类型:public record
  • 包:net.minecraft.client.telemetry
  • 源码路径:src/main/java/net/minecraft/client/telemetry/TelemetryEventInstance.java
  • 起始行号:L10
  • 职责:

    TODO

字段/常量

  • CODEC
    • 类型: Codec<TelemetryEventInstance>
    • 修饰符: public static final
    • 源码定位: L11
    • 说明:

      TODO

内部类/嵌套类型

构造器

public TelemetryEventInstance(TelemetryEventType type, TelemetryPropertyMap properties) @ L13

  • 构造器名:TelemetryEventInstance
  • 源码定位:L13
  • 修饰符:public

参数:

  • type: TelemetryEventType
  • properties: TelemetryPropertyMap

说明:

TODO

方法

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

public TelemetryEvent export(TelemetrySession session) @ L23

  • 方法名:export
  • 源码定位:L23
  • 返回类型:TelemetryEvent
  • 修饰符:public

参数:

  • session: TelemetrySession

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public record TelemetryEventInstance(TelemetryEventType type, TelemetryPropertyMap properties) {
    public static final Codec<TelemetryEventInstance> CODEC = TelemetryEventType.CODEC.dispatchStable(TelemetryEventInstance::type, TelemetryEventType::codec);
 
    public TelemetryEventInstance(TelemetryEventType type, TelemetryPropertyMap properties) {
        properties.propertySet().forEach(property -> {
            if (!type.contains((TelemetryProperty<?>)property)) {
                throw new IllegalArgumentException("Property '" + property.id() + "' not expected for event: '" + type.id() + "'");
            }
        });
        this.type = type;
        this.properties = properties;
    }
 
    public TelemetryEvent export(TelemetrySession session) {
        return this.type.export(session, this.properties);
    }
}

引用的其他类