Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.maideniles.beautifulbiomes.model;
- import net.minecraft.client.model.ModelBase;
- import net.minecraft.client.model.ModelRenderer;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.passive.EntityOcelot;
- import net.minecraft.util.math.MathHelper;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- @SideOnly(Side.CLIENT)
- public class ModelMintyKitty extends ModelBase
- {
- /** The back left leg model for the Ocelot. */
- private final ModelRenderer kittyBackLeftLeg;
- /** The back right leg model for the Ocelot. */
- private final ModelRenderer kittyBackRightLeg;
- /** The front left leg model for the Ocelot. */
- private final ModelRenderer kittyFrontLeftLeg;
- /** The front right leg model for the Ocelot. */
- private final ModelRenderer kittyFrontRightLeg;
- /** The tail model for the Ocelot. */
- private final ModelRenderer kittyTail;
- /** The second part of tail model for the Ocelot. */
- private final ModelRenderer kittyTail2;
- /** The head model for the Ocelot. */
- private final ModelRenderer kittyHead;
- /** The body model for the Ocelot. */
- private final ModelRenderer kittyBody;
- private int state = 1;
- public ModelMintyKitty()
- {
- this.setTextureOffset("head.main", 0, 0);
- this.setTextureOffset("head.nose", 0, 24);
- this.setTextureOffset("head.ear1", 0, 10);
- this.setTextureOffset("head.ear2", 6, 10);
- this.kittyHead = new ModelRenderer(this, "head");
- this.kittyHead.addBox("main", -2.5F, -2.0F, -3.0F, 5, 4, 5);
- this.kittyHead.addBox("nose", -1.5F, 0.0F, -4.0F, 3, 2, 2);
- this.kittyHead.addBox("ear1", -2.0F, -3.0F, 0.0F, 1, 1, 2);
- this.kittyHead.addBox("ear2", 1.0F, -3.0F, 0.0F, 1, 1, 2);
- this.kittyHead.setRotationPoint(0.0F, 15.0F, -9.0F);
- this.kittyBody = new ModelRenderer(this, 20, 0);
- this.kittyBody.addBox(-2.0F, 3.0F, -8.0F, 4, 16, 6, 0.0F);
- this.kittyBody.setRotationPoint(0.0F, 12.0F, -10.0F);
- this.kittyTail = new ModelRenderer(this, 0, 15);
- this.kittyTail.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1);
- this.kittyTail.rotateAngleX = 0.9F;
- this.kittyTail.setRotationPoint(0.0F, 15.0F, 8.0F);
- this.kittyTail2 = new ModelRenderer(this, 4, 15);
- this.kittyTail2.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1);
- this.kittyTail2.setRotationPoint(0.0F, 20.0F, 14.0F);
- this.kittyBackLeftLeg = new ModelRenderer(this, 8, 13);
- this.kittyBackLeftLeg.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2);
- this.kittyBackLeftLeg.setRotationPoint(1.1F, 18.0F, 5.0F);
- this.kittyBackRightLeg = new ModelRenderer(this, 8, 13);
- this.kittyBackRightLeg.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2);
- this.kittyBackRightLeg.setRotationPoint(-1.1F, 18.0F, 5.0F);
- this.kittyFrontLeftLeg = new ModelRenderer(this, 40, 0);
- this.kittyFrontLeftLeg.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2);
- this.kittyFrontLeftLeg.setRotationPoint(1.2F, 13.8F, -5.0F);
- this.kittyFrontRightLeg = new ModelRenderer(this, 40, 0);
- this.kittyFrontRightLeg.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2);
- this.kittyFrontRightLeg.setRotationPoint(-1.2F, 13.8F, -5.0F);
- }
- /**
- * Sets the models various rotation angles then renders the model.
- */
- public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale)
- {
- this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn);
- if (this.isChild)
- {
- float f = 2.0F;
- GlStateManager.pushMatrix();
- GlStateManager.scale(0.75F, 0.75F, 0.75F);
- GlStateManager.translate(0.0F, 10.0F * scale, 4.0F * scale);
- this.kittyHead.render(scale);
- GlStateManager.popMatrix();
- GlStateManager.pushMatrix();
- GlStateManager.scale(0.5F, 0.5F, 0.5F);
- GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
- this.kittyBody.render(scale);
- this.kittyBackLeftLeg.render(scale);
- this.kittyBackRightLeg.render(scale);
- this.kittyFrontLeftLeg.render(scale);
- this.kittyFrontRightLeg.render(scale);
- this.kittyTail.render(scale);
- this.kittyTail2.render(scale);
- GlStateManager.popMatrix();
- }
- else
- {
- this.kittyHead.render(scale);
- this.kittyBody.render(scale);
- this.kittyTail.render(scale);
- this.kittyTail2.render(scale);
- this.kittyBackLeftLeg.render(scale);
- this.kittyBackRightLeg.render(scale);
- this.kittyFrontLeftLeg.render(scale);
- this.kittyFrontRightLeg.render(scale);
- }
- }
- /**
- * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
- * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
- * "far" arms and legs can swing at most.
- */
- public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
- {
- this.kittyHead.rotateAngleX = headPitch * 0.017453292F;
- this.kittyHead.rotateAngleY = netHeadYaw * 0.017453292F;
- if (this.state != 3)
- {
- this.kittyBody.rotateAngleX = ((float)Math.PI / 2F);
- if (this.state == 2)
- {
- this.kittyBackLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * limbSwingAmount;
- this.kittyBackRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + 0.3F) * limbSwingAmount;
- this.kittyFrontLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI + 0.3F) * limbSwingAmount;
- this.kittyFrontRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * limbSwingAmount;
- this.kittyTail2.rotateAngleX = 1.7278761F + ((float)Math.PI / 10F) * MathHelper.cos(limbSwing) * limbSwingAmount;
- }
- else
- {
- this.kittyBackLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * limbSwingAmount;
- this.kittyBackRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * limbSwingAmount;
- this.kittyFrontLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * limbSwingAmount;
- this.kittyFrontRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * limbSwingAmount;
- if (this.state == 1)
- {
- this.kittyTail2.rotateAngleX = 1.7278761F + ((float)Math.PI / 4F) * MathHelper.cos(limbSwing) * limbSwingAmount;
- }
- else
- {
- this.kittyTail2.rotateAngleX = 1.7278761F + 0.47123894F * MathHelper.cos(limbSwing) * limbSwingAmount;
- }
- }
- }
- }
- /**
- * Used for easily adding entity-dependent animations. The second and third float params here are the same second
- * and third as in the setRotationAngles method.
- */
- public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTickTime)
- {
- EntityOcelot entitykitty = (EntityOcelot)entitylivingbaseIn;
- this.kittyBody.rotationPointY = 12.0F;
- this.kittyBody.rotationPointZ = -10.0F;
- this.kittyHead.rotationPointY = 15.0F;
- this.kittyHead.rotationPointZ = -9.0F;
- this.kittyTail.rotationPointY = 15.0F;
- this.kittyTail.rotationPointZ = 8.0F;
- this.kittyTail2.rotationPointY = 20.0F;
- this.kittyTail2.rotationPointZ = 14.0F;
- this.kittyFrontLeftLeg.rotationPointY = 13.8F;
- this.kittyFrontLeftLeg.rotationPointZ = -5.0F;
- this.kittyFrontRightLeg.rotationPointY = 13.8F;
- this.kittyFrontRightLeg.rotationPointZ = -5.0F;
- this.kittyBackLeftLeg.rotationPointY = 18.0F;
- this.kittyBackLeftLeg.rotationPointZ = 5.0F;
- this.kittyBackRightLeg.rotationPointY = 18.0F;
- this.kittyBackRightLeg.rotationPointZ = 5.0F;
- this.kittyTail.rotateAngleX = 0.9F;
- if (entitykitty.isSneaking())
- {
- ++this.kittyBody.rotationPointY;
- this.kittyHead.rotationPointY += 2.0F;
- ++this.kittyTail.rotationPointY;
- this.kittyTail2.rotationPointY += -4.0F;
- this.kittyTail2.rotationPointZ += 2.0F;
- this.kittyTail.rotateAngleX = ((float)Math.PI / 2F);
- this.kittyTail2.rotateAngleX = ((float)Math.PI / 2F);
- this.state = 0;
- }
- else if (entitykitty.isSprinting())
- {
- this.kittyTail2.rotationPointY = this.kittyTail.rotationPointY;
- this.kittyTail2.rotationPointZ += 2.0F;
- this.kittyTail.rotateAngleX = ((float)Math.PI / 2F);
- this.kittyTail2.rotateAngleX = ((float)Math.PI / 2F);
- this.state = 2;
- }
- else if (entitykitty.isSitting())
- {
- this.kittyBody.rotateAngleX = ((float)Math.PI / 4F);
- this.kittyBody.rotationPointY += -4.0F;
- this.kittyBody.rotationPointZ += 5.0F;
- this.kittyHead.rotationPointY += -3.3F;
- ++this.kittyHead.rotationPointZ;
- this.kittyTail.rotationPointY += 8.0F;
- this.kittyTail.rotationPointZ += -2.0F;
- this.kittyTail2.rotationPointY += 2.0F;
- this.kittyTail2.rotationPointZ += -0.8F;
- this.kittyTail.rotateAngleX = 1.7278761F;
- this.kittyTail2.rotateAngleX = 2.670354F;
- this.kittyFrontLeftLeg.rotateAngleX = -0.15707964F;
- this.kittyFrontLeftLeg.rotationPointY = 15.8F;
- this.kittyFrontLeftLeg.rotationPointZ = -7.0F;
- this.kittyFrontRightLeg.rotateAngleX = -0.15707964F;
- this.kittyFrontRightLeg.rotationPointY = 15.8F;
- this.kittyFrontRightLeg.rotationPointZ = -7.0F;
- this.kittyBackLeftLeg.rotateAngleX = -((float)Math.PI / 2F);
- this.kittyBackLeftLeg.rotationPointY = 21.0F;
- this.kittyBackLeftLeg.rotationPointZ = 1.0F;
- this.kittyBackRightLeg.rotateAngleX = -((float)Math.PI / 2F);
- this.kittyBackRightLeg.rotationPointY = 21.0F;
- this.kittyBackRightLeg.rotationPointZ = 1.0F;
- this.state = 3;
- }
- else
- {
- this.state = 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement