package com.acethewildfire.acesbs.entity.client;

import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.entity.custom.FrenEntity;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.command.OrderedRenderCommandQueue;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.client.render.state.CameraRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;

public class FrenRenderer extends MobEntityRenderer<FrenEntity, FrenState, FrenModel> {
    public FrenRenderer(EntityRendererFactory.Context context) {
        super(context, new FrenModel(context.getPart(FrenModel.FREN)), 0.75f);
    }

    @Override
    public Identifier getTexture(FrenState state) {
        return Identifier.of(AcesBS.MOD_ID, "textures/entity/fren/fren.png");
    }

    @Override
    public void render(FrenState livingEntityRenderState, MatrixStack matrixStack, OrderedRenderCommandQueue orderedRenderCommandQueue, CameraRenderState cameraRenderState) {
        if(livingEntityRenderState.baby) {
            matrixStack.scale(0.5f, 0.5f, 0.5f);
        } else {
            matrixStack.scale(1f, 1f, 1f);
        }

        super.render(livingEntityRenderState, matrixStack, orderedRenderCommandQueue, cameraRenderState);
    }

    @Override
    public FrenState createRenderState() {
        return new FrenState();
    }

    @Override
    public void updateRenderState(FrenEntity livingEntity, FrenState livingEntityRenderState, float f) {
        super.updateRenderState(livingEntity, livingEntityRenderState, f);
        livingEntityRenderState.idleAnimationState.copyFrom(livingEntity.idleAnimationState);
    }
}