package com.zivilon.cinder_loe.client.model.npc;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;

public class ModelFangornAuroch extends ModelBase {
    public ModelRenderer body;
    
    public ModelRenderer leg1;
    
    public ModelRenderer leg2;
    
    public ModelRenderer leg3;
    
    public ModelRenderer leg4;
    
    public ModelRenderer tail;
    
    public ModelRenderer head;
    
    public ModelRenderer horns;
    
    public ModelRenderer hornLeft1;
    
    public ModelRenderer hornLeft2;
    
    public ModelRenderer hornRight1;
    
    public ModelRenderer hornRight2;

    public ModelFangornAuroch() {
        this.textureWidth = 128;
        this.textureHeight = 64;
        this.body = new ModelRenderer(this, 0, 0);
        this.body.setRotationPoint(0.0F, 2.0F, -1.0F);
        this.body.addBox(-8.0F, -6.0F, -11.0F, 16, 16, 26);
        this.body.setTextureOffset(28, 42).addBox(-8.0F, -8.0F, -8.0F, 16, 2, 10);
        this.body.setTextureOffset(84, 31).addBox(-3.0F, 10.0F, 4.0F, 6, 1, 6);
        this.leg1 = new ModelRenderer(this, 0, 42);
        this.leg1.setRotationPoint(-5.0F, 12.0F, 9.0F);
        this.leg1.addBox(-2.5F, 0.0F, -2.5F, 5, 12, 5);
        this.leg2 = new ModelRenderer(this, 0, 42);
        this.leg2.setRotationPoint(5.0F, 12.0F, 9.0F);
        this.leg2.mirror = true;
        this.leg2.addBox(-2.5F, 0.0F, -2.5F, 5, 12, 5);
        this.leg3 = new ModelRenderer(this, 0, 42);
        this.leg3.setRotationPoint(-5.0F, 12.0F, -7.0F);
        this.leg3.addBox(-2.5F, 0.0F, -2.5F, 5, 12, 5);
        this.leg4 = new ModelRenderer(this, 0, 42);
        this.leg4.setRotationPoint(5.0F, 12.0F, -7.0F);
        this.leg4.mirror = true;
        this.leg4.addBox(-2.5F, 0.0F, -2.5F, 5, 12, 5);
        this.tail = new ModelRenderer(this, 20, 42);
        this.tail.setRotationPoint(0.0F, 1.0F, 14.0F);
        this.tail.addBox(-1.0F, -1.0F, 0.0F, 2, 12, 1);
        this.head = new ModelRenderer(this, 58, 0);
        this.head.setRotationPoint(0.0F, -1.0F, -10.0F);
        this.head.addBox(-5.0F, -4.0F, -12.0F, 10, 10, 11);
        this.head.setTextureOffset(89, 0).addBox(-3.0F, 1.0F, -15.0F, 6, 4, 4);
        this.head.setTextureOffset(105, 0);
        this.head.addBox(-8.0F, -2.5F, -7.0F, 3, 2, 1);
        this.head.mirror = true;
        this.head.addBox(5.0F, -2.5F, -7.0F, 3, 2, 1);
        this.head.mirror = false;
        this.horns = new ModelRenderer(this, 98, 21);
        this.horns.setRotationPoint(0.0F, -3.5F, -5.0F);
        this.horns.addBox(-6.0F, -1.5F, -1.5F, 12, 3, 3);
        this.head.addChild(this.horns);
        this.hornLeft1 = new ModelRenderer(this, 112, 27);
        this.hornLeft1.setRotationPoint(-6.0F, 0.0F, 0.0F);
        this.hornLeft1.addBox(-5.0F, -1.0F, -1.0F, 6, 2, 2);
        this.hornLeft2 = new ModelRenderer(this, 114, 31);
        this.hornLeft2.setRotationPoint(-5.0F, 0.0F, 0.0F);
        this.hornLeft2.addBox(-5.0F, -0.5F, -0.5F, 6, 1, 1);
        this.hornLeft1.addChild(this.hornLeft2);
        this.horns.addChild(this.hornLeft1);
        this.hornRight1 = new ModelRenderer(this, 112, 27);
        this.hornRight1.mirror = true;
        this.hornRight1.setRotationPoint(6.0F, 0.0F, 0.0F);
        this.hornRight1.addBox(-1.0F, -1.0F, -1.0F, 6, 2, 2);
        this.hornRight2 = new ModelRenderer(this, 114, 31);
        this.hornRight2.mirror = true;
        this.hornRight2.setRotationPoint(5.0F, 0.0F, 0.0F);
        this.hornRight2.addBox(-1.0F, -0.5F, -0.5F, 6, 1, 1);
        this.hornRight1.addChild(this.hornRight2);
        this.horns.addChild(this.hornRight1);
    }

    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
        this.horns.showModel = true;
        setRotationAngles(f, f1, f2, f3, f4, f5, entity);
        this.head.render(f5);
        this.body.render(f5);
        this.leg1.render(f5);
        this.leg2.render(f5);
        this.leg3.render(f5);
        this.leg4.render(f5);
        this.tail.render(f5);
    }

    public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
        this.head.rotateAngleX = 0.0F;
        this.head.rotateAngleY = 0.0F;
        this.head.rotateAngleZ = 0.0F;
        this.head.rotateAngleX += (float)Math.toRadians(f4);
        this.head.rotateAngleY += (float)Math.toRadians(f3);
        this.head.rotateAngleX += MathHelper.cos(f * 0.2F) * f1 * 0.4F;
        this.hornLeft1.rotateAngleZ = (float)Math.toRadians(25.0D);
        this.hornLeft2.rotateAngleZ = (float)Math.toRadians(15.0D);
        this.hornRight1.rotateAngleZ = -this.hornLeft1.rotateAngleZ;
        this.hornRight2.rotateAngleZ = -this.hornLeft2.rotateAngleZ;
        this.hornLeft1.rotateAngleY = (float)Math.toRadians(-25.0D);
        this.hornRight1.rotateAngleY = -this.hornLeft1.rotateAngleY;
        this.hornLeft1.rotateAngleX = (float)Math.toRadians(35.0D);
        this.hornRight1.rotateAngleX = this.hornLeft1.rotateAngleX;
        this.leg1.rotateAngleX = MathHelper.cos(f * 0.4F) * f1 * 0.8F;
        this.leg2.rotateAngleX = MathHelper.cos(f * 0.4F + 3.1415927F) * f1 * 0.8F;
        this.leg3.rotateAngleX = MathHelper.cos(f * 0.4F + 3.1415927F) * f1 * 0.8F;
        this.leg4.rotateAngleX = MathHelper.cos(f * 0.4F) * f1 * 0.8F;
    }
}