예제 #1
0
 public EntityArrow(net.minecraft.src.World world, net.minecraft.src.EntityLiving
                    entityliving)
     : base(world)
 {
     xTile         = -1;
     yTile         = -1;
     zTile         = -1;
     inTile        = 0;
     field_28011_h = 0;
     inGround      = false;
     field_28012_a = false;
     arrowShake    = 0;
     ticksInAir    = 0;
     owner         = entityliving;
     field_28012_a = entityliving is net.minecraft.src.EntityPlayer;
     SetSize(0.5F, 0.5F);
     SetLocationAndAngles(entityliving.posX, entityliving.posY + (double)entityliving.
                          GetEyeHeight(), entityliving.posZ, entityliving.rotationYaw, entityliving.rotationPitch
                          );
     posX -= net.minecraft.src.MathHelper.Cos((rotationYaw / 180F) * 3.141593F) * 0.16F;
     posY -= 0.10000000149011612D;
     posZ -= net.minecraft.src.MathHelper.Sin((rotationYaw / 180F) * 3.141593F) * 0.16F;
     SetPosition(posX, posY, posZ);
     yOffset = 0.0F;
     motionX = -net.minecraft.src.MathHelper.Sin((rotationYaw / 180F) * 3.141593F) * net.minecraft.src.MathHelper
               .Cos((rotationPitch / 180F) * 3.141593F);
     motionZ = net.minecraft.src.MathHelper.Cos((rotationYaw / 180F) * 3.141593F) * net.minecraft.src.MathHelper
               .Cos((rotationPitch / 180F) * 3.141593F);
     motionY = -net.minecraft.src.MathHelper.Sin((rotationPitch / 180F) * 3.141593F);
     SetArrowHeading(motionX, motionY, motionZ, 1.5F, 1.0F);
 }
예제 #2
0
        public EntitySnowball(net.minecraft.src.World world, net.minecraft.src.EntityLiving
                              entityliving)
            : base(world)
        {
            xTileSnowball    = -1;
            yTileSnowball    = -1;
            zTileSnowball    = -1;
            inTileSnowball   = 0;
            inGroundSnowball = false;
            shakeSnowball    = 0;
            ticksInAir       = 0;
            owner            = entityliving;
            SetSize(0.25F, 0.25F);
            SetLocationAndAngles(entityliving.posX, entityliving.posY + (double)entityliving.
                                 GetEyeHeight(), entityliving.posZ, entityliving.rotationYaw, entityliving.rotationPitch
                                 );
            posX -= net.minecraft.src.MathHelper.Cos((rotationYaw / 180F) * 3.141593F) * 0.16F;
            posY -= 0.10000000149011612D;
            posZ -= net.minecraft.src.MathHelper.Sin((rotationYaw / 180F) * 3.141593F) * 0.16F;
            SetPosition(posX, posY, posZ);
            yOffset = 0.0F;
            float f = 0.4F;

            motionX = -net.minecraft.src.MathHelper.Sin((rotationYaw / 180F) * 3.141593F) * net.minecraft.src.MathHelper
                      .Cos((rotationPitch / 180F) * 3.141593F) * f;
            motionZ = net.minecraft.src.MathHelper.Cos((rotationYaw / 180F) * 3.141593F) * net.minecraft.src.MathHelper
                      .Cos((rotationPitch / 180F) * 3.141593F) * f;
            motionY = -net.minecraft.src.MathHelper.Sin((rotationPitch / 180F) * 3.141593F) *
                      f;
            SetSnowballHeading(motionX, motionY, motionZ, 1.5F, 1.0F);
        }
예제 #3
0
        public virtual void FaceEntity(net.minecraft.src.Entity entity, float f, float f1
                                       )
        {
            double d  = entity.posX - posX;
            double d2 = entity.posZ - posZ;
            double d1;

            if (entity is net.minecraft.src.EntityLiving)
            {
                net.minecraft.src.EntityLiving entityliving = (net.minecraft.src.EntityLiving)entity;
                d1 = (posY + (double)GetEyeHeight()) - (entityliving.posY + (double)entityliving.
                                                        GetEyeHeight());
            }
            else
            {
                d1 = (entity.boundingBox.minY + entity.boundingBox.maxY) / 2D - (posY + (double)GetEyeHeight
                                                                                     ());
            }
            double d3 = net.minecraft.src.MathHelper.Sqrt_double(d * d + d2 * d2);
            float  f2 = (float)((System.Math.Atan2(d2, d) * 180D) / 3.1415927410125732D) - 90F;
            float  f3 = (float)(-((System.Math.Atan2(d1, d3) * 180D) / 3.1415927410125732D));

            rotationPitch = -UpdateRotation(rotationPitch, f3, f1);
            rotationYaw   = UpdateRotation(rotationYaw, f2, f);
        }