ModelLocationUtils.java

net.minecraft.client.data.models.model.ModelLocationUtils

信息

  • 全限定名:net.minecraft.client.data.models.model.ModelLocationUtils
  • 类型:public class
  • 包:net.minecraft.client.data.models.model
  • 源码路径:src/main/java/net/minecraft/client/data/models/model/ModelLocationUtils.java
  • 起始行号:L11
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

方法

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

public static Identifier decorateBlockModelLocation(String id) @ L12

  • 方法名:decorateBlockModelLocation
  • 源码定位:L12
  • 返回类型:Identifier
  • 修饰符:public static

参数:

  • id: String

说明:

TODO

public static Identifier decorateItemModelLocation(String id) @ L17

  • 方法名:decorateItemModelLocation
  • 源码定位:L17
  • 返回类型:Identifier
  • 修饰符:public static

参数:

  • id: String

说明:

TODO

public static Identifier getModelLocation(Block block, String suffix) @ L21

  • 方法名:getModelLocation
  • 源码定位:L21
  • 返回类型:Identifier
  • 修饰符:public static

参数:

  • block: Block
  • suffix: String

说明:

TODO

public static Identifier getModelLocation(Block block) @ L26

  • 方法名:getModelLocation
  • 源码定位:L26
  • 返回类型:Identifier
  • 修饰符:public static

参数:

  • block: Block

说明:

TODO

public static Identifier getModelLocation(Item item) @ L31

  • 方法名:getModelLocation
  • 源码定位:L31
  • 返回类型:Identifier
  • 修饰符:public static

参数:

  • item: Item

说明:

TODO

public static Identifier getModelLocation(Item item, String suffix) @ L36

  • 方法名:getModelLocation
  • 源码定位:L36
  • 返回类型:Identifier
  • 修饰符:public static

参数:

  • item: Item
  • suffix: String

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class ModelLocationUtils {
    @Deprecated
    public static Identifier decorateBlockModelLocation(String id) {
        return Identifier.withDefaultNamespace("block/" + id);
    }
 
    public static Identifier decorateItemModelLocation(String id) {
        return Identifier.withDefaultNamespace("item/" + id);
    }
 
    public static Identifier getModelLocation(Block block, String suffix) {
        Identifier key = BuiltInRegistries.BLOCK.getKey(block);
        return key.withPath(path -> "block/" + path + suffix);
    }
 
    public static Identifier getModelLocation(Block block) {
        Identifier key = BuiltInRegistries.BLOCK.getKey(block);
        return key.withPrefix("block/");
    }
 
    public static Identifier getModelLocation(Item item) {
        Identifier key = BuiltInRegistries.ITEM.getKey(item);
        return key.withPrefix("item/");
    }
 
    public static Identifier getModelLocation(Item item, String suffix) {
        Identifier key = BuiltInRegistries.ITEM.getKey(item);
        return key.withPath(path -> "item/" + path + suffix);
    }
}

引用的其他类

  • Identifier

    • 引用位置: 方法调用/返回值
    • 关联成员: Identifier.withDefaultNamespace()
  • Item

    • 引用位置: 参数
  • Block

    • 引用位置: 参数