EquipmentAssetManager.java

net.minecraft.client.resources.model.EquipmentAssetManager

信息

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

    TODO

字段/常量

  • MISSING

    • 类型: EquipmentClientInfo
    • 修饰符: public static final
    • 源码定位: L19
    • 说明:

      TODO

  • ASSET_LISTER

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

      TODO

  • equipmentAssets

    • 类型: Map<ResourceKey<EquipmentAsset>,EquipmentClientInfo>
    • 修饰符: private
    • 源码定位: L21
    • 说明:

      TODO

内部类/嵌套类型

构造器

public EquipmentAssetManager() @ L23

  • 构造器名:EquipmentAssetManager
  • 源码定位:L23
  • 修饰符:public

参数:

说明:

TODO

方法

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

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

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

参数:

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

说明:

TODO

public EquipmentClientInfo get(ResourceKey<EquipmentAsset> id) @ L33

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

参数:

  • id: ResourceKey

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class EquipmentAssetManager extends SimpleJsonResourceReloadListener<EquipmentClientInfo> {
    public static final EquipmentClientInfo MISSING = new EquipmentClientInfo(Map.of());
    private static final FileToIdConverter ASSET_LISTER = FileToIdConverter.json("equipment");
    private Map<ResourceKey<EquipmentAsset>, EquipmentClientInfo> equipmentAssets = Map.of();
 
    public EquipmentAssetManager() {
        super(EquipmentClientInfo.CODEC, ASSET_LISTER);
    }
 
    protected void apply(Map<Identifier, EquipmentClientInfo> preparations, ResourceManager manager, ProfilerFiller profiler) {
        this.equipmentAssets = preparations.entrySet()
            .stream()
            .collect(Collectors.toUnmodifiableMap(e -> ResourceKey.create(EquipmentAssets.ROOT_ID, e.getKey()), Entry::getValue));
    }
 
    public EquipmentClientInfo get(ResourceKey<EquipmentAsset> id) {
        return this.equipmentAssets.getOrDefault(id, MISSING);
    }
}

引用的其他类