diff --git a/crates/horizon-client/src/game/creatures.rs b/crates/horizon-client/src/game/creatures.rs index 2b65a3289..80079d7e3 100644 --- a/crates/horizon-client/src/game/creatures.rs +++ b/crates/horizon-client/src/game/creatures.rs @@ -3367,6 +3367,9 @@ impl Game<'_> { f64::from(y + 1), f64::from(pos[2]) + 0.5, ]; - let _ = self.spawn_mob("minecraft:zombified_piglin", at, false); + // setPortalCooldown: the new piglin does not travel at once. + if let Some(id) = self.spawn_mob("minecraft:zombified_piglin", at, false) { + self.set_portal_cooldown(id); + } } } diff --git a/crates/horizon-client/src/game/nether_portal.rs b/crates/horizon-client/src/game/nether_portal.rs index 87ba81c93..89bf96ae0 100644 --- a/crates/horizon-client/src/game/nether_portal.rs +++ b/crates/horizon-client/src/game/nether_portal.rs @@ -505,6 +505,17 @@ impl Game<'_> { ); } } + /// `Entity.setPortalCooldown` on an entity that has just spawned in a + /// portal: it stands in the portal for 300 ticks without going through. + pub(super) fn set_portal_cooldown(&mut self, id: u32) { + self.portals.entities.insert( + id, + PortalState { + cooldown: ENTITY_DELAY, + process: None, + }, + ); + } /// `canUsePortal(false)` of a mob: alive, riding nothing, not asleep, /// not carrying the player, and not a boss that never travels. fn mob_can_use_portal(&self, m: &horizon_client::mobs::Mob) -> bool {