コード例 #1
0
        /// <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();
            }
        }
コード例 #2
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();
            }
        }