public virtual void DoRenderArrow(EntityArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
        {
            LoadTexture("/item/arrows.png");
            //GL.PushMatrix();
            //GL.Translate((float)par2, (float)par4, (float)par6);
            //GL.Rotate((par1EntityArrow.PrevRotationYaw + (par1EntityArrow.RotationYaw - par1EntityArrow.PrevRotationYaw) * par9) - 90F, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(par1EntityArrow.PrevRotationPitch + (par1EntityArrow.RotationPitch - par1EntityArrow.PrevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
            Tessellator tessellator = Tessellator.Instance;
            int         i           = 0;
            float       f           = 0.0F;
            float       f1          = 0.5F;
            float       f2          = (float)(0 + i * 10) / 32F;
            float       f3          = (float)(5 + i * 10) / 32F;
            float       f4          = 0.0F;
            float       f5          = 0.15625F;
            float       f6          = (float)(5 + i * 10) / 32F;
            float       f7          = (float)(10 + i * 10) / 32F;
            float       f8          = 0.05625F;
            //GL.Enable(EnableCap.RescaleNormal);
            float f9 = (float)par1EntityArrow.ArrowShake - par9;

            if (f9 > 0.0F)
            {
                float f10 = -MathHelper2.Sin(f9 * 3F) * f9;
                //GL.Rotate(f10, 0.0F, 0.0F, 1.0F);
            }

            //GL.Rotate(45F, 1.0F, 0.0F, 0.0F);
            //GL.Scale(f8, f8, f8);
            //GL.Translate(-4F, 0.0F, 0.0F);
            //GL.Normal3(f8, 0.0F, 0.0F);
            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(-7D, -2D, -2D, f4, f6);
            tessellator.AddVertexWithUV(-7D, -2D, 2D, f5, f6);
            tessellator.AddVertexWithUV(-7D, 2D, 2D, f5, f7);
            tessellator.AddVertexWithUV(-7D, 2D, -2D, f4, f7);
            tessellator.Draw();
            //GL.Normal3(-f8, 0.0F, 0.0F);
            tessellator.StartDrawingQuads();
            tessellator.AddVertexWithUV(-7D, 2D, -2D, f4, f6);
            tessellator.AddVertexWithUV(-7D, 2D, 2D, f5, f6);
            tessellator.AddVertexWithUV(-7D, -2D, 2D, f5, f7);
            tessellator.AddVertexWithUV(-7D, -2D, -2D, f4, f7);
            tessellator.Draw();

            for (int j = 0; j < 4; j++)
            {
                //GL.Rotate(90F, 1.0F, 0.0F, 0.0F);
                //GL.Normal3(0.0F, 0.0F, f8);
                tessellator.StartDrawingQuads();
                tessellator.AddVertexWithUV(-8D, -2D, 0.0F, f, f2);
                tessellator.AddVertexWithUV(8D, -2D, 0.0F, f1, f2);
                tessellator.AddVertexWithUV(8D, 2D, 0.0F, f1, f3);
                tessellator.AddVertexWithUV(-8D, 2D, 0.0F, f, f3);
                tessellator.Draw();
            }

            //GL.Disable(EnableCap.RescaleNormal);
            //GL.PopMatrix();
        }
 /// <summary>
 /// Performs a ranged attack according to the AI's rangedAttackID.
 /// </summary>
 private void DoRangedAttack()
 {
     if (RangedAttackID == 1)
     {
         EntityArrow entityarrow = new EntityArrow(WorldObj, EntityHost, AttackTarget, 1.6F, 12F);
         WorldObj.PlaySoundAtEntity(EntityHost, "random.bow", 1.0F, 1.0F / (EntityHost.GetRNG().NextFloat() * 0.4F + 0.8F));
         WorldObj.SpawnEntityInWorld(entityarrow);
     }
     else if (RangedAttackID == 2)
     {
         EntitySnowball entitysnowball = new EntitySnowball(WorldObj, EntityHost);
         float          d  = AttackTarget.PosX - EntityHost.PosX;
         float          d1 = (AttackTarget.PosY + AttackTarget.GetEyeHeight()) - 1.1000000238418579F - entitysnowball.PosY;
         float          d2 = AttackTarget.PosZ - EntityHost.PosZ;
         float          f  = MathHelper2.Sqrt_double(d * d + d2 * d2) * 0.2F;
         entitysnowball.SetThrowableHeading(d, d1 + f, d2, 1.6F, 12F);
         WorldObj.PlaySoundAtEntity(EntityHost, "random.bow", 1.0F, 1.0F / (EntityHost.GetRNG().NextFloat() * 0.4F + 0.8F));
         WorldObj.SpawnEntityInWorld(entitysnowball);
     }
 }
        public override void HandleVehicleSpawn(Packet23VehicleSpawn par1Packet23VehicleSpawn)
        {
            float  d   = par1Packet23VehicleSpawn.XPosition / 3F;
            float  d1  = par1Packet23VehicleSpawn.YPosition / 3F;
            float  d2  = par1Packet23VehicleSpawn.ZPosition / 3F;
            Entity obj = null;

            if (par1Packet23VehicleSpawn.Type == 10)
            {
                obj = new EntityMinecart(WorldClient, d, d1, d2, 0);
            }
            else if (par1Packet23VehicleSpawn.Type == 11)
            {
                obj = new EntityMinecart(WorldClient, d, d1, d2, 1);
            }
            else if (par1Packet23VehicleSpawn.Type == 12)
            {
                obj = new EntityMinecart(WorldClient, d, d1, d2, 2);
            }
            else if (par1Packet23VehicleSpawn.Type == 90)
            {
                obj = new EntityFishHook(WorldClient, d, d1, d2);
            }
            else if (par1Packet23VehicleSpawn.Type == 60)
            {
                obj = new EntityArrow(WorldClient, d, d1, d2);
            }
            else if (par1Packet23VehicleSpawn.Type == 61)
            {
                obj = new EntitySnowball(WorldClient, d, d1, d2);
            }
            else if (par1Packet23VehicleSpawn.Type == 65)
            {
                obj = new EntityEnderPearl(WorldClient, d, d1, d2);
            }
            else if (par1Packet23VehicleSpawn.Type == 72)
            {
                obj = new EntityEnderEye(WorldClient, d, d1, d2);
            }
            else if (par1Packet23VehicleSpawn.Type == 63)
            {
                obj = new EntityFireball(WorldClient, d, d1, d2, par1Packet23VehicleSpawn.SpeedX / 8000F, par1Packet23VehicleSpawn.SpeedY / 8000F, par1Packet23VehicleSpawn.SpeedZ / 8000F);
                par1Packet23VehicleSpawn.ThrowerEntityId = 0;
            }
            else if (par1Packet23VehicleSpawn.Type == 64)
            {
                obj = new EntitySmallFireball(WorldClient, d, d1, d2, par1Packet23VehicleSpawn.SpeedX / 8000F, par1Packet23VehicleSpawn.SpeedY / 8000F, par1Packet23VehicleSpawn.SpeedZ / 8000F);
                par1Packet23VehicleSpawn.ThrowerEntityId = 0;
            }
            else if (par1Packet23VehicleSpawn.Type == 62)
            {
                obj = new EntityEgg(WorldClient, d, d1, d2);
            }
            else if (par1Packet23VehicleSpawn.Type == 73)
            {
                obj = new EntityPotion(WorldClient, d, d1, d2, par1Packet23VehicleSpawn.ThrowerEntityId);
                par1Packet23VehicleSpawn.ThrowerEntityId = 0;
            }
            else if (par1Packet23VehicleSpawn.Type == 75)
            {
                obj = new EntityExpBottle(WorldClient, d, d1, d2);
                par1Packet23VehicleSpawn.ThrowerEntityId = 0;
            }
            else if (par1Packet23VehicleSpawn.Type == 1)
            {
                obj = new EntityBoat(WorldClient, d, d1, d2);
            }
            else if (par1Packet23VehicleSpawn.Type == 50)
            {
                obj = new EntityTNTPrimed(WorldClient, d, d1, d2);
            }
            else if (par1Packet23VehicleSpawn.Type == 51)
            {
                obj = new EntityEnderCrystal(WorldClient, d, d1, d2);
            }
            else if (par1Packet23VehicleSpawn.Type == 70)
            {
                obj = new EntityFallingSand(WorldClient, d, d1, d2, Block.Sand.BlockID);
            }
            else if (par1Packet23VehicleSpawn.Type == 71)
            {
                obj = new EntityFallingSand(WorldClient, d, d1, d2, Block.Gravel.BlockID);
            }
            else if (par1Packet23VehicleSpawn.Type == 74)
            {
                obj = new EntityFallingSand(WorldClient, d, d1, d2, Block.DragonEgg.BlockID);
            }

            if (obj != null)
            {
                obj.ServerPosX    = par1Packet23VehicleSpawn.XPosition;
                obj.ServerPosY    = par1Packet23VehicleSpawn.YPosition;
                obj.ServerPosZ    = par1Packet23VehicleSpawn.ZPosition;
                obj.RotationYaw   = 0.0F;
                obj.RotationPitch = 0.0F;
                Entity[] aentity = ((Entity)(obj)).GetParts();

                if (aentity != null)
                {
                    int i = par1Packet23VehicleSpawn.EntityId - ((Entity)(obj)).EntityId;

                    for (int j = 0; j < aentity.Length; j++)
                    {
                        aentity[j].EntityId += i;
                    }
                }

                obj.EntityId = par1Packet23VehicleSpawn.EntityId;
                WorldClient.AddEntityToWorld(par1Packet23VehicleSpawn.EntityId, ((Entity)(obj)));

                if (par1Packet23VehicleSpawn.ThrowerEntityId > 0)
                {
                    if (par1Packet23VehicleSpawn.Type == 60)
                    {
                        Entity entity = GetEntityByID(par1Packet23VehicleSpawn.ThrowerEntityId);

                        if (entity is EntityLiving)
                        {
                            ((EntityArrow)obj).ShootingEntity = (EntityLiving)entity;
                        }
                    }

                    ((Entity)(obj)).SetVelocity(par1Packet23VehicleSpawn.SpeedX / 8000F, par1Packet23VehicleSpawn.SpeedY / 8000F, par1Packet23VehicleSpawn.SpeedZ / 8000F);
                }
            }
        }
        /// <summary>
        /// dispenses an item from a randomly selected item stack from the blocks inventory into the game world.
        /// </summary>
        private void DispenseItem(World par1World, int par2, int par3, int par4, Random par5Random)
        {
            int i = par1World.GetBlockMetadata(par2, par3, par4);
            int j = 0;
            int k = 0;

            if (i == 3)
            {
                k = 1;
            }
            else if (i == 2)
            {
                k = -1;
            }
            else if (i == 5)
            {
                j = 1;
            }
            else
            {
                j = -1;
            }

            TileEntityDispenser tileentitydispenser = (TileEntityDispenser)par1World.GetBlockTileEntity(par2, par3, par4);

            if (tileentitydispenser != null)
            {
                ItemStack itemstack = tileentitydispenser.GetRandomStackFromInventory();
                float     d         = par2 + j * 0.59999999999999998F + 0.5F;
                float     d1        = par3 + 0.5F;
                float     d2        = par4 + k * 0.59999999999999998F + 0.5F;

                if (itemstack == null)
                {
                    par1World.PlayAuxSFX(1001, par2, par3, par4, 0);
                }
                else
                {
                    if (itemstack.ItemID == Item.Arrow.ShiftedIndex)
                    {
                        EntityArrow entityarrow = new EntityArrow(par1World, d, d1, d2);
                        entityarrow.SetArrowHeading(j, 0.10000000149011612F, k, 1.1F, 6F);
                        entityarrow.DoesArrowBelongToPlayer = true;
                        par1World.SpawnEntityInWorld(entityarrow);
                        par1World.PlayAuxSFX(1002, par2, par3, par4, 0);
                    }
                    else if (itemstack.ItemID == Item.Egg.ShiftedIndex)
                    {
                        EntityEgg entityegg = new EntityEgg(par1World, d, d1, d2);
                        entityegg.SetThrowableHeading(j, 0.10000000149011612F, k, 1.1F, 6F);
                        par1World.SpawnEntityInWorld(entityegg);
                        par1World.PlayAuxSFX(1002, par2, par3, par4, 0);
                    }
                    else if (itemstack.ItemID == Item.Snowball.ShiftedIndex)
                    {
                        EntitySnowball entitysnowball = new EntitySnowball(par1World, d, d1, d2);
                        entitysnowball.SetThrowableHeading(j, 0.10000000149011612F, k, 1.1F, 6F);
                        par1World.SpawnEntityInWorld(entitysnowball);
                        par1World.PlayAuxSFX(1002, par2, par3, par4, 0);
                    }
                    else if (itemstack.ItemID == Item.Potion.ShiftedIndex && ItemPotion.IsSplash(itemstack.GetItemDamage()))
                    {
                        EntityPotion entitypotion = new EntityPotion(par1World, d, d1, d2, itemstack.GetItemDamage());
                        entitypotion.SetThrowableHeading(j, 0.10000000149011612F, k, 1.375F, 3F);
                        par1World.SpawnEntityInWorld(entitypotion);
                        par1World.PlayAuxSFX(1002, par2, par3, par4, 0);
                    }
                    else if (itemstack.ItemID == Item.ExpBottle.ShiftedIndex)
                    {
                        EntityExpBottle entityexpbottle = new EntityExpBottle(par1World, d, d1, d2);
                        entityexpbottle.SetThrowableHeading(j, 0.10000000149011612F, k, 1.375F, 3F);
                        par1World.SpawnEntityInWorld(entityexpbottle);
                        par1World.PlayAuxSFX(1002, par2, par3, par4, 0);
                    }
                    else if (itemstack.ItemID == Item.MonsterPlacer.ShiftedIndex)
                    {
                        ItemMonsterPlacer.Func_48440_a(par1World, itemstack.GetItemDamage(), d + j * 0.29999999999999999F, d1 - 0.29999999999999999F, d2 + k * 0.29999999999999999F);
                        par1World.PlayAuxSFX(1002, par2, par3, par4, 0);
                    }
                    else if (itemstack.ItemID == Item.FireballCharge.ShiftedIndex)
                    {
                        EntitySmallFireball entitysmallfireball = new EntitySmallFireball(par1World, d + j * 0.29999999999999999F, d1, d2 + k * 0.29999999999999999F, j + par5Random.NextGaussian() * 0.050000000000000003F, par5Random.NextGaussian() * 0.050000000000000003F, k + par5Random.NextGaussian() * 0.050000000000000003F);
                        par1World.SpawnEntityInWorld(entitysmallfireball);
                        par1World.PlayAuxSFX(1009, par2, par3, par4, 0);
                    }
                    else
                    {
                        EntityItem entityitem = new EntityItem(par1World, d, d1 - 0.29999999999999999F, d2, itemstack);
                        float      d3         = par5Random.NextFloat() * 0.10000000000000001F + 0.20000000000000001F;
                        entityitem.MotionX  = j * d3;
                        entityitem.MotionY  = 0.20000000298023224F;
                        entityitem.MotionZ  = k * d3;
                        entityitem.MotionX += par5Random.NextGaussian() * 0.0074999998323619366F * 6;
                        entityitem.MotionY += par5Random.NextGaussian() * 0.0074999998323619366F * 6;
                        entityitem.MotionZ += par5Random.NextGaussian() * 0.0074999998323619366F * 6;
                        par1World.SpawnEntityInWorld(entityitem);
                        par1World.PlayAuxSFX(1000, par2, par3, par4, 0);
                    }

                    par1World.PlayAuxSFX(2000, par2, par3, par4, j + 1 + (k + 1) * 3);
                }
            }
        }