SimpleModelWrapper.java
net.minecraft.client.resources.model.SimpleModelWrapper
信息
- 全限定名:net.minecraft.client.resources.model.SimpleModelWrapper
- 类型:public record
- 包:net.minecraft.client.resources.model
- 源码路径:src/main/java/net/minecraft/client/resources/model/SimpleModelWrapper.java
- 起始行号:L23
- 实现:BlockStateModelPart
- 职责:
TODO
字段/常量
LOGGER- 类型:
Logger - 修饰符:
private static final - 源码定位:
L24 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public static BlockStateModelPart bake(ModelBaker modelBakery, Identifier location, ModelState state) @ L26
- 方法名:bake
- 源码定位:L26
- 返回类型:BlockStateModelPart
- 修饰符:public static
参数:
- modelBakery: ModelBaker
- location: Identifier
- state: ModelState
说明:
TODO
public List<BakedQuad> getQuads(Direction direction) @ L53
- 方法名:getQuads
- 源码定位:L53
- 返回类型:List
- 修饰符:public
参数:
- direction: Direction
说明:
TODO
public int materialFlags() @ L58
- 方法名:materialFlags
- 源码定位:L58
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public record SimpleModelWrapper(QuadCollection quads, boolean useAmbientOcclusion, Material.Baked particleMaterial) implements BlockStateModelPart {
private static final Logger LOGGER = LogUtils.getLogger();
public static BlockStateModelPart bake(ModelBaker modelBakery, Identifier location, ModelState state) {
ResolvedModel model = modelBakery.getModel(location);
TextureSlots textureSlots = model.getTopTextureSlots();
boolean hasAmbientOcclusion = model.getTopAmbientOcclusion();
Material.Baked particleMaterial = model.resolveParticleMaterial(textureSlots, modelBakery);
QuadCollection geometry = model.bakeTopGeometry(textureSlots, modelBakery, state);
Multimap<Identifier, Identifier> forbiddenSprites = null;
for (BakedQuad bakedQuad : geometry.getAll()) {
TextureAtlasSprite sprite = bakedQuad.materialInfo().sprite();
if (!sprite.atlasLocation().equals(TextureAtlas.LOCATION_BLOCKS)) {
if (forbiddenSprites == null) {
forbiddenSprites = HashMultimap.create();
}
forbiddenSprites.put(sprite.atlasLocation(), sprite.contents().name());
}
}
if (forbiddenSprites != null) {
LOGGER.warn("Rejecting block model {}, since it contains sprites from outside of supported atlas: {}", location, forbiddenSprites);
return modelBakery.missingBlockModelPart();
} else {
return new SimpleModelWrapper(geometry, hasAmbientOcclusion, particleMaterial);
}
}
@Override
public List<BakedQuad> getQuads(@Nullable Direction direction) {
return this.quads.getQuads(direction);
}
@Override
public int materialFlags() {
return this.quads.materialFlags();
}
}引用的其他类
-
- 引用位置:
实现/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置: