TelemetryProperty.java
net.minecraft.client.telemetry.TelemetryProperty
信息
- 全限定名:net.minecraft.client.telemetry.TelemetryProperty
- 类型:public record
- 包:net.minecraft.client.telemetry
- 源码路径:src/main/java/net/minecraft/client/telemetry/TelemetryProperty.java
- 起始行号:L24
- 职责:
TODO
字段/常量
-
TIMESTAMP_FORMATTER- 类型:
DateTimeFormatter - 修饰符:
private static final - 源码定位:
L25 - 说明:
TODO
- 类型:
-
USER_ID- 类型:
TelemetryProperty<String> - 修饰符:
public static final - 源码定位:
L26 - 说明:
TODO
- 类型:
-
CLIENT_ID- 类型:
TelemetryProperty<String> - 修饰符:
public static final - 源码定位:
L27 - 说明:
TODO
- 类型:
-
MINECRAFT_SESSION_ID- 类型:
TelemetryProperty<UUID> - 修饰符:
public static final - 源码定位:
L28 - 说明:
TODO
- 类型:
-
GAME_VERSION- 类型:
TelemetryProperty<String> - 修饰符:
public static final - 源码定位:
L29 - 说明:
TODO
- 类型:
-
OPERATING_SYSTEM- 类型:
TelemetryProperty<String> - 修饰符:
public static final - 源码定位:
L30 - 说明:
TODO
- 类型:
-
PLATFORM- 类型:
TelemetryProperty<String> - 修饰符:
public static final - 源码定位:
L31 - 说明:
TODO
- 类型:
-
CLIENT_MODDED- 类型:
TelemetryProperty<Boolean> - 修饰符:
public static final - 源码定位:
L32 - 说明:
TODO
- 类型:
-
LAUNCHER_NAME- 类型:
TelemetryProperty<String> - 修饰符:
public static final - 源码定位:
L33 - 说明:
TODO
- 类型:
-
WORLD_SESSION_ID- 类型:
TelemetryProperty<UUID> - 修饰符:
public static final - 源码定位:
L34 - 说明:
TODO
- 类型:
-
SERVER_MODDED- 类型:
TelemetryProperty<Boolean> - 修饰符:
public static final - 源码定位:
L35 - 说明:
TODO
- 类型:
-
SERVER_TYPE- 类型:
TelemetryProperty<TelemetryProperty.ServerType> - 修饰符:
public static final - 源码定位:
L36 - 说明:
TODO
- 类型:
-
OPT_IN- 类型:
TelemetryProperty<Boolean> - 修饰符:
public static final - 源码定位:
L39 - 说明:
TODO
- 类型:
-
EVENT_TIMESTAMP_UTC- 类型:
TelemetryProperty<Instant> - 修饰符:
public static final - 源码定位:
L40 - 说明:
TODO
- 类型:
-
GAME_MODE- 类型:
TelemetryProperty<TelemetryProperty.GameMode> - 修饰符:
public static final - 源码定位:
L46 - 说明:
TODO
- 类型:
-
REALMS_MAP_CONTENT- 类型:
TelemetryProperty<String> - 修饰符:
public static final - 源码定位:
L49 - 说明:
TODO
- 类型:
-
SECONDS_SINCE_LOAD- 类型:
TelemetryProperty<Integer> - 修饰符:
public static final - 源码定位:
L50 - 说明:
TODO
- 类型:
-
TICKS_SINCE_LOAD- 类型:
TelemetryProperty<Integer> - 修饰符:
public static final - 源码定位:
L51 - 说明:
TODO
- 类型:
-
FRAME_RATE_SAMPLES- 类型:
TelemetryProperty<LongList> - 修饰符:
public static final - 源码定位:
L52 - 说明:
TODO
- 类型:
-
RENDER_TIME_SAMPLES- 类型:
TelemetryProperty<LongList> - 修饰符:
public static final - 源码定位:
L53 - 说明:
TODO
- 类型:
-
USED_MEMORY_SAMPLES- 类型:
TelemetryProperty<LongList> - 修饰符:
public static final - 源码定位:
L54 - 说明:
TODO
- 类型:
-
NUMBER_OF_SAMPLES- 类型:
TelemetryProperty<Integer> - 修饰符:
public static final - 源码定位:
L55 - 说明:
TODO
- 类型:
-
RENDER_DISTANCE- 类型:
TelemetryProperty<Integer> - 修饰符:
public static final - 源码定位:
L56 - 说明:
TODO
- 类型:
-
DEDICATED_MEMORY_KB- 类型:
TelemetryProperty<Integer> - 修饰符:
public static final - 源码定位:
L57 - 说明:
TODO
- 类型:
-
WORLD_LOAD_TIME_MS- 类型:
TelemetryProperty<Integer> - 修饰符:
public static final - 源码定位:
L58 - 说明:
TODO
- 类型:
-
NEW_WORLD- 类型:
TelemetryProperty<Boolean> - 修饰符:
public static final - 源码定位:
L59 - 说明:
TODO
- 类型:
-
LOAD_TIME_TOTAL_TIME_MS- 类型:
TelemetryProperty<GameLoadTimesEvent.Measurement> - 修饰符:
public static final - 源码定位:
L60 - 说明:
TODO
- 类型:
-
LOAD_TIME_PRE_WINDOW_MS- 类型:
TelemetryProperty<GameLoadTimesEvent.Measurement> - 修饰符:
public static final - 源码定位:
L63 - 说明:
TODO
- 类型:
-
LOAD_TIME_BOOTSTRAP_MS- 类型:
TelemetryProperty<GameLoadTimesEvent.Measurement> - 修饰符:
public static final - 源码定位:
L66 - 说明:
TODO
- 类型:
-
LOAD_TIME_LOADING_OVERLAY_MS- 类型:
TelemetryProperty<GameLoadTimesEvent.Measurement> - 修饰符:
public static final - 源码定位:
L69 - 说明:
TODO
- 类型:
-
ADVANCEMENT_ID- 类型:
TelemetryProperty<String> - 修饰符:
public static final - 源码定位:
L72 - 说明:
TODO
- 类型:
-
ADVANCEMENT_GAME_TIME- 类型:
TelemetryProperty<Long> - 修饰符:
public static final - 源码定位:
L73 - 说明:
TODO
- 类型:
内部类/嵌套类型
-
net.minecraft.client.telemetry.TelemetryProperty.Exporter- 类型:
interface - 修饰符:
public - 源码定位:
L131 - 说明:
TODO
- 类型:
-
net.minecraft.client.telemetry.TelemetryProperty.GameMode- 类型:
enum - 修饰符:
public static - 源码定位:
L136 - 说明:
TODO
- 类型:
-
net.minecraft.client.telemetry.TelemetryProperty.ServerType- 类型:
enum - 修饰符:
public static - 源码定位:
L163 - 说明:
TODO
- 类型:
构造器
- 无
方法
下面的方法块按源码顺序生成。
public static <T> TelemetryProperty<T> create(String id, String exportKey, Codec<T> codec, TelemetryProperty.Exporter<T> exporter) @ L75
- 方法名:create
- 源码定位:L75
- 返回类型:
TelemetryProperty - 修饰符:public static
参数:
- id: String
- exportKey: String
- codec: Codec
- exporter: TelemetryProperty.Exporter
说明:
TODO
public static TelemetryProperty<Boolean> bool(String id, String exportKey) @ L79
- 方法名:bool
- 源码定位:L79
- 返回类型:TelemetryProperty
- 修饰符:public static
参数:
- id: String
- exportKey: String
说明:
TODO
public static TelemetryProperty<String> string(String id, String exportKey) @ L83
- 方法名:string
- 源码定位:L83
- 返回类型:TelemetryProperty
- 修饰符:public static
参数:
- id: String
- exportKey: String
说明:
TODO
public static TelemetryProperty<Integer> integer(String id, String exportKey) @ L87
- 方法名:integer
- 源码定位:L87
- 返回类型:TelemetryProperty
- 修饰符:public static
参数:
- id: String
- exportKey: String
说明:
TODO
public static TelemetryProperty<Long> makeLong(String id, String exportKey) @ L91
- 方法名:makeLong
- 源码定位:L91
- 返回类型:TelemetryProperty
- 修饰符:public static
参数:
- id: String
- exportKey: String
说明:
TODO
public static TelemetryProperty<UUID> uuid(String id, String exportKey) @ L95
- 方法名:uuid
- 源码定位:L95
- 返回类型:TelemetryProperty
- 修饰符:public static
参数:
- id: String
- exportKey: String
说明:
TODO
public static TelemetryProperty<GameLoadTimesEvent.Measurement> gameLoadMeasurement(String id, String exportKey) @ L99
- 方法名:gameLoadMeasurement
- 源码定位:L99
- 返回类型:TelemetryProperty<GameLoadTimesEvent.Measurement>
- 修饰符:public static
参数:
- id: String
- exportKey: String
说明:
TODO
public static TelemetryProperty<LongList> longSamples(String id, String exportKey) @ L103
- 方法名:longSamples
- 源码定位:L103
- 返回类型:TelemetryProperty
- 修饰符:public static
参数:
- id: String
- exportKey: String
说明:
TODO
public void export(TelemetryPropertyMap input, TelemetryPropertyContainer output) @ L112
- 方法名:export
- 源码定位:L112
- 返回类型:void
- 修饰符:public
参数:
- input: TelemetryPropertyMap
- output: TelemetryPropertyContainer
说明:
TODO
public MutableComponent title() @ L121
- 方法名:title
- 源码定位:L121
- 返回类型:MutableComponent
- 修饰符:public
参数:
- 无
说明:
TODO
public String toString() @ L125
- 方法名:toString
- 源码定位:L125
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public record TelemetryProperty<T>(String id, String exportKey, Codec<T> codec, TelemetryProperty.Exporter<T> exporter) {
private static final DateTimeFormatter TIMESTAMP_FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.from(ZoneOffset.UTC));
public static final TelemetryProperty<String> USER_ID = string("user_id", "userId");
public static final TelemetryProperty<String> CLIENT_ID = string("client_id", "clientId");
public static final TelemetryProperty<UUID> MINECRAFT_SESSION_ID = uuid("minecraft_session_id", "deviceSessionId");
public static final TelemetryProperty<String> GAME_VERSION = string("game_version", "buildDisplayName");
public static final TelemetryProperty<String> OPERATING_SYSTEM = string("operating_system", "buildPlatform");
public static final TelemetryProperty<String> PLATFORM = string("platform", "platform");
public static final TelemetryProperty<Boolean> CLIENT_MODDED = bool("client_modded", "clientModded");
public static final TelemetryProperty<String> LAUNCHER_NAME = string("launcher_name", "launcherName");
public static final TelemetryProperty<UUID> WORLD_SESSION_ID = uuid("world_session_id", "worldSessionId");
public static final TelemetryProperty<Boolean> SERVER_MODDED = bool("server_modded", "serverModded");
public static final TelemetryProperty<TelemetryProperty.ServerType> SERVER_TYPE = create(
"server_type", "serverType", TelemetryProperty.ServerType.CODEC, (output, key, value) -> output.addProperty(key, value.getSerializedName())
);
public static final TelemetryProperty<Boolean> OPT_IN = bool("opt_in", "isOptional");
public static final TelemetryProperty<Instant> EVENT_TIMESTAMP_UTC = create(
"event_timestamp_utc",
"eventTimestampUtc",
ExtraCodecs.INSTANT_ISO8601,
(output, key, value) -> output.addProperty(key, TIMESTAMP_FORMATTER.format(value))
);
public static final TelemetryProperty<TelemetryProperty.GameMode> GAME_MODE = create(
"game_mode", "playerGameMode", TelemetryProperty.GameMode.CODEC, (output, key, value) -> output.addProperty(key, value.id())
);
public static final TelemetryProperty<String> REALMS_MAP_CONTENT = string("realms_map_content", "realmsMapContent");
public static final TelemetryProperty<Integer> SECONDS_SINCE_LOAD = integer("seconds_since_load", "secondsSinceLoad");
public static final TelemetryProperty<Integer> TICKS_SINCE_LOAD = integer("ticks_since_load", "ticksSinceLoad");
public static final TelemetryProperty<LongList> FRAME_RATE_SAMPLES = longSamples("frame_rate_samples", "serializedFpsSamples");
public static final TelemetryProperty<LongList> RENDER_TIME_SAMPLES = longSamples("render_time_samples", "serializedRenderTimeSamples");
public static final TelemetryProperty<LongList> USED_MEMORY_SAMPLES = longSamples("used_memory_samples", "serializedUsedMemoryKbSamples");
public static final TelemetryProperty<Integer> NUMBER_OF_SAMPLES = integer("number_of_samples", "numSamples");
public static final TelemetryProperty<Integer> RENDER_DISTANCE = integer("render_distance", "renderDistance");
public static final TelemetryProperty<Integer> DEDICATED_MEMORY_KB = integer("dedicated_memory_kb", "dedicatedMemoryKb");
public static final TelemetryProperty<Integer> WORLD_LOAD_TIME_MS = integer("world_load_time_ms", "worldLoadTimeMs");
public static final TelemetryProperty<Boolean> NEW_WORLD = bool("new_world", "newWorld");
public static final TelemetryProperty<GameLoadTimesEvent.Measurement> LOAD_TIME_TOTAL_TIME_MS = gameLoadMeasurement(
"load_time_total_time_ms", "loadTimeTotalTimeMs"
);
public static final TelemetryProperty<GameLoadTimesEvent.Measurement> LOAD_TIME_PRE_WINDOW_MS = gameLoadMeasurement(
"load_time_pre_window_ms", "loadTimePreWindowMs"
);
public static final TelemetryProperty<GameLoadTimesEvent.Measurement> LOAD_TIME_BOOTSTRAP_MS = gameLoadMeasurement(
"load_time_bootstrap_ms", "loadTimeBootstrapMs"
);
public static final TelemetryProperty<GameLoadTimesEvent.Measurement> LOAD_TIME_LOADING_OVERLAY_MS = gameLoadMeasurement(
"load_time_loading_overlay_ms", "loadTimeLoadingOverlayMs"
);
public static final TelemetryProperty<String> ADVANCEMENT_ID = string("advancement_id", "advancementId");
public static final TelemetryProperty<Long> ADVANCEMENT_GAME_TIME = makeLong("advancement_game_time", "advancementGameTime");
public static <T> TelemetryProperty<T> create(String id, String exportKey, Codec<T> codec, TelemetryProperty.Exporter<T> exporter) {
return new TelemetryProperty<>(id, exportKey, codec, exporter);
}
public static TelemetryProperty<Boolean> bool(String id, String exportKey) {
return create(id, exportKey, Codec.BOOL, TelemetryPropertyContainer::addProperty);
}
public static TelemetryProperty<String> string(String id, String exportKey) {
return create(id, exportKey, Codec.STRING, TelemetryPropertyContainer::addProperty);
}
public static TelemetryProperty<Integer> integer(String id, String exportKey) {
return create(id, exportKey, Codec.INT, TelemetryPropertyContainer::addProperty);
}
public static TelemetryProperty<Long> makeLong(String id, String exportKey) {
return create(id, exportKey, Codec.LONG, TelemetryPropertyContainer::addProperty);
}
public static TelemetryProperty<UUID> uuid(String id, String exportKey) {
return create(id, exportKey, UUIDUtil.STRING_CODEC, (output, key, value) -> output.addProperty(key, value.toString()));
}
public static TelemetryProperty<GameLoadTimesEvent.Measurement> gameLoadMeasurement(String id, String exportKey) {
return create(id, exportKey, GameLoadTimesEvent.Measurement.CODEC, (output, key, value) -> output.addProperty(key, value.millis()));
}
public static TelemetryProperty<LongList> longSamples(String id, String exportKey) {
return create(
id,
exportKey,
Codec.LONG.listOf().xmap(LongArrayList::new, Function.identity()),
(output, key, value) -> output.addProperty(key, value.longStream().mapToObj(String::valueOf).collect(Collectors.joining(";")))
);
}
public void export(TelemetryPropertyMap input, TelemetryPropertyContainer output) {
T value = input.get(this);
if (value != null) {
this.exporter.apply(output, this.exportKey, value);
} else {
output.addNullProperty(this.exportKey);
}
}
public MutableComponent title() {
return Component.translatable("telemetry.property." + this.id + ".title");
}
@Override
public String toString() {
return "TelemetryProperty[" + this.id + "]";
}
@OnlyIn(Dist.CLIENT)
public interface Exporter<T> {
void apply(TelemetryPropertyContainer output, String key, T value);
}
@OnlyIn(Dist.CLIENT)
public static enum GameMode implements StringRepresentable {
SURVIVAL("survival", 0),
CREATIVE("creative", 1),
ADVENTURE("adventure", 2),
SPECTATOR("spectator", 6),
HARDCORE("hardcore", 99);
public static final Codec<TelemetryProperty.GameMode> CODEC = StringRepresentable.fromEnum(TelemetryProperty.GameMode::values);
private final String key;
private final int id;
private GameMode(String key, int id) {
this.key = key;
this.id = id;
}
public int id() {
return this.id;
}
@Override
public String getSerializedName() {
return this.key;
}
}
@OnlyIn(Dist.CLIENT)
public static enum ServerType implements StringRepresentable {
REALM("realm"),
LOCAL("local"),
OTHER("server");
public static final Codec<TelemetryProperty.ServerType> CODEC = StringRepresentable.fromEnum(TelemetryProperty.ServerType::values);
private final String key;
private ServerType(String key) {
this.key = key;
}
@Override
public String getSerializedName() {
return this.key;
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
字段/返回值
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Component.translatable()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
StringRepresentable.fromEnum()
- 引用位置: