From 4ad5b2ba030157e6b319e615ba3aabf025b3ce32 Mon Sep 17 00:00:00 2001 From: Giems <109511301+Giems@users.noreply.github.com> Date: Wed, 20 May 2026 11:24:39 +0200 Subject: [PATCH] fix(entity): mobs no longer burn at night (#2123) --- pumpkin/src/entity/mob/mod.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pumpkin/src/entity/mob/mod.rs b/pumpkin/src/entity/mob/mod.rs index 1fac39a97..6951b3c47 100644 --- a/pumpkin/src/entity/mob/mod.rs +++ b/pumpkin/src/entity/mob/mod.rs @@ -78,6 +78,16 @@ pub struct MobEntity { last_sent_head_yaw: AtomicU8, } +/// Tick boundaries (both inclusive) when monsters do not burn in sunlight (26.1). +/// +/// Sourced from `data/minecraft/timeline/day.json` — `monsters_burn` keyframes: +/// `value=false` at tick 12542 (dusk), `value=true` at tick 23460 (dawn). +/// +/// TODO: Replace with `EnvironmentAttributes::MONSTERS_BURN` lookup once the +/// `EnvironmentAttributeSystem` is implemented in `pumpkin-data`. +const NIGHT_START: i64 = 12542; +const NIGHT_END: i64 = 23459; + impl MobEntity { #[expect(dead_code)] const AI_DISABLED_FLAG: u8 = 1; @@ -299,7 +309,14 @@ impl MobEntity { let world_arc = entity.world.load(); let world = world_arc.as_ref(); - // TODO: gate behind EnvironmentAttributes::MONSTERS_BURN once implemented. + // Night boundary from data/minecraft/timeline/day.json — monsters_burn keyframes: + // value=false at tick 12542 (dusk), value=true at tick 23460 (dawn). + // TODO: read directly from EnvironmentAttributes::MONSTERS_BURN once implemented. + + let day_time = world.get_time_of_day().await % 24000; + if (NIGHT_START..=NIGHT_END).contains(&day_time) { + return false; + } // Vanilla: getLightLevelDependentMagicValue() — sky light at eye pos, scaled 0–1. let eye_block_pos = entity.get_eye_pos();