| 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.EntityModel;
|
| 7 | import net.minecraft.client.model.animal.sheep.SheepFurModel;
|
| 8 | import net.minecraft.client.model.animal.sheep.SheepModel;
|
| 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.LivingEntityRenderer;
|
| 13 | import net.minecraft.client.renderer.entity.RenderLayerParent;
|
| 14 | import net.minecraft.client.renderer.entity.state.SheepRenderState;
|
| 15 | import net.minecraft.client.renderer.rendertype.RenderTypes;
|
| 16 | import net.minecraft.resources.Identifier;
|
| 17 |
|
| 18 | @Environment(EnvType.CLIENT)
|
| 19 | public class SheepWoolLayer extends RenderLayer<SheepRenderState, SheepModel> {
|
| 20 | private static final Identifier SHEEP_WOOL_LOCATION = Identifier.withDefaultNamespace("textures/entity/sheep/sheep_wool.png");
|
| 21 | private static final Identifier BABY_SHEEP_WOOL_LOCATION = Identifier.withDefaultNamespace("textures/entity/sheep/sheep_wool_baby.png");
|
| 22 | private final EntityModel<SheepRenderState> adultModel;
|
| 23 | private final EntityModel<SheepRenderState> babyModel;
|
| 24 |
|
| 25 | public SheepWoolLayer(final RenderLayerParent<SheepRenderState, SheepModel> renderer, final EntityModelSet modelSet) {
|
| 26 | super(renderer);
|
| 27 | this.adultModel = new SheepFurModel(modelSet.bakeLayer(ModelLayers.SHEEP_WOOL));
|
| 28 | this.babyModel = new SheepFurModel(modelSet.bakeLayer(ModelLayers.SHEEP_BABY_WOOL));
|
| 29 | }
|
| 30 |
|
| 31 | public void submit(
|
| 32 | final PoseStack poseStack,
|
| 33 | final SubmitNodeCollector submitNodeCollector,
|
| 34 | final int lightCoords,
|
| 35 | final SheepRenderState state,
|
| 36 | final float yRot,
|
| 37 | final float xRot
|
| 38 | ) {
|
| 39 | if (!state.isSheared) {
|
| 40 | EntityModel<SheepRenderState> model = state.isBaby ? this.babyModel : this.adultModel;
|
| 41 | Identifier location = state.isBaby ? BABY_SHEEP_WOOL_LOCATION : SHEEP_WOOL_LOCATION;
|
| 42 | if (state.isInvisible) {
|
| 43 | if (state.appearsGlowing()) {
|
| 44 | submitNodeCollector.submitModel(
|
| 45 | model,
|
| 46 | state,
|
| 47 | poseStack,
|
| 48 | RenderTypes.outline(location),
|
| 49 | lightCoords,
|
| 50 | LivingEntityRenderer.getOverlayCoords(state, 0.0F),
|
| 51 | -16777216,
|
| 52 | null,
|
| 53 | state.outlineColor
|
| 54 | );
|
| 55 | }
|
| 56 | } else {
|
| 57 | coloredCutoutModelCopyLayerRender(model, location, poseStack, submitNodeCollector, lightCoords, state, state.getWoolColor(), state.isBaby ? 1 : 0);
|
| 58 | }
|
| 59 | }
|
| 60 | }
|
| 61 | }
|
| 62 |
|