123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- package me.km.items;
- import static net.minecraft.client.model.ModelBase.copyModelAngles;
- import net.minecraft.client.model.ModelBiped;
- import net.minecraft.client.model.ModelRenderer;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.item.EntityArmorStand;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- @SideOnly(Side.CLIENT)
- public class ModelHat extends ModelBiped
- {
- private final ModelRenderer firstHeadPart;
- private final ModelRenderer secHeadPart;
- public ModelHat(float scale)
- {
- super(scale, 0, 64, 64);
-
- firstHeadPart = new ModelRenderer(this, 0, 32);
- firstHeadPart.addBox(-5, -8.6f, -5, 10, 1, 10);
- firstHeadPart.setRotationPoint(0F, 0F, 0F);
- firstHeadPart.setTextureSize(64, 64);
- firstHeadPart.mirror = true;
- setRotation(firstHeadPart, 0, 0, 0);
-
- secHeadPart = new ModelRenderer(this, 0, 43);
- secHeadPart.addBox(-3, -11.6f, -3, 6, 3, 6);
- secHeadPart.setRotationPoint(0F, 0F, 0F);
- secHeadPart.setTextureSize(64, 64);
- secHeadPart.mirror = true;
- setRotation(secHeadPart, 0, 0, 0);
-
- bipedHead.addChild(firstHeadPart);
- bipedHead.addChild(secHeadPart);
- }
-
- @Override
- public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
- {
- if (entityIn instanceof EntityArmorStand)
- {
- EntityArmorStand entityarmorstand = (EntityArmorStand)entityIn;
- this.bipedHead.rotateAngleX = 0.017453292F * entityarmorstand.getHeadRotation().getX();
- this.bipedHead.rotateAngleY = 0.017453292F * entityarmorstand.getHeadRotation().getY();
- this.bipedHead.rotateAngleZ = 0.017453292F * entityarmorstand.getHeadRotation().getZ();
- this.bipedHead.setRotationPoint(0.0F, 1.0F, 0.0F);
- this.bipedBody.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
- this.bipedBody.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
- this.bipedBody.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
- this.bipedLeftArm.rotateAngleX = 0.017453292F * entityarmorstand.getLeftArmRotation().getX();
- this.bipedLeftArm.rotateAngleY = 0.017453292F * entityarmorstand.getLeftArmRotation().getY();
- this.bipedLeftArm.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftArmRotation().getZ();
- this.bipedRightArm.rotateAngleX = 0.017453292F * entityarmorstand.getRightArmRotation().getX();
- this.bipedRightArm.rotateAngleY = 0.017453292F * entityarmorstand.getRightArmRotation().getY();
- this.bipedRightArm.rotateAngleZ = 0.017453292F * entityarmorstand.getRightArmRotation().getZ();
- this.bipedLeftLeg.rotateAngleX = 0.017453292F * entityarmorstand.getLeftLegRotation().getX();
- this.bipedLeftLeg.rotateAngleY = 0.017453292F * entityarmorstand.getLeftLegRotation().getY();
- this.bipedLeftLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftLegRotation().getZ();
- this.bipedLeftLeg.setRotationPoint(1.9F, 11.0F, 0.0F);
- this.bipedRightLeg.rotateAngleX = 0.017453292F * entityarmorstand.getRightLegRotation().getX();
- this.bipedRightLeg.rotateAngleY = 0.017453292F * entityarmorstand.getRightLegRotation().getY();
- this.bipedRightLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getRightLegRotation().getZ();
- this.bipedRightLeg.setRotationPoint(-1.9F, 11.0F, 0.0F);
- copyModelAngles(this.bipedHead, this.bipedHeadwear);
- return;
- }
- super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
- }
- private void setRotation(ModelRenderer model, float x, float y, float z)
- {
- model.rotateAngleX = x;
- model.rotateAngleY = y;
- model.rotateAngleZ = z;
- }
- }
|