コード例 #1
0
 public override void OnUpdate()
 {
     base.OnUpdate();
     if (field_27018_b == 2)
     {
         worldObj.PlaySoundEffect(posX, posY, posZ, "ambient.weather.thunder", 10000F, 0.8F
                                  + rand.NextFloat() * 0.2F);
         worldObj.PlaySoundEffect(posX, posY, posZ, "random.explode", 2.0F, 0.5F + rand.NextFloat
                                      () * 0.2F);
     }
     field_27018_b--;
     if (field_27018_b < 0)
     {
         if (field_27020_c == 0)
         {
             SetEntityDead();
         }
         else
         {
             if (field_27018_b < -rand.Next(10))
             {
                 field_27020_c--;
                 field_27018_b = 1;
                 field_27019_a = rand.NextLong();
                 if (worldObj.DoChunksNearChunkExist(net.minecraft.src.MathHelper.Floor_double(posX
                                                                                               ), net.minecraft.src.MathHelper.Floor_double(posY), net.minecraft.src.MathHelper
                                                     .Floor_double(posZ), 10))
                 {
                     int i = net.minecraft.src.MathHelper.Floor_double(posX);
                     int j = net.minecraft.src.MathHelper.Floor_double(posY);
                     int k = net.minecraft.src.MathHelper.Floor_double(posZ);
                     if (worldObj.GetBlockId(i, j, k) == 0 && net.minecraft.src.Block.FIRE.CanPlaceBlockAt
                             (worldObj, i, j, k))
                     {
                         worldObj.SetBlockWithNotify(i, j, k, net.minecraft.src.Block.FIRE.ID);
                     }
                 }
             }
         }
     }
     if (field_27018_b >= 0)
     {
         double d = 3D;
         System.Collections.Generic.List <Entity> list = worldObj.GetEntitiesWithinAABBExcludingEntity(this
                                                                                                       , net.minecraft.src.AxisAlignedBB.GetBoundingBoxFromPool(posX - d, posY - d, posZ
                                                                                                                                                                - d, posX + d, posY + 6D + d, posZ + d));
         for (int l = 0; l < list.Count; l++)
         {
             net.minecraft.src.Entity entity = (net.minecraft.src.Entity)list[l];
             entity.OnStruckByLightning(this);
         }
         worldObj.field_27080_i = 2;
     }
 }