WaypointStyleManager.java

net.minecraft.client.resources.WaypointStyleManager

信息

  • 全限定名:net.minecraft.client.resources.WaypointStyleManager
  • 类型:public class
  • 包:net.minecraft.client.resources
  • 源码路径:src/main/java/net/minecraft/client/resources/WaypointStyleManager.java
  • 起始行号:L20
  • 继承:SimpleJsonResourceReloadListener
  • 职责:

    TODO

字段/常量

  • ASSET_LISTER

    • 类型: FileToIdConverter
    • 修饰符: private static final
    • 源码定位: L21
    • 说明:

      TODO

  • MISSING

    • 类型: WaypointStyle
    • 修饰符: private static final
    • 源码定位: L22
    • 说明:

      TODO

  • waypointStyles

    • 类型: Map<ResourceKey<WaypointStyleAsset>,WaypointStyle>
    • 修饰符: private
    • 源码定位: L23
    • 说明:

      TODO

内部类/嵌套类型

构造器

public WaypointStyleManager() @ L25

  • 构造器名:WaypointStyleManager
  • 源码定位:L25
  • 修饰符:public

参数:

说明:

TODO

方法

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

protected void apply(Map<Identifier,WaypointStyle> preparations, ResourceManager manager, ProfilerFiller profiler) @ L29

  • 方法名:apply
  • 源码定位:L29
  • 返回类型:void
  • 修饰符:protected

参数:

  • preparations: Map<Identifier,WaypointStyle>
  • manager: ResourceManager
  • profiler: ProfilerFiller

说明:

TODO

public WaypointStyle get(ResourceKey<WaypointStyleAsset> id) @ L35

  • 方法名:get
  • 源码定位:L35
  • 返回类型:WaypointStyle
  • 修饰符:public

参数:

  • id: ResourceKey

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class WaypointStyleManager extends SimpleJsonResourceReloadListener<WaypointStyle> {
    private static final FileToIdConverter ASSET_LISTER = FileToIdConverter.json("waypoint_style");
    private static final WaypointStyle MISSING = new WaypointStyle(0, 1, List.of(MissingTextureAtlasSprite.getLocation()));
    private Map<ResourceKey<WaypointStyleAsset>, WaypointStyle> waypointStyles = Map.of();
 
    public WaypointStyleManager() {
        super(WaypointStyle.CODEC, ASSET_LISTER);
    }
 
    protected void apply(Map<Identifier, WaypointStyle> preparations, ResourceManager manager, ProfilerFiller profiler) {
        this.waypointStyles = preparations.entrySet()
            .stream()
            .collect(Collectors.toUnmodifiableMap(e -> ResourceKey.create(WaypointStyleAssets.ROOT_ID, e.getKey()), Entry::getValue));
    }
 
    public WaypointStyle get(ResourceKey<WaypointStyleAsset> id) {
        return this.waypointStyles.getOrDefault(id, MISSING);
    }
}

引用的其他类