From cd1df40d0def98471dad706227c05cafc4f6038e Mon Sep 17 00:00:00 2001 From: teknostom <42341753+teknostom@users.noreply.github.com> Date: Fri, 27 Jun 2025 20:43:48 +0200 Subject: [PATCH] Fix fire overflow (#945) * Add Fire * fixes * fix dropping blocks * fix logic * Fix CI * add support for waterlogged * fmt * fix comment * remove particles and sound from fire breaking * fmt * fix overflow * fix merge error --- pumpkin/src/block/blocks/fire/fire.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pumpkin/src/block/blocks/fire/fire.rs b/pumpkin/src/block/blocks/fire/fire.rs index 4a494b76c..027c079a5 100644 --- a/pumpkin/src/block/blocks/fire/fire.rs +++ b/pumpkin/src/block/blocks/fire/fire.rs @@ -146,7 +146,7 @@ impl FireBlock { } } - pub async fn get_burn_chance(&self, world: &Arc, pos: &BlockPos) -> u8 { + pub async fn get_burn_chance(&self, world: &Arc, pos: &BlockPos) -> i32 { let block_state = world.get_block_state(pos).await; if !block_state.is_air() { return 0; @@ -159,7 +159,7 @@ impl FireBlock { continue; // Skip if there is a fluid } if let Some(flammable) = neighbor_block.flammable { - total_burn_chance += flammable.burn_chance; + total_burn_chance += i32::from(flammable.burn_chance); } } @@ -405,11 +405,10 @@ impl PumpkinBlock for FireBlock { let burn_chance = Self.get_burn_chance(world, &offset_pos).await; if burn_chance > 0 { let o = 100 + if n > 1 { (n - 1) * 100 } else { 0 }; - let p: i32 = i32::from( - burn_chance - + 40 - + world.level_info.read().await.difficulty.to_int() * 7, - ) / i32::from(age + 30); + let p: i32 = burn_chance + + 40 + + i32::from(world.level_info.read().await.difficulty.to_int()) * 7 + / i32::from(age + 30); if p > 0 && rand::rng().random_range(0..o) <= p { let new_age = (age + rand::rng().random_range(0..5) / 4).min(15);