Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @OnlyIn(Dist.CLIENT)
- public class EntityWarthogModel<T extends EntityWarthog> extends EntityModel<T>
- {
- private float headRotationAngleX;
- public RendererModel body;
- public RendererModel tail;
- public RendererModel head;
- public RendererModel leg1;
- public RendererModel leg2;
- public RendererModel leg3;
- public RendererModel leg4;
- public RendererModel jaws;
- public RendererModel tusk1;
- public RendererModel tusk2;
- public EntityWarthogModel()
- {
- this.textureWidth = 64;
- this.textureHeight = 32;
- this.tail = new RendererModel(this, 28, 6);
- this.tail.setRotationPoint(0.0F, -2.6F, 7.0F);
- this.tail.addBox(-0.5F, 0.0F, -0.5F, 1, 7, 1, 0.0F);
- this.setRotateAngle(tail, 0.27314402793711257F, 0.0F, 0.0F);
- this.leg3 = new RendererModel(this, 50, 0);
- this.leg3.setRotationPoint(-2.8F, 2.6F, -4.8F);
- this.leg3.addBox(-1.5F, 0.0F, -2.0F, 3, 6, 4, 0.0F);
- this.tusk1 = new RendererModel(this, 23, 0);
- this.tusk1.setRotationPoint(1.2F, 0.8F, -2.1F);
- this.tusk1.addBox(0.0F, -0.5F, -0.5F, 3, 1, 1, 0.0F);
- this.setRotateAngle(tusk1, 0.0F, 0.0F, -0.18203784098300857F);
- this.leg1 = new RendererModel(this, 50, 0);
- this.leg1.setRotationPoint(2.8F, 2.6F, 6.0F);
- this.leg1.addBox(-1.5F, 0.0F, -2.0F, 3, 6, 4, 0.0F);
- this.tusk2 = new RendererModel(this, 23, 0);
- this.tusk2.setRotationPoint(-1.2F, 0.8F, -2.1F);
- this.tusk2.addBox(-3.0F, -0.5F, -0.5F, 3, 1, 1, 0.0F);
- this.setRotateAngle(tusk2, 0.0F, 0.0F, 0.18203784098300857F);
- this.head = new RendererModel(this, 0, 0);
- this.head.setRotationPoint(0.0F, -2.8F, -5.0F);
- this.head.addBox(-3.5F, -3.5F, -7.0F, 7, 7, 7, 0.0F);
- this.body = new RendererModel(this, 18, 0);
- this.body.setRotationPoint(0.0F, 13.6F, 0.0F);
- this.body.addBox(-4.5F, -4.5F, -7.0F, 9, 8, 14, 0.0F);
- this.leg2 = new RendererModel(this, 50, 0);
- this.leg2.setRotationPoint(-2.8F, 2.6F, 6.0F);
- this.leg2.addBox(-1.5F, 0.0F, -2.0F, 3, 6, 4, 0.0F);
- this.leg4 = new RendererModel(this, 50, 0);
- this.leg4.setRotationPoint(2.8F, 2.6F, -4.8F);
- this.leg4.addBox(-1.5F, 0.0F, -2.0F, 3, 6, 4, 0.0F);
- this.jaws = new RendererModel(this, 2, 14);
- this.jaws.setRotationPoint(0.0F, 1.5F, -6.0F);
- this.jaws.addBox(-2.5F, -2.0F, -3.0F, 5, 4, 3, 0.0F);
- this.jaws.addChild(this.tusk1);
- this.jaws.addChild(this.tusk2);
- this.head.addChild(this.jaws);
- this.body.addChild(this.leg1);
- this.body.addChild(this.leg2);
- this.body.addChild(this.leg3);
- this.body.addChild(this.leg4);
- this.body.addChild(this.tail);
- }
- public void setLivingAnimations(T entityIn, float limbSwing, float limbSwingAmount, float partialTick)
- {
- super.setLivingAnimations(entityIn, limbSwing, limbSwingAmount, partialTick);
- this.headRotationAngleX = entityIn.getHeadRotationAngleX(partialTick);
- }
- public void setRotateAngle(RendererModel modelRenderer, float x, float y, float z)
- {
- modelRenderer.rotateAngleX = x;
- modelRenderer.rotateAngleY = y;
- modelRenderer.rotateAngleZ = z;
- }
- public void render(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale)
- {
- this.setRotationAngles(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
- if (this.isChild)
- {
- float f = 2.0F;
- GlStateManager.pushMatrix();
- GlStateManager.translatef(0.0F, 6.0F * scale, 0.0F);
- this.head.render(scale);
- GlStateManager.popMatrix();
- GlStateManager.pushMatrix();
- GlStateManager.scalef(0.5F / f, 0.5F / f, 0.5F / f);
- GlStateManager.translatef(0.0F, 24.0F * scale, 0.0F);
- this.body.render(scale);
- GlStateManager.popMatrix();
- }
- else
- {
- this.body.render(scale);
- this.head.render(scale);
- }
- }
- public void setRotationAngles(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor)
- {
- super.setRotationAngles(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor);
- this.head.rotateAngleX = this.headRotationAngleX;
- this.head.rotateAngleX = headPitch * ((float)Math.PI / 180F);
- this.head.rotateAngleY = netHeadYaw * ((float)Math.PI / 180F);
- this.body.rotateAngleX = ((float)Math.PI / 2F);
- this.leg1.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount;
- this.leg2.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount;
- this.leg3.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount;
- this.leg4.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement