package net.minecraft.client.renderer.entity; 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.LeashKnotModel; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.client.renderer.entity.state.EntityRenderState; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.decoration.LeashFenceKnotEntity; @Environment(EnvType.CLIENT) public class LeashKnotRenderer extends EntityRenderer { private static final ResourceLocation KNOT_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/lead_knot.png"); private final LeashKnotModel model; public LeashKnotRenderer(Context context) { super(context); this.model = new LeashKnotModel(context.bakeLayer(ModelLayers.LEASH_KNOT)); } @Override public void render(EntityRenderState renderState, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { poseStack.pushPose(); poseStack.scale(-1.0F, -1.0F, 1.0F); this.model.setupAnim(renderState); VertexConsumer vertexConsumer = bufferSource.getBuffer(this.model.renderType(KNOT_LOCATION)); this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY); poseStack.popPose(); super.render(renderState, poseStack, bufferSource, packedLight); } @Override public EntityRenderState createRenderState() { return new EntityRenderState(); } }