コード例 #1
0
        /**
         * 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)
        {
            super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
            ItemStack      itemstack      = ((EntityLivingBase)entityIn).getHeldItemMainhand();
            EntitySkeleton entityskeleton = (EntitySkeleton)entityIn;

            if (entityskeleton.func_184725_db() && (itemstack == null || itemstack.getItem() != Items.bow))
            {
                float f  = MathHelper.sin(this.swingProgress * (float)Math.PI);
                float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI);
                this.bipedRightArm.rotateAngleZ  = 0.0F;
                this.bipedLeftArm.rotateAngleZ   = 0.0F;
                this.bipedRightArm.rotateAngleY  = -(0.1F - f * 0.6F);
                this.bipedLeftArm.rotateAngleY   = 0.1F - f * 0.6F;
                this.bipedRightArm.rotateAngleX  = -((float)Math.PI / 2F);
                this.bipedLeftArm.rotateAngleX   = -((float)Math.PI / 2F);
                this.bipedRightArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
                this.bipedLeftArm.rotateAngleX  -= f * 1.2F - f1 * 0.4F;
                this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
                this.bipedLeftArm.rotateAngleZ  -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
                this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
                this.bipedLeftArm.rotateAngleX  -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
            }
        }
コード例 #2
0
ファイル: SpawnerAnimals.cs プロジェクト: riverar/Crafty
 private static void func_21166_a(EntityLiving entityliving, World world, float f, float f1, float f2)
 {
     if ((entityliving is EntitySpider) && world.rand.nextInt(100) == 0)
     {
         var entityskeleton = new EntitySkeleton(world);
         entityskeleton.setLocationAndAngles(f, f1, f2, entityliving.rotationYaw, 0.0F);
         world.entityJoinedWorld(entityskeleton);
         entityskeleton.mountEntity(entityliving);
     }
     else if (entityliving is EntitySheep)
     {
         ((EntitySheep) entityliving).setFleeceColor(EntitySheep.func_21066_a(world.rand));
     }
 }