| 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 |
|