CatCollarLayer .java

net.minecraft.client.renderer.entity.layers.CatCollarLayer (class): members: CAT_BABY_COLLAR_LOCATION, CAT_COLLAR_LOCATION, adultModel, babyModel, yRot.

net.minecraft.client.renderer.entity.layersclass47 linesclientextends RenderLayer<CatRenderState2.1 KB

API Surface (1)

void submit(final PoseStack poseStack, final SubmitNodeCollector submitNodeCollector, final int lightCoords, final CatRenderState state, final float yRot, final float xRot)

Fields & Constants (9)

CAT_COLLAR_LOCATION
CAT_BABY_COLLAR_LOCATION
adultModel
babyModel
poseStack
submitNodeCollector
lightCoords
state
yRot

String literals (2)

"textures/entity/cat/cat_collar.png"
"textures/entity/cat/cat_collar_baby.png"

Full Source

CatCollarLayer.java47 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer.entity.layers;
2
3
import com.mojang.blaze3d.vertex.PoseStack;
4
import net.fabricmc.api.EnvType;
5
import net.fabricmc.api.Environment;
6
import net.minecraft.client.model.animal.feline.AbstractFelineModel;
7
import net.minecraft.client.model.animal.feline.AdultCatModel;
8
import net.minecraft.client.model.animal.feline.BabyCatModel;
9
import net.minecraft.client.model.geom.EntityModelSet;
10
import net.minecraft.client.model.geom.ModelLayers;
11
import net.minecraft.client.renderer.SubmitNodeCollector;
12
import net.minecraft.client.renderer.entity.RenderLayerParent;
13
import net.minecraft.client.renderer.entity.state.CatRenderState;
14
import net.minecraft.resources.Identifier;
15
import net.minecraft.world.item.DyeColor;
16
17
@Environment(EnvType.CLIENT)
18
public class CatCollarLayer extends RenderLayer<CatRenderState, AbstractFelineModel<CatRenderState>> {
19
	private static final Identifier CAT_COLLAR_LOCATION = Identifier.withDefaultNamespace("textures/entity/cat/cat_collar.png");
20
	private static final Identifier CAT_BABY_COLLAR_LOCATION = Identifier.withDefaultNamespace("textures/entity/cat/cat_collar_baby.png");
21
	private final AdultCatModel adultModel;
22
	private final BabyCatModel babyModel;
23
24
	public CatCollarLayer(final RenderLayerParent<CatRenderState, AbstractFelineModel<CatRenderState>> renderer, final EntityModelSet modelSet) {
25
		super(renderer);
26
		this.adultModel = new AdultCatModel(modelSet.bakeLayer(ModelLayers.CAT_COLLAR));
27
		this.babyModel = new BabyCatModel(modelSet.bakeLayer(ModelLayers.CAT_BABY_COLLAR));
28
	}
29
30
	public void submit(
31
		final PoseStack poseStack,
32
		final SubmitNodeCollector submitNodeCollector,
33
		final int lightCoords,
34
		final CatRenderState state,
35
		final float yRot,
36
		final float xRot
37
	) {
38
		DyeColor collarColor = state.collarColor;
39
		if (collarColor != null) {
40
			int color = collarColor.getTextureDiffuseColor();
41
			AbstractFelineModel<CatRenderState> model = state.isBaby ? this.babyModel : this.adultModel;
42
			Identifier texture = state.isBaby ? CAT_BABY_COLLAR_LOCATION : CAT_COLLAR_LOCATION;
43
			coloredCutoutModelCopyLayerRender(model, texture, poseStack, submitNodeCollector, lightCoords, state, color, 1);
44
		}
45
	}
46
}
47

Decompiled Minecraft 26.3 source of CatCollarLayer (net/minecraft/client/renderer/entity/layers/CatCollarLayer.java) with Mojang official mappings, stored verbatim on the site.