MushroomCowRenderer.java
net.minecraft.client.renderer.entity.MushroomCowRenderer
信息
- 全限定名:net.minecraft.client.renderer.entity.MushroomCowRenderer
- 类型:public class
- 包:net.minecraft.client.renderer.entity
- 源码路径:src/main/java/net/minecraft/client/renderer/entity/MushroomCowRenderer.java
- 起始行号:L19
- 继承:AgeableMobRenderer<MushroomCow,MushroomCowRenderState,CowModel>
- 职责:
TODO
字段/常量
-
BLOCK_DISPLAY_CONTEXT- 类型:
BlockDisplayContext - 修饰符:
public static final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
TEXTURES- 类型:
Map<MushroomCow.Variant,MushroomCowRenderer.MushroomCowTexture> - 修饰符:
private static final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
blockModelResolver- 类型:
BlockModelResolver - 修饰符:
private final - 源码定位:
L40 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.client.renderer.entity.MushroomCowRenderer.MushroomCowTexture- 类型:
record - 修饰符:
private - 源码定位:
L63 - 说明:
TODO
- 类型:
构造器
public MushroomCowRenderer(EntityRendererProvider.Context context) @ L42
- 构造器名:MushroomCowRenderer
- 源码定位:L42
- 修饰符:public
参数:
- context: EntityRendererProvider.Context
说明:
TODO
方法
下面的方法块按源码顺序生成。
public Identifier getTextureLocation(MushroomCowRenderState state) @ L48
- 方法名:getTextureLocation
- 源码定位:L48
- 返回类型:Identifier
- 修饰符:public
参数:
- state: MushroomCowRenderState
说明:
TODO
public MushroomCowRenderState createRenderState() @ L52
- 方法名:createRenderState
- 源码定位:L52
- 返回类型:MushroomCowRenderState
- 修饰符:public
参数:
- 无
说明:
TODO
public void extractRenderState(MushroomCow entity, MushroomCowRenderState state, float partialTicks) @ L56
- 方法名:extractRenderState
- 源码定位:L56
- 返回类型:void
- 修饰符:public
参数:
- entity: MushroomCow
- state: MushroomCowRenderState
- partialTicks: float
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class MushroomCowRenderer extends AgeableMobRenderer<MushroomCow, MushroomCowRenderState, CowModel> {
public static final BlockDisplayContext BLOCK_DISPLAY_CONTEXT = BlockDisplayContext.create();
private static final Map<MushroomCow.Variant, MushroomCowRenderer.MushroomCowTexture> TEXTURES = Util.make(
Maps.newHashMap(),
map -> {
map.put(
MushroomCow.Variant.BROWN,
new MushroomCowRenderer.MushroomCowTexture(
Identifier.withDefaultNamespace("textures/entity/cow/mooshroom_brown.png"),
Identifier.withDefaultNamespace("textures/entity/cow/mooshroom_brown_baby.png")
)
);
map.put(
MushroomCow.Variant.RED,
new MushroomCowRenderer.MushroomCowTexture(
Identifier.withDefaultNamespace("textures/entity/cow/mooshroom_red.png"),
Identifier.withDefaultNamespace("textures/entity/cow/mooshroom_red_baby.png")
)
);
}
);
private final BlockModelResolver blockModelResolver;
public MushroomCowRenderer(EntityRendererProvider.Context context) {
super(context, new CowModel(context.bakeLayer(ModelLayers.MOOSHROOM)), new BabyCowModel(context.bakeLayer(ModelLayers.MOOSHROOM_BABY)), 0.7F);
this.blockModelResolver = context.getBlockModelResolver();
this.addLayer(new MushroomCowMushroomLayer(this));
}
public Identifier getTextureLocation(MushroomCowRenderState state) {
return state.isBaby ? TEXTURES.get(state.variant).baby : TEXTURES.get(state.variant).adult;
}
public MushroomCowRenderState createRenderState() {
return new MushroomCowRenderState();
}
public void extractRenderState(MushroomCow entity, MushroomCowRenderState state, float partialTicks) {
super.extractRenderState(entity, state, partialTicks);
state.variant = entity.getVariant();
this.blockModelResolver.update(state.mushroomModel, state.variant.getBlockState(), BLOCK_DISPLAY_CONTEXT);
}
@OnlyIn(Dist.CLIENT)
private record MushroomCowTexture(Identifier adult, Identifier baby) {
}
}引用的其他类
-
- 引用位置:
构造调用 - 关联成员:
BabyCowModel()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
CowModel()
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
BlockDisplayContext.create()
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
MushroomCowMushroomLayer()
- 引用位置:
-
- 引用位置:
参数/构造调用/返回值 - 关联成员:
MushroomCowRenderState()
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
Identifier.withDefaultNamespace()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Util.make()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置: