fix: fire loop/crash (#1502)

This commit is contained in:
RB007
2026-02-09 17:05:46 -05:00
committed by GitHub
parent 9435bbfb6a
commit b0dfe19318

View File

@@ -262,14 +262,6 @@ impl BlockBehaviour for FireBlock {
fn on_scheduled_tick<'a>(&'a self, args: OnScheduledTickArgs<'a>) -> BlockFuture<'a, ()> {
Box::pin(async move {
let (world, block, pos) = (args.world, args.block, args.position);
world
.schedule_block_tick(
block,
*pos,
Self::get_fire_tick_delay() as u8,
TickPriority::Normal,
)
.await;
if !Self
.can_place_at(CanPlaceAtArgs {
server: None,
@@ -410,6 +402,18 @@ impl BlockBehaviour for FireBlock {
}
}
}
// Only schedule a new tick if the block at the position is still this fire block.
let current_block = world.get_block(pos).await;
if current_block.id == block.id {
world
.schedule_block_tick(
block,
*pos,
Self::get_fire_tick_delay() as u8,
TickPriority::Normal,
)
.await;
}
})
}