private void tryToCatchBlockOnFire( World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, ForgeDirection face) { int j1 = 0; Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)]; if (block != null) { j1 = block.getFlammability( par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face); } if (par6Random.nextInt(par5) < j1) { boolean flag = par1World.getBlockId(par2, par3, par4) == Block.tnt.blockID; if ((par6Random.nextInt(par7 + 10) < 5) && (!par1World.canLightningStrikeAt(par2, par3, par4))) { int k1 = par7 + par6Random.nextInt(5) / 4; if (k1 > 15) { k1 = 15; } par1World.setBlock(par2, par3, par4, this.blockID, k1, 3); } else { par1World.setBlockToAir(par2, par3, par4); } if (flag) { Block.tnt.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); } } }
@Override public void randomDisplayTick(World world, int x, int y, int z, Random random) { if ((world.canLightningStrikeAt(x, y + 1, z)) && (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z)) && (random.nextInt(15) == 1)) { double d0 = x + random.nextFloat(); double d1 = y - 0.05D; double d2 = z + random.nextFloat(); world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D); } super.randomDisplayTick(world, x, y, z, random); }
@Override @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random random) { if (world.canLightningStrikeAt(x, y + 1, z) && !world.doesBlockHaveSolidTopSurface(x, y - 1, z) && random.nextInt(15) == 1) { double d0 = x + random.nextFloat(); double d1 = y - 0.05D; double d2 = z + random.nextFloat(); world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D); } }
@SideOnly(Side.CLIENT) /** A randomly called display update to be able to add particles or other items for display */ public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) { double d0 = (double) ((float) par2 + par5Random.nextFloat()); double d1 = (double) par3 - 0.05D; double d2 = (double) ((float) par4 + par5Random.nextFloat()); par1World.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D); } }
@SideOnly(Side.CLIENT) /** A randomly called display update to be able to add particles or other items for display */ public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { if (var1.canLightningStrikeAt(var2, var3 + 1, var4) && !var1.doesBlockHaveSolidTopSurface(var2, var3 - 1, var4) && var5.nextInt(15) == 1) { double var6 = (double) ((float) var2 + var5.nextFloat()); double var8 = (double) var3 - 0.05D; double var10 = (double) ((float) var4 + var5.nextFloat()); var1.spawnParticle("dripWater", var6, var8, var10, 0.0D, 0.0D, 0.0D); } }
/** Ticks the block if it's been scheduled */ public void updateTick( World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { if (!this.func_149821_m(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_) && !p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_ + 1, p_149674_4_)) { int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_); if (l > 0) { p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l - 1, 2); } else if (!this.func_149822_e(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_)) { p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, TcBlocks.tofuMomen); } } else { p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, 7, 2); } }
private void tryToCatchBlockOnFire( World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7) { int i = abilityToCatchFire[par1World.getBlockId(par2, par3, par4)]; if (par6Random.nextInt(par5) < i) { boolean flag = par1World.getBlockId(par2, par3, par4) == Block.tnt.blockID; if (par6Random.nextInt(par7 + 10) < 5 && !par1World.canLightningStrikeAt(par2, par3, par4)) { int j = par7 + par6Random.nextInt(5) / 4; if (j > 15) { j = 15; } par1World.setBlockAndMetadataWithNotify(par2, par3, par4, blockID, j); } else { par1World.setBlockWithNotify(par2, par3, par4, 0); } if (flag) { Block.tnt.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); } } }
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick")) { Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)]; boolean flag = (base != null) && (base.isFireSource( par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), ForgeDirection.UP)); if (!canPlaceBlockAt(par1World, par2, par3, par4)) { par1World.setBlockToAir(par2, par3, par4); } if ((!flag) && (par1World.isRaining()) && ((par1World.canLightningStrikeAt(par2, par3, par4)) || (par1World.canLightningStrikeAt(par2 - 1, par3, par4)) || (par1World.canLightningStrikeAt(par2 + 1, par3, par4)) || (par1World.canLightningStrikeAt(par2, par3, par4 - 1)) || (par1World.canLightningStrikeAt(par2, par3, par4 + 1)))) { par1World.setBlockToAir(par2, par3, par4); } else { int l = par1World.getBlockMetadata(par2, par3, par4); if (l < 15) { par1World.setBlockMetadataWithNotify(par2, par3, par4, l + par5Random.nextInt(3) / 2, 4); } par1World.scheduleBlockUpdate( par2, par3, par4, this.blockID, tickRate(par1World) + par5Random.nextInt(10)); if ((!flag) && (!canNeighborBurn(par1World, par2, par3, par4))) { if ((!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) || (l > 3)) { par1World.setBlockToAir(par2, par3, par4); } } else if ((!flag) && (!canBlockCatchFire(par1World, par2, par3 - 1, par4, ForgeDirection.UP)) && (l == 15) && (par5Random.nextInt(4) == 0)) { par1World.setBlockToAir(par2, par3, par4); } else { boolean flag1 = par1World.isBlockHighHumidity(par2, par3, par4); byte b0 = 0; if (flag1) { b0 = -50; } tryToCatchBlockOnFire( par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l, ForgeDirection.WEST); tryToCatchBlockOnFire( par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l, ForgeDirection.EAST); tryToCatchBlockOnFire( par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l, ForgeDirection.UP); tryToCatchBlockOnFire( par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l, ForgeDirection.DOWN); tryToCatchBlockOnFire( par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l, ForgeDirection.SOUTH); tryToCatchBlockOnFire( par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l, ForgeDirection.NORTH); for (int i1 = par2 - 1; i1 <= par2 + 1; i1++) { for (int j1 = par4 - 1; j1 <= par4 + 1; j1++) { for (int k1 = par3 - 1; k1 <= par3 + 4; k1++) { if ((i1 != par2) || (k1 != par3) || (j1 != par4)) { int l1 = 100; if (k1 > par3 + 1) { l1 += (k1 - (par3 + 1)) * 100; } int i2 = getChanceOfNeighborsEncouragingFire(par1World, i1, k1, j1); if (i2 > 0) { int j2 = (i2 + 40 + par1World.difficultySetting * 7) / (l + 30); if (flag1) { j2 /= 2; } if ((j2 > 0) && (par5Random.nextInt(l1) <= j2) && ((!par1World.isRaining()) || (!par1World.canLightningStrikeAt(i1, k1, j1))) && (!par1World.canLightningStrikeAt(i1 - 1, k1, par4)) && (!par1World.canLightningStrikeAt(i1 + 1, k1, j1)) && (!par1World.canLightningStrikeAt(i1, k1, j1 - 1)) && (!par1World.canLightningStrikeAt(i1, k1, j1 + 1))) { int k2 = l + par5Random.nextInt(5) / 4; if (k2 > 15) { k2 = 15; } par1World.setBlock(i1, k1, j1, this.blockID, k2, 3); } } } } } } } } } }
/** Ticks the block if it's been scheduled */ @Override public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { boolean flag = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID; if ((par1World.worldProvider instanceof WorldProviderEnd) && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID) { flag = true; } if (!canPlaceBlockAt(par1World, par2, par3, par4)) { par1World.setBlockWithNotify(par2, par3, par4, 0); } if (!flag && par1World.isRaining() && (par1World.canLightningStrikeAt(par2, par3, par4) || par1World.canLightningStrikeAt(par2 - 1, par3, par4) || par1World.canLightningStrikeAt(par2 + 1, par3, par4) || par1World.canLightningStrikeAt(par2, par3, par4 - 1) || par1World.canLightningStrikeAt(par2, par3, par4 + 1))) { par1World.setBlockWithNotify(par2, par3, par4, 0); return; } int i = par1World.getBlockMetadata(par2, par3, par4); if (i < 15) { par1World.setBlockMetadata(par2, par3, par4, i + par5Random.nextInt(3) / 2); } par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate() + par5Random.nextInt(10)); if (!flag && !canNeighborBurn(par1World, par2, par3, par4)) { if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) || i > 3) { par1World.setBlockWithNotify(par2, par3, par4, 0); } return; } if (!flag && !canBlockCatchFire(par1World, par2, par3 - 1, par4) && i == 15 && par5Random.nextInt(4) == 0) { par1World.setBlockWithNotify(par2, par3, par4, 0); return; } boolean flag1 = par1World.isBlockHighHumidity(par2, par3, par4); byte byte0 = 0; if (flag1) { byte0 = -50; } tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + byte0, par5Random, i); tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + byte0, par5Random, i); tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + byte0, par5Random, i); tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + byte0, par5Random, i); tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + byte0, par5Random, i); tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + byte0, par5Random, i); for (int j = par2 - 1; j <= par2 + 1; j++) { for (int k = par4 - 1; k <= par4 + 1; k++) { for (int l = par3 - 1; l <= par3 + 4; l++) { if (j == par2 && l == par3 && k == par4) { continue; } int i1 = 100; if (l > par3 + 1) { i1 += (l - (par3 + 1)) * 100; } int j1 = getChanceOfNeighborsEncouragingFire(par1World, j, l, k); if (j1 <= 0) { continue; } int k1 = (j1 + 40) / (i + 30); if (flag1) { k1 /= 2; } if (k1 <= 0 || par5Random.nextInt(i1) > k1 || par1World.isRaining() && par1World.canLightningStrikeAt(j, l, k) || par1World.canLightningStrikeAt(j - 1, l, par4) || par1World.canLightningStrikeAt(j + 1, l, k) || par1World.canLightningStrikeAt(j, l, k - 1) || par1World.canLightningStrikeAt(j, l, k + 1)) { continue; } int l1 = i + par5Random.nextInt(5) / 4; if (l1 > 15) { l1 = 15; } par1World.setBlockAndMetadataWithNotify(j, l, k, blockID, l1); } } } }