AtlasSprite.java
net.minecraft.network.chat.contents.objects.AtlasSprite
信息
- 全限定名:net.minecraft.network.chat.contents.objects.AtlasSprite
- 类型:public record
- 包:net.minecraft.network.chat.contents.objects
- 源码路径:src/main/java/net/minecraft/network/chat/contents/objects/AtlasSprite.java
- 起始行号:L9
- 实现:ObjectInfo
- 职责:
TODO
字段/常量
-
DEFAULT_ATLAS- 类型:
Identifier - 修饰符:
public static final - 源码定位:
L10 - 说明:
TODO
- 类型:
-
MAP_CODEC- 类型:
MapCodec<AtlasSprite> - 修饰符:
public static final - 源码定位:
L11 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public MapCodec<AtlasSprite> codec() @ L19
- 方法名:codec
- 源码定位:L19
- 返回类型:MapCodec
- 修饰符:public
参数:
- 无
说明:
TODO
public FontDescription fontDescription() @ L24
- 方法名:fontDescription
- 源码定位:L24
- 返回类型:FontDescription
- 修饰符:public
参数:
- 无
说明:
TODO
private static String toShortName(Identifier id) @ L29
- 方法名:toShortName
- 源码定位:L29
- 返回类型:String
- 修饰符:private static
参数:
- id: Identifier
说明:
TODO
public String defaultFallback() @ L33
- 方法名:defaultFallback
- 源码定位:L33
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public record AtlasSprite(Identifier atlas, Identifier sprite) implements ObjectInfo {
public static final Identifier DEFAULT_ATLAS = AtlasIds.BLOCKS;
public static final MapCodec<AtlasSprite> MAP_CODEC = RecordCodecBuilder.mapCodec(
i -> i.group(
Identifier.CODEC.optionalFieldOf("atlas", DEFAULT_ATLAS).forGetter(AtlasSprite::atlas),
Identifier.CODEC.fieldOf("sprite").forGetter(AtlasSprite::sprite)
)
.apply(i, AtlasSprite::new)
);
@Override
public MapCodec<AtlasSprite> codec() {
return MAP_CODEC;
}
@Override
public FontDescription fontDescription() {
return new FontDescription.AtlasSprite(this.atlas, this.sprite);
}
private static String toShortName(Identifier id) {
return id.getNamespace().equals("minecraft") ? id.getPath() : id.toString();
}
@Override
public String defaultFallback() {
String shortName = toShortName(this.sprite);
return this.atlas.equals(DEFAULT_ATLAS) ? "[" + shortName + "]" : "[" + shortName + "@" + toShortName(this.atlas) + "]";
}
}引用的其他类
-
- 引用位置:
方法调用/构造调用/返回值 - 关联成员:
AtlasSprite(), FontDescription.AtlasSprite()
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置: