Ejemplo n.º 1
0
 public Packet26EntityExpOrb(EntityXPOrb par1EntityXPOrb)
 {
     EntityId = par1EntityXPOrb.EntityId;
     PosX     = MathHelper2.Floor_double(par1EntityXPOrb.PosX * 32D);
     PosY     = MathHelper2.Floor_double(par1EntityXPOrb.PosY * 32D);
     PosZ     = MathHelper2.Floor_double(par1EntityXPOrb.PosZ * 32D);
     XpValue  = par1EntityXPOrb.GetXpValue();
 }
        /// <summary>
        /// Handle a entity experience orb packet.
        /// </summary>
        public override void HandleEntityExpOrb(Packet26EntityExpOrb par1Packet26EntityExpOrb)
        {
            EntityXPOrb entityxporb = new EntityXPOrb(WorldClient, par1Packet26EntityExpOrb.PosX, par1Packet26EntityExpOrb.PosY, par1Packet26EntityExpOrb.PosZ, par1Packet26EntityExpOrb.XpValue);

            entityxporb.ServerPosX    = par1Packet26EntityExpOrb.PosX;
            entityxporb.ServerPosY    = par1Packet26EntityExpOrb.PosY;
            entityxporb.ServerPosZ    = par1Packet26EntityExpOrb.PosZ;
            entityxporb.RotationYaw   = 0.0F;
            entityxporb.RotationPitch = 0.0F;
            entityxporb.EntityId      = par1Packet26EntityExpOrb.EntityId;
            WorldClient.AddEntityToWorld(par1Packet26EntityExpOrb.EntityId, entityxporb);
        }
        /// <summary>
        /// Called when the throwable hits a block or entity.
        /// </summary>
        protected override void OnImpact(MovingObjectPosition par1MovingObjectPosition)
        {
            if (!WorldObj.IsRemote)
            {
                WorldObj.PlayAuxSFX(2002, (int)Math.Round(PosX), (int)Math.Round(PosY), (int)Math.Round(PosZ), 0);

                for (int i = 3 + WorldObj.Rand.Next(5) + WorldObj.Rand.Next(5); i > 0;)
                {
                    int j = EntityXPOrb.GetXPSplit(i);
                    i -= j;
                    WorldObj.SpawnEntityInWorld(new EntityXPOrb(WorldObj, PosX, PosY, PosZ, j));
                }

                SetDead();
            }
        }
        public virtual void Func_35438_a(EntityXPOrb par1EntityXPOrb, double par2, double par4, double par6, float par8, float par9)
        {
            //GL.PushMatrix();
            //GL.Translate((float)par2, (float)par4, (float)par6);
            int i = par1EntityXPOrb.GetTextureByXP();

            LoadTexture("/item/xporb.png");
            Tessellator tessellator = Tessellator.Instance;
            float       f           = (float)((i % 4) * 16 + 0) / 64F;
            float       f1          = (float)((i % 4) * 16 + 16) / 64F;
            float       f2          = (float)((i / 4) * 16 + 0) / 64F;
            float       f3          = (float)((i / 4) * 16 + 16) / 64F;
            float       f4          = 1.0F;
            float       f5          = 0.5F;
            float       f6          = 0.25F;
            int         i7          = par1EntityXPOrb.GetBrightnessForRender(par9);
            float       f8          = i7 % 0x10000;
            int         j           = i7 / 0x10000;

            OpenGlHelper.SetLightmapTextureCoords(OpenGlHelper.LightmapTexUnit, (float)f8 / 1.0F, (float)j / 1.0F);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            float f7 = 255F;

            f8 = ((float)par1EntityXPOrb.XpColor + par9) / 2.0F;
            j  = (int)((MathHelper2.Sin(f8 + 0.0F) + 1.0F) * 0.5F * f7);
            int k  = (int)f7;
            int l  = (int)((MathHelper2.Sin(f8 + 4.18879F) + 1.0F) * 0.1F * f7);
            int i1 = j << 16 | k << 8 | l;
            //GL.Rotate(180F - RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(-RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F);
            float f9 = 0.3F;

            //GL.Scale(f9, f9, f9);
            tessellator.StartDrawingQuads();
            tessellator.SetColorRGBA_I(i1, 128);
            tessellator.SetNormal(0.0F, 1.0F, 0.0F);
            tessellator.AddVertexWithUV(0.0F - f5, 0.0F - f6, 0.0F, f, f3);
            tessellator.AddVertexWithUV(f4 - f5, 0.0F - f6, 0.0F, f1, f3);
            tessellator.AddVertexWithUV(f4 - f5, 1.0F - f6, 0.0F, f1, f2);
            tessellator.AddVertexWithUV(0.0F - f5, 1.0F - f6, 0.0F, f, f2);
            tessellator.Draw();
            //GL.Disable(EnableCap.Blend);
            //GL.Disable(EnableCap.RescaleNormal);
            //GL.PopMatrix();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// handles entity death timer, experience orb and particle creation
        /// </summary>
        protected override void OnDeathUpdate()
        {
            Field_40178_aA++;

            if (Field_40178_aA >= 180 && Field_40178_aA <= 200)
            {
                float f  = (Rand.NextFloat() - 0.5F) * 8F;
                float f1 = (Rand.NextFloat() - 0.5F) * 4F;
                float f2 = (Rand.NextFloat() - 0.5F) * 8F;
                WorldObj.SpawnParticle("hugeexplosion", PosX + (double)f, PosY + 2D + (double)f1, PosZ + (double)f2, 0.0F, 0.0F, 0.0F);
            }

            if (!WorldObj.IsRemote && Field_40178_aA > 150 && Field_40178_aA % 5 == 0)
            {
                for (int i = 1000; i > 0;)
                {
                    int k = EntityXPOrb.GetXPSplit(i);
                    i -= k;
                    WorldObj.SpawnEntityInWorld(new EntityXPOrb(WorldObj, PosX, PosY, PosZ, k));
                }
            }

            MoveEntity(0.0F, 0.10000000149011612F, 0.0F);
            RenderYawOffset = RotationYaw += 20F;

            if (Field_40178_aA == 200)
            {
                for (int j = 10000; j > 0;)
                {
                    int l = EntityXPOrb.GetXPSplit(j);
                    j -= l;
                    WorldObj.SpawnEntityInWorld(new EntityXPOrb(WorldObj, PosX, PosY, PosZ, l));
                }

                CreateEnderPortal(MathHelper2.Floor_double(PosX), MathHelper2.Floor_double(PosZ));
                OnEntityDeath();
                SetDead();
            }
        }