// Try to instantly combust surrounding blocks
Block sBlock;
for (BlockFace face : BlockFaces.NESWBT) {
int chance = BlockFaces.TB.contains(face) ? 250 : 300;
sBlock = b.translate(face);
BlockMaterial mat = sBlock.getMaterial();
if (mat instanceof Burnable && rand.nextInt(chance) < ((Burnable) mat).getCombustChance()) {
// Destroy the old block
if (mat instanceof TntBlock) {
((TntBlock) mat).onIgnite(sBlock, toCause(b)); // Ignite TntBlock
} else if (mat instanceof VanillaBlockMaterial) {
VanillaBlockMaterial sVanillaBlock = (VanillaBlockMaterial) mat; // Destroy vanilla blocks without drops
sVanillaBlock.getDrops().clear();
sVanillaBlock.destroy(sBlock, toCause(b));
} else {
sBlock.setMaterial(VanillaMaterials.AIR); // Set non vanilla blocks to air
}
// Put fire in it's place?
if (rand.nextInt(blockData + 10) < 5 && hasBurningSource(sBlock) && !VanillaBlockMaterial.isRaining(sBlock)) {
sBlock.setMaterial(this, Math.min(15, blockData + rand.nextInt(5) / 4));
}
}
}
// Spreading component
int chanceFactor, firePower, netChance;
for (IntVector3 offset : SPREAD_RANGE) {
// Don't spread to the middle or to non-air and other fire blocks
if (offset.getX() == 0 && offset.getY() == 0 && offset.getZ() == 0) {
continue;
}
sBlock = b.translate(offset);
if (!sBlock.isMaterial(VanillaMaterials.AIR)) {
continue;
}
// Get power level for this fire
firePower = 0;
for (BlockFace face : BlockFaces.NESWBT) {
BlockMaterial mat = sBlock.translate(face).getMaterial();
if (mat instanceof Burnable) {
firePower = Math.max(firePower, ((Burnable) mat).getBurnPower());
}
}
if (firePower == 0) {