public void destroy(World world, int x, int y, int z) {
   tickcount++;
   int n = 8;
   int count = 32;
   double rx = x + 0.5 + rand.nextInt(2 * n + 1) - n;
   double ry = y + 0.5 + rand.nextInt(2 * n + 1) - n;
   double rz = z + 0.5 + rand.nextInt(2 * n + 1) - n;
   world.createExplosion(null, rx, ry, rz, 4F, tickcount > count);
   for (int i = 0; i < 32; i++)
     world.spawnParticle(
         "lava",
         rx + rand.nextInt(7) - 3,
         ry + rand.nextInt(7) - 3,
         rz + rand.nextInt(7) - 3,
         0,
         0,
         0);
   if (tickcount > count) {
     world.newExplosion(null, x + 0.5, y + 0.5, z + 0.5, 12F, true, true);
     ReikaWorldHelper.temperatureEnvironment(world, x, y, z, 1000);
   } /*
     EntityCreeper e = new EntityCreeper(world);
     e.posX = rx;
     e.posZ = rz;
     e.posY = world.getTopSolidOrLiquidBlock((int)rx, (int)rz)+1;
     e.addPotionEffect(new PotionEffect(Potion.resistance.id, 10, 10));
     world.spawnEntityInWorld(e);*/
 }
 public void onBlockDestroyedByExplosion(
     World worldIn, int par2, int par3, int par4, Explosion explosionIn) {
   if (!worldIn.isRemote
       && worldIn.getBlock(par2, par3, par4) instanceof IExplosive
       && worldIn.getBlock(par2, par3, par4) == mod_SecurityCraft.claymoreActive) {
     BlockUtils.destroyBlock(worldIn, par2, par3, par4, false);
     worldIn.createExplosion(
         (Entity) null,
         (double) par2 + 0.5F,
         (double) par3 + 0.5F,
         (double) par4 + 0.5F,
         3.5F,
         true);
   }
 }
 protected void onMeltdown(World world, int x, int y, int z) {
   MinecraftForge.EVENT_BUS.post(new ReactorMeltdownEvent(world, x, y, z));
   if (world.isRemote) return;
   int r = 2;
   for (int i = x - r; i <= x + r; i++) {
     for (int j = y - r; j <= y + r; j++) {
       for (int k = z - r; k <= z + r; k++) {
         ReactorTiles src = ReactorTiles.TEList[this.getIndex()];
         ReactorTiles other = ReactorTiles.getTE(world, i, j, k);
         if (src == other) world.setBlock(i, j, k, ReactorBlocks.CORIUMFLOWING.getBlockID());
       }
     }
   }
   world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 8, false);
   HydrogenExplosion ex = new HydrogenExplosion(world, null, x + 0.5, y + 0.5, z + 0.5, 7);
   ex.doExplosionA();
   ex.doExplosionB(false);
 }
  public boolean removedByPlayer(
      World world,
      EntityPlayer par2EntityPlayer,
      int par3,
      int par4,
      int par5,
      boolean willHarvest) {
    if (!world.isRemote && world.getBlock(par3, par4, par5) != mod_SecurityCraft.claymoreDefused) {
      BlockUtils.destroyBlock(world, par3, par4, par5, false);
      world.createExplosion(
          (Entity) null,
          (double) par3 + 0.5F,
          (double) par4 + 0.5F,
          (double) par5 + 0.5F,
          3.5F,
          true);
    }

    return super.removedByPlayer(world, par2EntityPlayer, par3, par4, par5, willHarvest);
  }
  protected void updateTemperature(World world, int x, int y, int z) {
    // ReikaJavaLibrary.pConsole(temperature, Side.SERVER);
    int Tamb = ReikaWorldHelper.getAmbientTemperatureAt(world, x, y, z);
    int dT = Tamb - temperature;
    if (dT != 0) {
      int d = ReikaWorldHelper.isExposedToAir(world, x, y, z) ? 32 : 64;
      int diff = (1 + dT / d);
      if (diff <= 1) diff = dT / Math.abs(dT);
      temperature += diff;
    }

    ReikaWorldHelper.temperatureEnvironment(world, x, y, z, Math.min(temperature, 1000));

    if (this instanceof TileEntityReactorBoiler && temperature >= 300 && Tamb > 100) {
      if (!((TileEntityReactorBoiler) this).tank.isEmpty()) {
        world.setBlockToAir(x, y, z);
        world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 3F, true);
      }
    }

    ReactorTiles src = this.getMachine();
    for (int i = 0; i < 6; i++) {
      ForgeDirection dir = dirs[i];
      int dx = x + dir.offsetX;
      int dy = y + dir.offsetY;
      int dz = z + dir.offsetZ;
      ReactorTiles r = ReactorTiles.getTE(world, dx, dy, dz);
      if (r != null) {
        TileEntityReactorBase te = (TileEntityReactorBase) world.getTileEntity(dx, dy, dz);
        if (te instanceof Temperatured) {
          int Tamb_loc = ReikaWorldHelper.getAmbientTemperatureAt(world, dx, dy, dz);

          Temperatured tr = (Temperatured) te;
          boolean flag = true; /*
					if (src == ReactorTiles.COOLANT) {
						TileEntityWaterCell wc = (TileEntityWaterCell)this;
						flag = tr.canDumpHeatInto(wc.getLiquidState());
					}*/
          if (tr instanceof TileEntityNuclearCore) flag = true;
          if (flag) {
            int T = tr.getTemperature();
            dT =
                (T - temperature)
                    - Math.max(
                        0,
                        (Tamb
                            - Tamb_loc)); // if Tamb here is > Tamb there, subtract that difference
            // to avoid exploits
            if (dT > 0) {
              int newT = T - dT / 4;
              // ReikaJavaLibrary.pConsole(temperature+":"+T+"
              // "+this.getTEName()+":"+te.getTEName()+"->"+(temperature+dT/4D)+":"+newT, this
              // instanceof TileEntityWaterCell &&
              // FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER);
              temperature += dT / 4;
              tr.setTemperature(newT);
            }
          }
        }
        if (r == ReactorTiles.CO2HEATER || r == ReactorTiles.PEBBLEBED) {
          if (src.getReactorType() != ReactorType.HTGR && temperature > Tamb) {
            temperature -= Math.max(1, (temperature - Tamb) / 2);
          }
        }
      }
    }
  }
 public void explode(World world, int par2, int par3, int par4) {
   if (!world.isRemote) {
     BlockUtils.destroyBlock(world, par2, par3, par4, false);
     world.createExplosion((Entity) null, (double) par2, (double) par3, (double) par4, 3.5F, true);
   }
 }
Example #7
0
  @Override
  public int onBlockPlaced(
      World world,
      int int1,
      int int2,
      int int3,
      int int4,
      float float1,
      float float2,
      float float3,
      int int5) {
    if (this == ModBlocks.blockTrytementium) {
      world.createExplosion(null, int1, int2, int3, 10.0F, false);
      for (int i = -9; i <= 9; i++) {
        for (int j = -8; j <= 8; j++) {
          for (int k = -8; k <= 8; k++) {
            Block block = world.getBlock(int1 + i, int2 + j, int3 + k);
            Random rand = new Random();
            int isInfested = rand.nextInt(5);
            int isRemoved = rand.nextInt(2);
            if (block == Blocks.grass
                || block == Blocks.dirt
                || block == ModBlocks.fluxInfestedSoil) {
              if (ConfigurationHandler.trytementiumBoom) {
                block.removedByPlayer(world, null, int1 + i, int2 + j, int3 + k, true);
              }
              if (isInfested <= 1) {
                world.setBlock(int1 + i, int2 + j, int3 + k, ModBlocks.fluxInfestedSoil);
              }
            } else if (block.getBlockHardness(world, int1 + i, int2 + j, int3 + k) != -1
                && ConfigurationHandler.trytementiumBoom) {
              if (isRemoved <= 1 && ConfigurationHandler.trytementiumBoom) {
                block.removedByPlayer(world, null, int1 + i, int2 + j, int3 + k, true);
              }
            }
          }
        }
      }
      for (int i = -8; i <= 8; i++) {
        for (int j = -9; j <= 9; j++) {
          for (int k = -8; k <= 8; k++) {
            Block block = world.getBlock(int1 + i, int2 + j, int3 + k);
            Random rand = new Random();
            int isInfested = rand.nextInt(5);
            int isRemoved = rand.nextInt(2);
            if (block == Blocks.grass
                || block == Blocks.dirt
                || block == ModBlocks.fluxInfestedSoil) {
              if (ConfigurationHandler.trytementiumBoom) {
                block.removedByPlayer(world, null, int1 + i, int2 + j, int3 + k, true);
              }
              if (isInfested <= 1) {
                world.setBlock(int1 + i, int2 + j, int3 + k, ModBlocks.fluxInfestedSoil);
              }
            } else if (block.getBlockHardness(world, int1 + i, int2 + j, int3 + k) != -1
                && ConfigurationHandler.trytementiumBoom) {
              if (isRemoved <= 1 && ConfigurationHandler.trytementiumBoom) {
                block.removedByPlayer(world, null, int1 + i, int2 + j, int3 + k, true);
              }
            }
          }
        }
      }
      for (int i = -8; i <= 8; i++) {
        for (int j = -8; j <= 8; j++) {
          for (int k = -9; k <= 9; k++) {
            Block block = world.getBlock(int1 + i, int2 + j, int3 + k);
            Random rand = new Random();
            int isInfested = rand.nextInt(5);
            int isRemoved = rand.nextInt(2);
            if (block == Blocks.grass
                || block == Blocks.dirt
                || block == ModBlocks.fluxInfestedSoil) {
              block.removedByPlayer(world, null, int1 + i, int2 + j, int3 + k, true);
              if (ConfigurationHandler.trytementiumBoom) {
                block.removedByPlayer(world, null, int1 + i, int2 + j, int3 + k, true);
              }
              if (isInfested <= 1) {
                world.setBlock(int1 + i, int2 + j, int3 + k, ModBlocks.fluxInfestedSoil);
              }

            } else if (block.getBlockHardness(world, int1 + i, int2 + j, int3 + k) != -1
                && ConfigurationHandler.trytementiumBoom) {
              if (isRemoved <= 1 && ConfigurationHandler.trytementiumBoom) {
                block.removedByPlayer(world, null, int1 + i, int2 + j, int3 + k, true);
              }
            }
          }
        }
      }
      world.scheduleBlockUpdate(int1, int2, int3, this, 1);
    }
    return int5;
  }
 public void explode(World world, int x, int y, int z) {
   if (fuse == 80) {
     world.createExplosion((Entity) null, x, y, z, 10, true);
   }
 }