PackCompatibility.java
net.minecraft.server.packs.repository.PackCompatibility
信息
- 全限定名:net.minecraft.server.packs.repository.PackCompatibility
- 类型:public enum
- 包:net.minecraft.server.packs.repository
- 源码路径:src/main/java/net/minecraft/server/packs/repository/PackCompatibility.java
- 起始行号:L8
- 职责:
TODO
字段/常量
-
TOO_OLD, TOO_NEW, UNKNOWN, COMPATIBLE- 类型:
PackCompatibility - 修饰符:
package-private - 源码定位:
L9 - 说明:
TODO
- 类型:
-
UNKNOWN_VERSION- 类型:
int - 修饰符:
public static final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
description- 类型:
Component - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
confirmation- 类型:
Component - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
private PackCompatibility(String key) @ L18
- 构造器名:PackCompatibility
- 源码定位:L18
- 修饰符:private
参数:
- key: String
说明:
TODO
方法
下面的方法块按源码顺序生成。
public boolean isCompatible() @ L23
- 方法名:isCompatible
- 源码定位:L23
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public static PackCompatibility forVersion(InclusiveRange<PackFormat> packDeclaredVersions, PackFormat gameSupportedVersion) @ L27
- 方法名:forVersion
- 源码定位:L27
- 返回类型:PackCompatibility
- 修饰符:public static
参数:
- packDeclaredVersions: InclusiveRange
- gameSupportedVersion: PackFormat
说明:
TODO
public Component getDescription() @ L37
- 方法名:getDescription
- 源码定位:L37
- 返回类型:Component
- 修饰符:public
参数:
- 无
说明:
TODO
public Component getConfirmation() @ L41
- 方法名:getConfirmation
- 源码定位:L41
- 返回类型:Component
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public enum PackCompatibility {
TOO_OLD("old"),
TOO_NEW("new"),
UNKNOWN("unknown"),
COMPATIBLE("compatible");
public static final int UNKNOWN_VERSION = Integer.MAX_VALUE;
private final Component description;
private final Component confirmation;
private PackCompatibility(String key) {
this.description = Component.translatable("pack.incompatible." + key).withStyle(ChatFormatting.GRAY);
this.confirmation = Component.translatable("pack.incompatible.confirm." + key);
}
public boolean isCompatible() {
return this == COMPATIBLE;
}
public static PackCompatibility forVersion(InclusiveRange<PackFormat> packDeclaredVersions, PackFormat gameSupportedVersion) {
if (packDeclaredVersions.minInclusive().major() == Integer.MAX_VALUE) {
return UNKNOWN;
} else if (packDeclaredVersions.maxInclusive().compareTo(gameSupportedVersion) < 0) {
return TOO_OLD;
} else {
return gameSupportedVersion.compareTo(packDeclaredVersions.minInclusive()) < 0 ? TOO_NEW : COMPATIBLE;
}
}
public Component getDescription() {
return this.description;
}
public Component getConfirmation() {
return this.confirmation;
}
}引用的其他类
-
- 引用位置:
字段/方法调用/返回值 - 关联成员:
Component.translatable()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置: