package net.minecraft.client.renderer.entity.layers; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.resources.ResourceLocation; @Environment(EnvType.CLIENT) public abstract class RenderLayer> { private final RenderLayerParent renderer; public RenderLayer(RenderLayerParent renderer) { this.renderer = renderer; } protected static void coloredCutoutModelCopyLayerRender( EntityModel model, ResourceLocation textureLocation, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, S renderState, int color ) { if (!renderState.isInvisible) { model.setupAnim(renderState); renderColoredCutoutModel(model, textureLocation, poseStack, bufferSource, packedLight, renderState, color); } } protected static void renderColoredCutoutModel( EntityModel model, ResourceLocation textureLocation, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, LivingEntityRenderState renderState, int color ) { VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.entityCutoutNoCull(textureLocation)); model.renderToBuffer(poseStack, vertexConsumer, packedLight, LivingEntityRenderer.getOverlayCoords(renderState, 0.0F), color); } public M getParentModel() { return this.renderer.getModel(); } public abstract void render(PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, S renderState, float yRot, float xRot); }