From 372f918e44a14f984e1359001d4285a5ed3958ef Mon Sep 17 00:00:00 2001 From: socksprox Date: Sun, 25 Oct 2026 01:18:53 +0200 Subject: [PATCH 01/13] Multiplayer: keep firework flight duration, boost gliding players Two halves of FireworkRocketEntity on a server were missing: - SetCreativeModeSlot encoded only damage, so a creative-picked rocket lost its minecraft:fireworks component (flight_duration and explosions gone); the wire codec also had no decoder for it or firework_explosion, so a stack carrying them failed to decode at all. The components now follow Fireworks.STREAM_CODEC/FireworkExplosion.STREAM_CODEC both ways (component ids 71/70). - A remote rocket never read DATA_ATTACHED_TO_TARGET, DATA_ID_FIREWORKS_ITEM or DATA_SHOT_AT_ANGLE, so the server-attached boost rocket was an inert marker: attached_to now comes from EntityDataSerializers.OPTIONAL_UNSIGNED_INT (the id plus one), the item feeds the explosion list, and FireworkRocketEntity.tick's isFallFlying boost applies to the local player. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- crates/horizon-client/src/game/fireworks.rs | 9 +- crates/horizon-client/src/game/remote.rs | 48 +++++++++ .../src/game/remote_projectiles.rs | 54 +++++++++- crates/horizon-protocol/src/item.rs | 99 +++++++++++++++++++ 4 files changed, 207 insertions(+), 3 deletions(-) diff --git a/crates/horizon-client/src/game/fireworks.rs b/crates/horizon-client/src/game/fireworks.rs index 85fccc2de..a0aa276b7 100644 --- a/crates/horizon-client/src/game/fireworks.rs +++ b/crates/horizon-client/src/game/fireworks.rs @@ -25,9 +25,12 @@ pub(super) struct Rocket { pub(super) velocity: Vec3, life: i32, lifetime: i32, - explosions: Vec, + pub(super) explosions: Vec, /// Boosting the player (attachedToEntity). pub(super) attached: bool, + /// `DATA_ATTACHED_TO_TARGET`: the server entity the rocket follows; + /// boosting happens when it is the local player. + pub(super) attached_to: Option, /// `DATA_SHOT_AT_ANGLE` (dispensers): constant velocity, exploding on /// the first block it hits. pub(super) angled: bool, @@ -48,6 +51,7 @@ impl Rocket { lifetime: i32::MAX, explosions, attached: false, + attached_to: None, angled: false, item, } @@ -63,7 +67,7 @@ impl Rocket { (self.position, self.velocity) } } -fn fireworks_of(stack: &ItemStack) -> (u8, Vec) { +pub(super) fn fireworks_of(stack: &ItemStack) -> (u8, Vec) { // The item's default component: flight 1, no explosions. stack .data() @@ -89,6 +93,7 @@ impl Game<'_> { lifetime, explosions, attached, + attached_to: None, angled: false, item: stack.clone(), } diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 45ba4bebe..29a7ab46f 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -596,6 +596,28 @@ impl Game<'_> { out.tidy(); Some(out) } + /// A wire `FireworkExplosion` as vanilla's NBT codec writes it + /// (`FireworkExplosion.Shape`'s BY_ID order). + fn fireworks_tag(e: &horizon_protocol::item::FireworkExplosion) -> Tag { + const SHAPES: [&str; 5] = ["small_ball", "large_ball", "star", "creeper", "burst"]; + let ints = |c: &[i32]| Tag::List(c.iter().map(|c| Tag::Int(*c)).collect()); + Tag::compound([ + ( + "shape", + Tag::String( + SHAPES + .get(e.shape.max(0) as usize) + .copied() + .unwrap_or("small_ball") + .into(), + ), + ), + ("colors", ints(&e.colors)), + ("fade_colors", ints(&e.fade)), + ("has_trail", Tag::Byte(i8::from(e.trail))), + ("has_twinkle", Tag::Byte(i8::from(e.twinkle))), + ]) + } /// The item's patched components as vanilla's `components` compound. fn protocol_components(&self, s: &Stack) -> Option { use horizon_protocol::item::{Component, component}; @@ -633,6 +655,14 @@ impl Game<'_> { ("pages", Tag::List(b.pages.clone())), ("resolved", Tag::Byte(i8::from(b.resolved))), ]), + Component::Fireworks { flight, explosions } => Tag::compound([ + ("flight_duration", Tag::Byte(*flight as i8)), + ( + "explosions", + Tag::List(explosions.iter().map(Self::fireworks_tag).collect()), + ), + ]), + Component::FireworkExplosion(e) => Self::fireworks_tag(e), Component::Enchantments(list) => { // Enchantments are a synced (data-driven) registry: the // ids index the server's RegistryData, not the builtin @@ -719,6 +749,24 @@ impl Game<'_> { horizon_protocol::item::Component::Int(s.damage as i32), )); } + if let Some((flight, explosions)) = s.data().and_then(|d| d.fireworks.clone()) { + stack.added.push(( + horizon_protocol::item::component::FIREWORKS, + horizon_protocol::item::Component::Fireworks { + flight: i32::from(flight), + explosions: explosions + .iter() + .map(|e| horizon_protocol::item::FireworkExplosion { + shape: e.shape as i32, + colors: e.colors.iter().map(|c| *c as i32).collect(), + fade: e.fade.iter().map(|c| *c as i32).collect(), + trail: e.trail, + twinkle: e.twinkle, + }) + .collect(), + }, + )); + } Some(stack) } /// A line in the connection's chat, with its styles, click and hover diff --git a/crates/horizon-client/src/game/remote_projectiles.rs b/crates/horizon-client/src/game/remote_projectiles.rs index 58f82e3a9..dbf7f3ccf 100644 --- a/crates/horizon-client/src/game/remote_projectiles.rs +++ b/crates/horizon-client/src/game/remote_projectiles.rs @@ -2,7 +2,7 @@ //! end crystals on a server's client (`ClientPacketListener.handleAddEntity` //! and `handleSetEntityData`): the server simulates them, the client draws //! them where it says and interpolates their moves. -use super::{FallingBlock, Game}; +use super::{FallingBlock, Game, fireworks::fireworks_of, view_vector}; use horizon_client::projectiles::{Projectile, ProjectileKind}; use horizon_core::{geometry::Vec3, position::BlockPos}; use horizon_protocol::entity_data::Value; @@ -117,6 +117,37 @@ impl Game<'_> { pub(super) fn remote_projectile_data(&mut self, id: i32, values: &[(u8, i32, Value)]) { let id = id as u32; self.remote_hook_data(id, values); + if self.rockets.iter().any(|r| r.id == id) { + for (index, _, value) in values { + match (index, value) { + // FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM: its + // explosions for `createFireworks`. + (8, Value::Item(stack)) => { + if let Some(stack) = self.to_stack(stack) + && let Some(r) = self.rockets.iter_mut().find(|r| r.id == id) + { + let (_, explosions) = fireworks_of(&stack); + r.explosions = explosions; + r.item = stack; + } + } + // DATA_ATTACHED_TO_TARGET (OptionalInt: the id plus 1). + (9, Value::Id(v)) => { + let v = (*v > 0).then(|| (*v - 1) as u32); + if let Some(r) = self.rockets.iter_mut().find(|r| r.id == id) { + r.attached_to = v; + } + } + // DATA_SHOT_AT_ANGLE. + (10, Value::Bool(a)) => { + if let Some(r) = self.rockets.iter_mut().find(|r| r.id == id) { + r.angled = *a; + } + } + _ => {} + } + } + } if self.potions.has_thrown(id) { // ThrowableItemProjectile.DATA_ITEM_STACK: the potion it is. for (index, _, value) in values { @@ -199,9 +230,30 @@ impl Game<'_> { let id = t.id; t.remote_step(|at| step(id, at)); } + // FireworkRocketEntity.tick: a rocket attached to the gliding local + // player boosts it client-side too (attachedToEntity.isFallFlying). + let me = self + .remote + .as_ref() + .and_then(|r| u32::try_from(r.entity_id).ok()); for r in &mut self.rockets { let id = r.id; r.remote_step(|at| step(id, at)); + if me.is_some() && r.attached_to == me { + if let Some(p) = self.player.as_mut() + && p.fall_flying + { + let look = view_vector(self.yaw, self.pitch); + let m = p.velocity; + p.velocity = Vec3::new( + m.x + look[0] * 0.1 + (look[0] * 1.5 - m.x) * 0.5, + m.y + look[1] * 0.1 + (look[1] * 1.5 - m.y) * 0.5, + m.z + look[2] * 0.1 + (look[2] * 1.5 - m.z) * 0.5, + ); + r.position = p.position; + r.velocity = p.velocity; + } + } } for c in &mut self.crystals { c.time += 1; diff --git a/crates/horizon-protocol/src/item.rs b/crates/horizon-protocol/src/item.rs index 650fa4baa..753fc7349 100644 --- a/crates/horizon-protocol/src/item.rs +++ b/crates/horizon-protocol/src/item.rs @@ -35,6 +35,8 @@ pub mod component { pub const CHARGED_PROJECTILES: i32 = 51; pub const WRITABLE_BOOK_CONTENT: i32 = 56; pub const WRITTEN_BOOK_CONTENT: i32 = 57; + pub const FIREWORK_EXPLOSION: i32 = 70; + pub const FIREWORKS: i32 = 71; } /// A written book's content (`WrittenBookContent.STREAM_CODEC`): the @@ -78,6 +80,48 @@ pub enum Component { WrittenBook(WrittenBook), /// `ChargedProjectiles`: a loaded crossbow's ammunition, as templates. Stacks(Vec), + /// `Fireworks`: flight duration and its explosions. + Fireworks { + flight: i32, + explosions: Vec, + }, + /// `FireworkExplosion` (a firework star). + FireworkExplosion(FireworkExplosion), +} + +/// `FireworkExplosion.STREAM_CODEC`: shape id, colors, fade colors, trail +/// and twinkle (FireworkExplosion.Shape's BY_ID order). +#[derive(Clone, Debug, PartialEq)] +pub struct FireworkExplosion { + pub shape: i32, + pub colors: Vec, + pub fade: Vec, + pub trail: bool, + pub twinkle: bool, +} +impl FireworkExplosion { + fn read(r: &mut Reader) -> Result { + let ints = |r: &mut Reader| -> Result> { + let n = r.count(1024)?; + (0..n).map(|_| r.i32()).collect() + }; + Ok(Self { + shape: r.varint()?, + colors: ints(r)?, + fade: ints(r)?, + trail: r.bool()?, + twinkle: r.bool()?, + }) + } + fn write(&self, w: &mut Writer) { + w.varint(self.shape); + w.varint(self.colors.len() as i32); + self.colors.iter().for_each(|c| w.i32(*c)); + w.varint(self.fade.len() as i32); + self.fade.iter().for_each(|c| w.i32(*c)); + w.bool(self.trail); + w.bool(self.twinkle); + } } /// `Filterable.streamCodec`: the raw value, then an optional filtered one @@ -224,6 +268,17 @@ impl Component { hidden: (0..n).map(|_| r.varint()).collect::>()?, } } + FIREWORKS => { + let flight = r.varint()?; + let n = r.count(256)?; + Self::Fireworks { + flight, + explosions: (0..n) + .map(|_| FireworkExplosion::read(r)) + .collect::>()?, + } + } + FIREWORK_EXPLOSION => Self::FireworkExplosion(FireworkExplosion::read(r)?), other => return Err(Error::new(format!("unsupported item component {other}"))), }) } @@ -294,6 +349,12 @@ impl Component { w.varint(stacks.len() as i32); stacks.iter().for_each(|s| Template::write(s, w)); } + Self::Fireworks { flight, explosions } => { + w.varint(*flight); + w.varint(explosions.len() as i32); + explosions.iter().for_each(|e| e.write(w)); + } + Self::FireworkExplosion(e) => e.write(w), Self::WritableBook(pages) => { w.varint(pages.len() as i32); for page in pages { @@ -544,6 +605,44 @@ mod tests { round::, HashedSlot>(None); } + #[test] + fn fireworks_components_round_trip() { + let mut rocket = Stack::new(42, 1); + rocket.added.push(( + component::FIREWORKS, + Component::Fireworks { + flight: 3, + explosions: vec![ + FireworkExplosion { + shape: 4, + colors: vec![0xff0000, 0x00ff00], + fade: vec![0x0000ff], + trail: true, + twinkle: false, + }, + FireworkExplosion { + shape: 0, + colors: vec![], + fade: vec![], + trail: false, + twinkle: true, + }, + ], + }, + )); + rocket.added.push(( + component::FIREWORK_EXPLOSION, + Component::FireworkExplosion(FireworkExplosion { + shape: 2, + colors: vec![7], + fade: vec![], + trail: false, + twinkle: false, + }), + )); + round::, Slot>(Some(rocket)); + } + #[test] fn charged_projectiles_are_item_stack_templates() { // A crossbow (id 7) loaded with one arrow (id 9): ChargedProjectiles From da150409ea6b63f8a70450d5d7a62ac00a8c2ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaic=20Salom=C3=A3o?= Date: Sun, 25 Oct 2026 02:49:22 -0300 Subject: [PATCH 02/13] Complete and color mod commands in the chat on the server thread --- crates/horizon-client/src/game/chat.rs | 2 +- crates/horizon-client/src/game/mods.rs | 25 ++++++++++++++++++++++++ crates/horizon-client/src/game/remote.rs | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/game/chat.rs b/crates/horizon-client/src/game/chat.rs index 1bc30513b..e879698c7 100644 --- a/crates/horizon-client/src/game/chat.rs +++ b/crates/horizon-client/src/game/chat.rs @@ -18,7 +18,7 @@ fn chat_tree<'a>( mods: &'a super::mods::ModsState, ) -> &'a horizon_client::command::Dispatcher { match remote.as_ref().and_then(|r| r.commands.as_ref()) { - Some(tree) => tree, + Some(tree) => mods.remote_dispatcher().unwrap_or(tree), None => mods.dispatcher(), } } diff --git a/crates/horizon-client/src/game/mods.rs b/crates/horizon-client/src/game/mods.rs index 572f9fe2b..982c7f097 100644 --- a/crates/horizon-client/src/game/mods.rs +++ b/crates/horizon-client/src/game/mods.rs @@ -39,6 +39,9 @@ pub(super) struct ModsState { /// The chat's command tree while a running mod owns commands. #[cfg(feature = "mods")] tree: Option, + /// The server's command tree with the running mods' commands added. + #[cfg(feature = "mods")] + remote_tree: Option, } impl ModsState { /// The chat's command tree: vanilla's, plus the running mods' commands. @@ -49,6 +52,14 @@ impl ModsState { } vanilla::game_dispatcher() } + /// The server's tree plus the mods' commands, when a mod owns any. + pub(super) fn remote_dispatcher(&self) -> Option<&Dispatcher> { + #[cfg(feature = "mods")] + if let Some(tree) = &self.remote_tree { + return Some(tree); + } + None + } /// Whether a mod runs: the chat keeps its lines for them. pub(super) fn running(&self) -> bool { #[cfg(feature = "mods")] @@ -158,6 +169,7 @@ impl Game<'_> { ); } } + pub(super) fn merge_remote_tree(&mut self) {} pub(super) fn sync_mods(&mut self) {} pub(super) fn tick_mods(&mut self) {} pub(super) fn mods_frame(&mut self, _elapsed: Duration) {} @@ -238,7 +250,20 @@ impl Game<'_> { .peek() .is_some() .then(|| vanilla::game_dispatcher().with_mod_commands(names)); + self.merge_remote_tree(); } + + /// The server's command tree with the mods' commands, for the chat. + pub(super) fn merge_remote_tree(&mut self) { + let names: Vec = self.mods.mods.commands().map(str::to_owned).collect(); + self.mods.remote_tree = self + .remote + .as_ref() + .and_then(|r| r.commands.as_ref()) + .filter(|_| !names.is_empty()) + .map(|t| t.with_mod_commands(names.iter().map(String::as_str))); + } + /// After the options changed: restart the mods if the list of the ones /// turned on did. pub(super) fn sync_mods(&mut self) { diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 23c6677c2..9da81e551 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -2423,6 +2423,7 @@ impl Game<'_> { if let Some(r) = self.remote.as_mut() { r.commands = Some(tree); } + self.merge_remote_tree(); } C::SystemChat(p) => { // The component as sent, translated in the client's own From 90ae953747a746cc32b20bc1cf4cf73cd21ce8c0 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 10:21:48 +0100 Subject: [PATCH 03/13] Rockets: collapse the boost's nested if (clippy::collapsible_if) Verify failed on it with warnings denied. Co-Authored-By: Claude Opus 5.5 --- .../src/game/remote_projectiles.rs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/horizon-client/src/game/remote_projectiles.rs b/crates/horizon-client/src/game/remote_projectiles.rs index dbf7f3ccf..056efa7c3 100644 --- a/crates/horizon-client/src/game/remote_projectiles.rs +++ b/crates/horizon-client/src/game/remote_projectiles.rs @@ -239,20 +239,20 @@ impl Game<'_> { for r in &mut self.rockets { let id = r.id; r.remote_step(|at| step(id, at)); - if me.is_some() && r.attached_to == me { - if let Some(p) = self.player.as_mut() - && p.fall_flying - { - let look = view_vector(self.yaw, self.pitch); - let m = p.velocity; - p.velocity = Vec3::new( - m.x + look[0] * 0.1 + (look[0] * 1.5 - m.x) * 0.5, - m.y + look[1] * 0.1 + (look[1] * 1.5 - m.y) * 0.5, - m.z + look[2] * 0.1 + (look[2] * 1.5 - m.z) * 0.5, - ); - r.position = p.position; - r.velocity = p.velocity; - } + if me.is_some() + && r.attached_to == me + && let Some(p) = self.player.as_mut() + && p.fall_flying + { + let look = view_vector(self.yaw, self.pitch); + let m = p.velocity; + p.velocity = Vec3::new( + m.x + look[0] * 0.1 + (look[0] * 1.5 - m.x) * 0.5, + m.y + look[1] * 0.1 + (look[1] * 1.5 - m.y) * 0.5, + m.z + look[2] * 0.1 + (look[2] * 1.5 - m.z) * 0.5, + ); + r.position = p.position; + r.velocity = p.velocity; } } for c in &mut self.crystals { From 11035336a0115e7fbf4444934500c06ae93c66a4 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 11:24:29 +0100 Subject: [PATCH 04/13] Server: a gliding player's rocket boosts them FireworkRocketItem.use attaches a rocket only to a player who is fall flying. The server tracks a guest's glide (START_FALL_FLYING) but the body it swaps in for their item use left fall_flying unset, so on the server thread, LAN and dedicated servers the rocket did nothing. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/lan_actions.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/horizon-client/src/game/lan_actions.rs b/crates/horizon-client/src/game/lan_actions.rs index d0f16a0d6..e140f31eb 100644 --- a/crates/horizon-client/src/game/lan_actions.rs +++ b/crates/horizon-client/src/game/lan_actions.rs @@ -264,6 +264,8 @@ impl Game<'_> { motion.sprinting = g.sprinting; motion.may_fly = g.creative() || g.game_mode == SPECTATOR; motion.flying = g.flying; + // FireworkRocketItem.use boosts only a gliding player. + motion.fall_flying = g.fall_flying; motion.invulnerable = motion.may_fly; let _ = motion.set_health(g.health, false); motion.health.food.food = g.food; From e7ca664e01471d6c8e3581c411138d336c1ffff1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 11:32:23 +0100 Subject: [PATCH 05/13] Server: a guest's boost rocket is theirs The server attached every boosting rocket to its own player: it followed the host, and DATA_ATTACHED_TO_TARGET named the host (or nothing on the server thread, which has none), so the guest's client never saw a rocket attached to them and did not boost. The rocket now keeps the guest it was fired by, follows them and names their entity. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/fireworks.rs | 23 ++++++++++++++++--- .../horizon-client/src/game/lan_entities.rs | 12 ++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/crates/horizon-client/src/game/fireworks.rs b/crates/horizon-client/src/game/fireworks.rs index a0aa276b7..623e0e147 100644 --- a/crates/horizon-client/src/game/fireworks.rs +++ b/crates/horizon-client/src/game/fireworks.rs @@ -28,6 +28,9 @@ pub(super) struct Rocket { pub(super) explosions: Vec, /// Boosting the player (attachedToEntity). pub(super) attached: bool, + /// On a server, the player it boosts when not this game's own: a guest's + /// connection. + pub(super) guest: Option, /// `DATA_ATTACHED_TO_TARGET`: the server entity the rocket follows; /// boosting happens when it is the local player. pub(super) attached_to: Option, @@ -51,6 +54,7 @@ impl Rocket { lifetime: i32::MAX, explosions, attached: false, + guest: None, attached_to: None, angled: false, item, @@ -93,6 +97,7 @@ impl Game<'_> { lifetime, explosions, attached, + guest: None, attached_to: None, angled: false, item: stack.clone(), @@ -132,7 +137,8 @@ impl Game<'_> { return false; } let at = self.player.as_ref().map_or(Vec3::ZERO, |p| p.position); - let rocket = self.new_rocket(at, stack, true); + let mut rocket = self.new_rocket(at, stack, true); + rocket.guest = self.lan_acting; self.rockets.push(rocket); if !self.creative { self.consume_held(); @@ -145,7 +151,18 @@ impl Game<'_> { while i < self.rockets.len() { let mut r = self.rockets.remove(i); r.previous = r.position; - if r.attached { + if r.attached + && let Some(conn) = r.guest + { + // A guest's rocket follows them; their own client boosts them. + let guest = self + .lan + .as_ref() + .and_then(|host| host.hub.guests.iter().find(|g| g.conn == conn)); + if let Some(g) = guest { + r.position = Vec3::new(g.position[0], g.position[1], g.position[2]); + } + } else if r.attached { if let Some(p) = self.player.as_mut() { if p.fall_flying { let look = view_vector(self.yaw, self.pitch); @@ -234,7 +251,7 @@ impl Game<'_> { let at = [r.position.x, r.position.y, r.position.z]; if !r.explosions.is_empty() { let damage = 5.0 + r.explosions.len() as f32 * 2.0; - if r.attached { + if r.attached && r.guest.is_none() { self.hurt_player_by("minecraft:fireworks", damage); } let from = r.position; diff --git a/crates/horizon-client/src/game/lan_entities.rs b/crates/horizon-client/src/game/lan_entities.rs index db0c3e8b2..c525c902e 100644 --- a/crates/horizon-client/src/game/lan_entities.rs +++ b/crates/horizon-client/src/game/lan_entities.rs @@ -417,11 +417,19 @@ impl Game<'_> { Value::Item(hub.stack(&Some(r.item.clone()))), )); } + let boosted = match r.guest { + Some(conn) => hub + .guests + .iter() + .find(|g| g.conn == conn) + .map(|g| g.entity_id), + None => host_entity, + }; if r.attached - && let Some(host) = host_entity + && let Some(player) = boosted { e.meta - .push((9, serializer::OPTIONAL_UNSIGNED_INT, Value::Id(host + 1))); + .push((9, serializer::OPTIONAL_UNSIGNED_INT, Value::Id(player + 1))); } if r.angled { e.meta.push((10, serializer::BOOLEAN, Value::Bool(true))); From 41b799042acb262601e6a3e2695a5a3e68b4e618 Mon Sep 17 00:00:00 2001 From: socksprox Date: Sun, 25 Oct 2026 14:26:55 +0100 Subject: [PATCH 06/13] Sync mobs' aggressive and item-use flags so clients pose them right Mob.DATA_MOB_FLAGS_ID's aggressive bit and LivingEntity's DATA_LIVING_ENTITY_FLAGS never reached a client for mobs: on the server thread and for LAN guests a skeleton kept its arms down while its arrows flew, and a drawn bow never pulled. Send both entries (with their defaults so a flag going back to 0 is sent too), decode them for every mob, and let a remote mob's item-use ticks count up as LivingEntity.updatingUsingItem does. The same entries drive the zombie arms, the vindicator's axe, the drowned's trident and the spellcasters' poses, so the pillager's charging and evoker's/illusioner's casting entries go with them. A left-handed mob now mirrors the pose and the held item (Mob.getMainArm), and a bow in the off hand counts for LivingEntity.isHolding. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- crates/horizon-client/src/game/lan.rs | 28 +++++++- crates/horizon-client/src/game/mob_blocks.rs | 4 +- crates/horizon-client/src/game/remote.rs | 67 +++++++------------ .../src/game/remote_mob_data.rs | 63 +++++++++++++++++ crates/horizon-client/src/mobs.rs | 5 ++ crates/horizon-client/src/mobs/anim.rs | 4 +- crates/horizon-client/src/mobs/undead.rs | 5 ++ 7 files changed, 127 insertions(+), 49 deletions(-) diff --git a/crates/horizon-client/src/game/lan.rs b/crates/horizon-client/src/game/lan.rs index 8460f54e6..522c6f1d3 100644 --- a/crates/horizon-client/src/game/lan.rs +++ b/crates/horizon-client/src/game/lan.rs @@ -162,17 +162,26 @@ fn mob_meta( meta.push((3, serializer::BOOLEAN, Value::Bool(true))); } } + // LivingEntity.DATA_LIVING_ENTITY_FLAGS: using an item 1, in the off + // hand 2 (a skeleton draws its bow, a witch raises her potion). + let using = i8::from(m.extra.using_item > 0) | i8::from(m.extra.using_off_hand) << 1; + if using != 0 { + meta.push((8, serializer::BYTE, Value::Byte(using))); + } + defaults.push((8, serializer::BYTE, Value::Byte(0))); // LivingEntity.DATA_HEALTH_ID: defined as 1, then set to the max health. let health = m.health.max(0.0); if health != 1.0 { meta.push((9, serializer::FLOAT, Value::Float(health))); } defaults.push((9, serializer::FLOAT, Value::Float(1.0))); - // Mob.DATA_MOB_FLAGS_ID: no AI 1, left-handed 2. - let flags = i8::from(m.no_ai) | i8::from(m.extra.left_handed) << 1; + // Mob.DATA_MOB_FLAGS_ID: no AI 1, left-handed 2, aggressive 4. + let flags = + i8::from(m.no_ai) | i8::from(m.extra.left_handed) << 1 | i8::from(m.ai.aggressive) << 2; if flags != 0 { meta.push((15, serializer::BYTE, Value::Byte(flags))); } + defaults.push((15, serializer::BYTE, Value::Byte(0))); // AgeableMob.DATA_BABY_ID (and Zombie's, Piglin's). if let Some(index) = baby_index(kind) { if m.is_baby() { @@ -289,6 +298,21 @@ fn mob_meta( meta.push((18, serializer::BOOLEAN, Value::Bool(true))); } } + // Pillager.IS_CHARGING_CROSSBOW: the charge pose and the held + // item's loading animation. + "minecraft:pillager" => { + if e.flag { + meta.push((17, serializer::BOOLEAN, Value::Bool(true))); + } + defaults.push((17, serializer::BOOLEAN, Value::Bool(false))); + } + // SpellcasterIllager.DATA_SPELL_CASTING_ID: the casting pose. + "minecraft:evoker" | "minecraft:illusioner" => { + if e.variant2 != 0 { + meta.push((17, serializer::BYTE, Value::Byte(e.variant2 as i8))); + } + defaults.push((17, serializer::BYTE, Value::Byte(0))); + } // Enderman.DATA_CARRY_STATE. "minecraft:enderman" => { if let Some(state) = e.carried { diff --git a/crates/horizon-client/src/game/mob_blocks.rs b/crates/horizon-client/src/game/mob_blocks.rs index a9e854bfb..083c96a66 100644 --- a/crates/horizon-client/src/game/mob_blocks.rs +++ b/crates/horizon-client/src/game/mob_blocks.rs @@ -259,7 +259,7 @@ impl Game<'_> { // ItemInHandLayer submits with OverlayTexture.NO_OVERLAY: no hurt tint. for (item, off_hand) in [(&mob.extra.main_hand, false), (&mob.extra.off_hand, true)] { let Some(item) = item else { continue }; - let left = off_hand != mob.extra.main_hand_left; + let left = off_hand != mob.main_arm_left(); let Some(t) = render::held_item_transform(mob, alpha as f32, camera, self.res.mob_data(), left) else { @@ -305,7 +305,7 @@ impl Game<'_> { .player_model .as_ref() .is_some_and(|p| std::ptr::eq(p, mob)); - owner.main_arm_left = mob.extra.main_hand_left; + owner.main_arm_left = mob.main_arm_left(); if off_hand == mob.extra.using_off_hand && mob.extra.using_item > 0 { owner.using_this_item = true; owner.use_duration = 72_000; diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index dc3ce5de9..ae5d25a44 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -1994,15 +1994,6 @@ impl Game<'_> { } } } - if let Some(m) = self.mobs.iter_mut().find(|m| m.id == p.id as u32) - && m.species() == horizon_client::mobs::Species::Rabbit - { - for (index, _, value) in &p.values { - if let (15, Value::Byte(flags)) = (index, value) { - m.no_ai = flags & 1 != 0; - } - } - } self.remote_mob_data(p.id, &p.values); if let Some(m) = self.mobs.iter_mut().find(|m| m.id == p.id as u32) && m.species() == horizon_client::mobs::Species::Creeper @@ -2017,25 +2008,12 @@ impl Game<'_> { } } } - // LivingEntity.onSyncedDataUpdated(DATA_LIVING_ENTITY_FLAGS): - // another player starts using the item in a hand (eating, a - // bow drawn, a shield up), or stops. + // LivingEntity.DATA_LIVING_ENTITY_FLAGS: for another player + // too, remote_mob_data's apply reads index 8 above. let other = self .remote .as_ref() .is_some_and(|r| r.level_players.contains_key(&p.id) && r.entity_id != p.id); - if other && let Some(m) = self.mobs.iter_mut().find(|m| m.id == p.id as u32) { - for (index, _, value) in &p.values { - if let (8, Value::Byte(flags)) = (index, value) { - m.extra.using_off_hand = flags & 2 != 0; - if flags & 1 == 0 { - m.extra.using_item = 0; - } else if m.extra.using_item == 0 { - m.extra.using_item = 1; - } - } - } - } // LivingEntity.onSyncedDataUpdated(SLEEPING_POS_ID): another // player lies down in their bed (drawn lying in it), or gets up. if other { @@ -3520,25 +3498,28 @@ impl Game<'_> { m.head_yaw += wrap_degrees(*yaw - m.head_yaw) / *steps as f32; *steps -= 1; } - // LivingEntity.updatingUsingItem for another player: the ticks the - // item has been used before this one. - if player && m.extra.using_item > 0 { - let item = if m.extra.using_off_hand { - m.extra.off_hand.clone() - } else { - m.extra.main_hand.clone() - }; - if let Some(item) = item { - let eye = if m.extra.crouching { 1.27 } else { 1.62 }; - let at = [m.position.x, m.position.y, m.position.z]; - using.push(( - item, - m.extra.using_item as u32 - 1, - at, - eye, - m.head_pitch, - m.yaw, - )); + // LivingEntity.updatingUsingItem: the ticks the item has been + // used before this one. Another player's use particles; a mob's + // drawn bow only needs the count (its pull follows it). + if m.extra.using_item > 0 { + if player { + let item = if m.extra.using_off_hand { + m.extra.off_hand.clone() + } else { + m.extra.main_hand.clone() + }; + if let Some(item) = item { + let eye = if m.extra.crouching { 1.27 } else { 1.62 }; + let at = [m.position.x, m.position.y, m.position.z]; + using.push(( + item, + m.extra.using_item as u32 - 1, + at, + eye, + m.head_pitch, + m.yaw, + )); + } } m.extra.using_item += 1; } diff --git a/crates/horizon-client/src/game/remote_mob_data.rs b/crates/horizon-client/src/game/remote_mob_data.rs index 5573d0f87..5d024cd84 100644 --- a/crates/horizon-client/src/game/remote_mob_data.rs +++ b/crates/horizon-client/src/game/remote_mob_data.rs @@ -20,9 +20,27 @@ fn apply(m: &mut Mob, values: &[(u8, i32, Value)], builtin: &Builtin) { // client, which draws the flames. A client doesn't count the // fire down: the flag goes off when the server's fire is out. (0, Value::Byte(flags)) => m.fire_ticks = i32::from(flags & 1), + // LivingEntity.DATA_LIVING_ENTITY_FLAGS: using an item 1, in the + // off hand 2. The flag starts and stops the use; the client ticks + // the count itself (a bow's pull follows it). + (8, Value::Byte(flags)) => { + m.extra.using_off_hand = flags & 2 != 0; + if flags & 1 == 0 { + m.extra.using_item = 0; + } else if m.extra.using_item == 0 { + m.extra.using_item = 1; + } + } // LivingEntity.DATA_HEALTH_ID: the boss bars and the death // animation follow it. (9, Value::Float(health)) => m.health = *health, + // Mob.DATA_MOB_FLAGS_ID: no AI 1, left-handed 2, aggressive 4. + // A skeleton raises its bow and a zombie its arms on the last bit. + (15, Value::Byte(flags)) => { + m.no_ai = flags & 1 != 0; + m.extra.left_handed = flags & 2 != 0; + m.ai.aggressive = flags & 4 != 0; + } (i, Value::Bool(b)) if Some(i) == baby => m.extra.age = if *b { -1 } else { 0 }, _ => {} } @@ -45,6 +63,13 @@ fn apply(m: &mut Mob, values: &[(u8, i32, Value)], builtin: &Builtin) { (Species::Slime | Species::MagmaCube, 18, Value::Int(size)) => { m.extra.size = (*size).clamp(1, 127); } + // Pillager.IS_CHARGING_CROSSBOW: the charge pose (Raider's + // IS_CELEBRATING takes 16). + (Species::Pillager, 17, Value::Bool(charging)) => m.extra.flag = *charging, + // SpellcasterIllager.DATA_SPELL_CASTING_ID: the casting pose. + (Species::Evoker | Species::Illusioner, 17, Value::Byte(spell)) => { + m.extra.variant2 = (*spell).max(0) as u8; + } // Villager.DATA_VILLAGER_DATA and ZombieVillager's (after // Zombie's three): what VillagerProfessionLayer draws. (Species::Villager, 19, Value::Ids(data)) @@ -218,4 +243,42 @@ mod tests { ); assert_eq!(name(&z), ("desert", "farmer", 3)); } + + #[test] + fn the_mob_flags_drive_the_aggressive_poses() { + let Some(mut m) = mob("minecraft:skeleton") else { + return; + }; + apply(&mut m, &[(15, s::BYTE, Value::Byte(2 | 4))]); + assert!(m.ai.aggressive && m.extra.left_handed && !m.no_ai); + apply(&mut m, &[(15, s::BYTE, Value::Byte(0))]); + assert!(!m.ai.aggressive && !m.extra.left_handed); + } + + #[test] + fn the_living_flags_start_and_stop_a_mob_using_an_item() { + let Some(mut m) = mob("minecraft:skeleton") else { + return; + }; + apply(&mut m, &[(8, s::BYTE, Value::Byte(1))]); + assert_eq!(m.extra.using_item, 1); + assert!(!m.extra.using_off_hand); + // Using in the off hand. + apply(&mut m, &[(8, s::BYTE, Value::Byte(3))]); + assert!(m.extra.using_off_hand); + apply(&mut m, &[(8, s::BYTE, Value::Byte(0))]); + assert_eq!(m.extra.using_item, 0); + } + + #[test] + fn a_pillager_charges_and_a_spellcaster_casts() { + let Some(mut p) = mob("minecraft:pillager") else { + return; + }; + apply(&mut p, &[(17, s::BOOLEAN, Value::Bool(true))]); + assert!(p.extra.flag); + let mut e = mob("minecraft:evoker").unwrap(); + apply(&mut e, &[(17, s::BYTE, Value::Byte(2))]); + assert_eq!(e.extra.variant2, 2); + } } diff --git a/crates/horizon-client/src/mobs.rs b/crates/horizon-client/src/mobs.rs index 4e3879fe5..1a124b6de 100644 --- a/crates/horizon-client/src/mobs.rs +++ b/crates/horizon-client/src/mobs.rs @@ -1646,6 +1646,11 @@ impl Mob { pub fn species(&self) -> Species { self.kind.species } + /// `Mob.getMainArm`: the left arm when the mob is left-handed, a player's + /// `mainHand` option for a player mob. + pub fn main_arm_left(&self) -> bool { + self.extra.main_hand_left || self.extra.left_handed + } /// The player hit this mob (melee): LivingEntity.hurt with knockback. pub fn hurt( &mut self, diff --git a/crates/horizon-client/src/mobs/anim.rs b/crates/horizon-client/src/mobs/anim.rs index aa0d8fb2a..b2158132b 100644 --- a/crates/horizon-client/src/mobs/anim.rs +++ b/crates/horizon-client/src/mobs/anim.rs @@ -642,7 +642,7 @@ pub fn setup( } else { ArmPose::Empty }; - let mut h = if m.extra.main_hand_left { + let mut h = if m.main_arm_left() { Hum::new(ArmPose::Empty, main) } else { Hum::new(main, ArmPose::Empty) @@ -693,7 +693,7 @@ pub fn setup( } else { ArmPose::Empty }; - let mut h = if m.extra.main_hand_left { + let mut h = if m.main_arm_left() { Hum::new(off, pose) } else { Hum::new(pose, off) diff --git a/crates/horizon-client/src/mobs/undead.rs b/crates/horizon-client/src/mobs/undead.rs index 197321dea..e77a37641 100644 --- a/crates/horizon-client/src/mobs/undead.rs +++ b/crates/horizon-client/src/mobs/undead.rs @@ -621,8 +621,10 @@ impl BowAttack { } } } +/// `LivingEntity.isHolding(Items.BOW)`: the bow can sit in either hand. fn holding_bow(m: &Mob) -> bool { m.extra.main_hand.as_deref() == Some("minecraft:bow") + || m.extra.off_hand.as_deref() == Some("minecraft:bow") } impl Goal for BowAttack { goal_clone!(); @@ -715,7 +717,10 @@ impl Goal for BowAttack { } else { self.attack_time -= 1; if self.attack_time <= 0 && self.see_time >= -60 { + // mob.startUsingItem(ProjectileUtil.getWeaponHoldingHand): + // the off hand when the main one doesn't hold the bow. m.extra.using_item = 1; + m.extra.using_off_hand = m.extra.main_hand.as_deref() != Some("minecraft:bow"); } } } From 4b5fa2ea6b86a7766c9503f01524681602732656 Mon Sep 17 00:00:00 2001 From: Fo <26b95bff27431f3eaab8@wajo.ai> Date: Sun, 25 Oct 2026 14:28:55 +0000 Subject: [PATCH 07/13] build: make horizon-dualsense compile on iOS hidapi 2.6.7 has no iOS backend, so the crate failed to build for aarch64-apple-ios (hidapi's build script looked for hid.h). Gate the hidapi and cpal dependencies plus all HID device/haptics code behind cfg(not(target_os = "ios")) and provide an inert stub on iOS (Link::start() is a no-op), mirroring how horizon-gamecontroller already compiles empty on iOS. Verified with cargo check -p horizon-dualsense --target aarch64-apple-ios: clean, no warnings. Host clippy/tests are left to CI (this sandbox has no C toolchain for the host target). Co-Authored-By: Fo <26b95bff27431f3eaab8@wajo.ai> --- crates/horizon-dualsense/Cargo.toml | 8 +++- crates/horizon-dualsense/src/device.rs | 47 ++++++++++++++++---- crates/horizon-dualsense/src/haptics_stub.rs | 21 +++++++++ crates/horizon-dualsense/src/lib.rs | 6 +++ 4 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 crates/horizon-dualsense/src/haptics_stub.rs diff --git a/crates/horizon-dualsense/Cargo.toml b/crates/horizon-dualsense/Cargo.toml index fe05b4f59..1a41e5703 100644 --- a/crates/horizon-dualsense/Cargo.toml +++ b/crates/horizon-dualsense/Cargo.toml @@ -7,10 +7,16 @@ rust-version = "1.85" description = "The DualSense's output over HID: rumble, adaptive triggers, lightbar and player LEDs" [dependencies] +log = "0.4" + +# hidapi has no iOS backend and its build script stops there, so the output's two +# dependencies go only to the targets that have one. On iOS the crate builds empty: pads +# are read through GameController (horizon-gamecontroller), which only reads, and the +# DualSense's own output waits for a desktop. +[target.'cfg(not(target_os = "ios"))'.dependencies] # MIT; bundles the C hidapi under its BSD licence option. hidraw on Linux (libudev, as gilrs), # IOKit on macOS (opened shared, so gilrs keeps reading the pad), the HID API on Windows. hidapi = { version = "2.6.7", default-features = false, features = ["linux-static-hidraw", "macos-shared-device"] } -log = "0.4" # HD haptics through the pad's own audio device (USB). cpal = "0.16" diff --git a/crates/horizon-dualsense/src/device.rs b/crates/horizon-dualsense/src/device.rs index 97c6ec72b..0b11ac415 100644 --- a/crates/horizon-dualsense/src/device.rs +++ b/crates/horizon-dualsense/src/device.rs @@ -1,14 +1,21 @@ //! The pad over hidapi, and the thread that writes to it: writes block (a Bluetooth report can //! take milliseconds), so the game only hands over what the pad should do. -use crate::{ - DEFAULT_LIGHTBAR, Output, PLAYER_1, TRIGGER_OFF, TriggerEffect, Vibration, is_dualsense, -}; +#[cfg(not(target_os = "ios"))] +use crate::{DEFAULT_LIGHTBAR, Output, PLAYER_1, Vibration, is_dualsense}; +use crate::{TRIGGER_OFF, TriggerEffect}; +#[cfg(not(target_os = "ios"))] use hidapi::{BusType, HidApi, HidDevice, HidResult}; use std::sync::Arc; -use std::sync::atomic::{AtomicBool, AtomicU8, Ordering}; -use std::sync::mpsc::{self, RecvTimeoutError, Sender}; +#[cfg(not(target_os = "ios"))] +use std::sync::atomic::AtomicBool; +use std::sync::atomic::{AtomicU8, Ordering}; +use std::sync::mpsc::Sender; +#[cfg(not(target_os = "ios"))] +use std::sync::mpsc::{self, RecvTimeoutError}; use std::thread::JoinHandle; -use std::time::{Duration, Instant}; +use std::time::Duration; +#[cfg(not(target_os = "ios"))] +use std::time::Instant; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Transport { @@ -17,6 +24,7 @@ pub enum Transport { } /// An open DualSense. +#[cfg(not(target_os = "ios"))] pub struct DualSense { device: HidDevice, transport: Transport, @@ -34,6 +42,7 @@ pub fn bluetooth_allowed() -> bool { cfg!(target_os = "linux") || std::env::var_os("HORIZON_DUALSENSE_BT").is_some_and(|v| v == "1") } +#[cfg(not(target_os = "ios"))] impl DualSense { /// The first DualSense hidapi lists, USB before Bluetooth (as SDL); `None` when there is /// none, an error when it can't be opened (Linux without access to its hidraw node). @@ -119,13 +128,17 @@ impl Default for State { /// A vibration: the motors' levels (left, right), each for a while, in order. pub type Rumble = Vec<([u8; 2], Duration)>; +// On iOS no thread reads the queue (the Link never opens); the variants stay so the +// Link's API is the same everywhere. +#[cfg_attr(target_os = "ios", allow(dead_code))] enum Message { State(State), Rumble(Rumble), Scan, } -/// The writer thread. Dropping it frees the triggers and stops the motors before it ends. +/// The output thread. Dropping it frees the triggers and stops the motors before it ends; on +/// iOS there is none (no hidapi backend) and the Link stays closed. pub struct Link { tx: Option>, /// 0: no pad open, else 1 + the transport. @@ -135,6 +148,7 @@ pub struct Link { impl Link { /// Start the thread and look for a DualSense. + #[cfg(not(target_os = "ios"))] pub fn start() -> Link { let (tx, rx) = mpsc::channel(); let open = Arc::new(AtomicU8::new(0)); @@ -151,6 +165,17 @@ impl Link { } } + /// No output on iOS: hidapi has no backend there, and iOS reads pads through + /// GameController (horizon-gamecontroller), which only reads. The Link never opens. + #[cfg(target_os = "ios")] + pub fn start() -> Link { + Link { + tx: None, + open: Arc::new(AtomicU8::new(0)), + thread: None, + } + } + /// The pad's transport while one is open and taking reports. pub fn open(&self) -> Option { match self.open.load(Ordering::Relaxed) { @@ -194,8 +219,10 @@ impl Drop for Link { /// Looks for the pad this many more times, a second apart, after a scan finds nothing (its /// hidraw node may appear after the controller does). +#[cfg(not(target_os = "ios"))] const SCAN_TRIES: u32 = 5; +#[cfg(not(target_os = "ios"))] struct Writer { api: Option, pad: Option, @@ -213,6 +240,7 @@ struct Writer { next_scan: Instant, } +#[cfg(not(target_os = "ios"))] #[derive(Clone, Copy, Debug, PartialEq)] enum Lights { /// Over Bluetooth, until the pad's clock says its animation is over (or this long after @@ -225,11 +253,13 @@ enum Lights { /// The pad's sensor clock once its Bluetooth connection animation is over (SDL_hidapi_ps5.c's /// `HIDAPI_DriverPS5_CheckPendingLEDReset`). +#[cfg(not(target_os = "ios"))] const ANIMATION_OVER: u32 = 10_200_000; /// The sensor clock of a Bluetooth input report 0x31: its state block starts at byte 2 and /// holds the clock at 27..31, little-endian (SDL's `PS5StatePacketCommon_t`, the kernel's /// `dualsense_input_report`). +#[cfg(not(target_os = "ios"))] fn bluetooth_clock(report: &[u8]) -> Option { match report { [0x31, _, state @ ..] if state.len() >= 31 => { @@ -239,6 +269,7 @@ fn bluetooth_clock(report: &[u8]) -> Option { } } +#[cfg(not(target_os = "ios"))] impl Writer { fn new(open: Arc) -> Self { Writer { @@ -451,7 +482,7 @@ impl Writer { } } -#[cfg(test)] +#[cfg(all(test, not(target_os = "ios")))] mod tests { use super::*; diff --git a/crates/horizon-dualsense/src/haptics_stub.rs b/crates/horizon-dualsense/src/haptics_stub.rs new file mode 100644 index 000000000..7afc944ca --- /dev/null +++ b/crates/horizon-dualsense/src/haptics_stub.rs @@ -0,0 +1,21 @@ +//! No HD haptics on iOS: the trick plays vibrations through the pad's own four-channel audio +//! device over USB, and a phone has neither that device nor the audio stack the real module +//! needs. The motors' rumble through [`crate::Link`] covers vibration instead. + +/// The pad's audio output, playing the queued samples (left, right actuator). +pub struct Haptics; + +impl Haptics { + /// The DualSense's audio device, if one is there with its four channels (USB). A phone + /// has none. + pub fn open() -> Option { + None + } + + /// Play a vibration (heavy and light levels, 0..1, each for a while), replacing the one + /// playing. Nothing plays on iOS. + pub fn play(&self, _steps: &[(f32, f32, std::time::Duration)]) {} + + /// Stop at once. Nothing plays on iOS. + pub fn stop(&self) {} +} diff --git a/crates/horizon-dualsense/src/lib.rs b/crates/horizon-dualsense/src/lib.rs index 438d8f6fe..80831ee00 100644 --- a/crates/horizon-dualsense/src/lib.rs +++ b/crates/horizon-dualsense/src/lib.rs @@ -1,12 +1,18 @@ //! The DualSense's output report, built by hand (docs/controllers.md "DualSense output"): the //! compatible-vibration motors, the adaptive triggers, the lightbar and the player LEDs. Gilrs //! keeps reading the pad; this crate only writes to it, over hidapi ([`device`]). +//! On iOS the crate builds without hidapi, which has no backend there: [`Link`] never opens, +//! and the pad is read through GameController, which only reads. //! //! The byte layout is the one documented by the Linux kernel's `hid-playstation.c` and SDL's //! `SDL_hidapi_ps5.c`: a 47-byte block shared by both transports, sent as report 0x02 over USB //! and as report 0x31 over Bluetooth, where a sequence tag leads it and a CRC-32 (seeded with //! the byte 0xA2) closes it. pub mod device; +#[cfg(not(target_os = "ios"))] +pub mod haptics; +#[cfg(target_os = "ios")] +#[path = "haptics_stub.rs"] pub mod haptics; pub mod trigger; From d9360338f655668351008f323e6181baf44ab7d0 Mon Sep 17 00:00:00 2001 From: Joansitoh Date: Sun, 25 Oct 2026 16:33:35 +0100 Subject: [PATCH 08/13] Show item lore in tooltips with vanilla purple italic styles. Stack tooltips skipped minecraft:lore entirely; draw the component lines as Text so colours and explicit non-italic spans survive. --- crates/horizon-client/src/game/beacon.rs | 7 +- crates/horizon-client/src/game/loom.rs | 9 +- crates/horizon-client/src/game/recipe_book.rs | 21 ++- crates/horizon-client/src/game/stations.rs | 134 ++++++++++++------ crates/horizon-client/src/item_tooltip.rs | 56 +++++++- 5 files changed, 167 insertions(+), 60 deletions(-) diff --git a/crates/horizon-client/src/game/beacon.rs b/crates/horizon-client/src/game/beacon.rs index c8a0bcba6..24ead3a3d 100644 --- a/crates/horizon-client/src/game/beacon.rs +++ b/crates/horizon-client/src/game/beacon.rs @@ -519,7 +519,12 @@ impl Game<'_> { self.draw_tooltip_lines(batch, &lines, self.cursor.0, self.cursor.1); } else if let Some(key) = tooltip { let text = self.translate(&key, &key); - self.draw_tooltip_lines(batch, &[(text, u32::MAX)], self.cursor.0, self.cursor.1); + self.draw_tooltip_lines( + batch, + &[(horizon_client::text::Text::literal(text), u32::MAX)], + self.cursor.0, + self.cursor.1, + ); } } /// `BeaconRenderer`: each section's rotating solid beam and its glow. diff --git a/crates/horizon-client/src/game/loom.rs b/crates/horizon-client/src/game/loom.rs index ef49c8cf1..3d69aaca6 100644 --- a/crates/horizon-client/src/game/loom.rs +++ b/crates/horizon-client/src/game/loom.rs @@ -218,7 +218,7 @@ impl Game<'_> { oy: f32, draws: &[ScreenDraw], background: bool, - ) -> Option> { + ) -> Option> { let atlas = &self.gui.atlas; let mut tooltip = None; let mut sheet: Option = None; @@ -261,7 +261,10 @@ impl Game<'_> { .. } => self.draw_banner_result(batch, ox + *x0 as f32, oy + *y0 as f32, base, layers), ScreenDraw::Tooltip { key } => { - tooltip = Some(vec![(self.translate(key, key), u32::MAX)]); + tooltip = Some(vec![( + horizon_client::text::Text::literal(self.translate(key, key)), + u32::MAX, + )]); } ScreenDraw::SpriteOf { id } => sheet = Some(id.clone()), ScreenDraw::Fill { @@ -314,7 +317,7 @@ impl Game<'_> { ox: f32, oy: f32, local: (f32, f32), - ) -> Option> { + ) -> Option> { let s = self.station.as_ref()?; let l = &s.loom; let dye = s.inputs[1] diff --git a/crates/horizon-client/src/game/recipe_book.rs b/crates/horizon-client/src/game/recipe_book.rs index d3c14ffc7..2536c3e03 100644 --- a/crates/horizon-client/src/game/recipe_book.rs +++ b/crates/horizon-client/src/game/recipe_book.rs @@ -1163,8 +1163,12 @@ impl Game<'_> { } /// Paints recipe book calls; returns the first tooltip set (vanilla keeps /// the first one a frame asks for). - fn paint_book(&mut self, batch: &mut HudBatch, calls: &[Drawn]) -> Option> { - let mut tooltip: Option> = None; + fn paint_book( + &mut self, + batch: &mut HudBatch, + calls: &[Drawn], + ) -> Option> { + let mut tooltip: Option> = None; for d in calls { let start = batch.vertices.len(); let atlas = &self.gui.atlas; @@ -1259,7 +1263,14 @@ impl Game<'_> { tooltip = Some( lines .iter() - .map(|l| (l.iter().map(|r| r.text.as_str()).collect(), u32::MAX)) + .map(|l| { + ( + horizon_client::text::Text::literal( + l.iter().map(|r| r.text.as_str()).collect::(), + ), + u32::MAX, + ) + }) .collect(), ); } @@ -1269,10 +1280,10 @@ impl Game<'_> { let mut lines = self.stack_tooltip(stack); if *more { lines.push(( - self.translate( + horizon_client::text::Text::literal(self.translate( "gui.recipebook.moreRecipes", "Right Click for More", - ), + )), u32::MAX, )); } diff --git a/crates/horizon-client/src/game/stations.rs b/crates/horizon-client/src/game/stations.rs index ffe56d699..fd7bd2642 100644 --- a/crates/horizon-client/src/game/stations.rs +++ b/crates/horizon-client/src/game/stations.rs @@ -1096,7 +1096,7 @@ impl Game<'_> { } let (ox, oy) = self.inventory_origin(batch); let local = (self.cursor.0 - ox, self.cursor.1 - oy); - let mut tooltip: Option> = None; + let mut tooltip: Option> = None; { let atlas = &self.gui.atlas; batch.fill( @@ -1345,16 +1345,19 @@ impl Game<'_> { let clue = self .translate("container.enchant.clue", "%s . . . ?") .replace("%s", &name); - let mut lines = vec![(clue, u32::MAX)]; + let mut lines = + vec![(horizon_client::text::Text::literal(clue), u32::MAX)]; if !self.creative { - lines.push((String::new(), u32::MAX)); + lines.push((horizon_client::text::Text::literal(""), u32::MAX)); if level < cost { lines.push(( - self.translate( - "container.enchant.level.requirement", - "Level Requirement: %s", - ) - .replace("%s", &cost.to_string()), + horizon_client::text::Text::literal( + self.translate( + "container.enchant.level.requirement", + "Level Requirement: %s", + ) + .replace("%s", &cost.to_string()), + ), rgba(255, 85, 85, 255), )); } else { @@ -1372,7 +1375,7 @@ impl Game<'_> { .replace("%s", &n.to_string()) }; lines.push(( - lapis, + horizon_client::text::Text::literal(lapis), if gold >= n as i32 { rgba(170, 170, 170, 255) } else { @@ -1391,7 +1394,10 @@ impl Game<'_> { ) .replace("%s", &n.to_string()) }; - lines.push((levels, rgba(170, 170, 170, 255))); + lines.push(( + horizon_client::text::Text::literal(levels), + rgba(170, 170, 170, 255), + )); } } tooltip = Some(lines); @@ -1500,10 +1506,10 @@ impl Game<'_> { ); if inside(local, 65.0, 46.0, 28.0, 21.0) { tooltip = Some(vec![( - self.translate( + horizon_client::text::Text::literal(self.translate( "container.upgrade.error_tooltip", "Item can't be upgraded this way", - ), + )), u32::MAX, )]); } @@ -1630,9 +1636,12 @@ impl Game<'_> { // ---------------------------------------------------------------- tooltips - /// `ItemStack.getTooltipLines` subset: name in rarity colour, potion - /// effects, enchantments (gray, curses red), stored enchantments, trims. - pub(super) fn stack_tooltip(&self, stack: &ItemStack) -> Vec<(String, u32)> { + /// `ItemStack.getTooltipLines` subset: name in rarity colour, lore, + /// potion effects, enchantments (gray, curses red), stored enchantments, trims. + pub(super) fn stack_tooltip( + &self, + stack: &ItemStack, + ) -> Vec<(horizon_client::text::Text, u32)> { let e: &Enchantments = &self.res.stations().enchantments; let props = e.props(&stack.item); let rarity = horizon_client::item_tooltip::rarity( @@ -1663,24 +1672,33 @@ impl Game<'_> { let display = horizon_client::item_tooltip::TooltipDisplay::for_stack(stack); let mut lines = Vec::new(); if display.name_visible(self.screen == Screen::Creative) { - lines.push((name, color)); + lines.push((horizon_client::text::Text::legacy(&name), color)); + } + // ItemLore.addToTooltip: after the name, before other component lines. + if display.shows("minecraft:lore") { + for text in horizon_client::item_tooltip::lore_texts(stack) { + lines.push((text, u32::MAX)); + } } let translate = |k: &str| e.translate(k).map(str::to_owned); + let push = |lines: &mut Vec<(horizon_client::text::Text, u32)>, s: String, c: u32| { + lines.push((horizon_client::text::Text::legacy(&s), c)); + }; // ItemContainerContents.addToTooltip. let hover_name = |s: &ItemStack| { s.custom_name() .map_or_else(|| self.pack.names.item(&s.item), str::to_owned) }; if display.shows("minecraft:container") { - for line in + for text in horizon_client::item_tooltip::container_lines(stack, &hover_name, &translate) { - lines.push((line, u32::MAX)); + push(&mut lines, text, u32::MAX); } } // Fireworks / FireworkExplosion.addToTooltip. - for line in horizon_client::item_tooltip::firework_lines(stack, &translate) { - lines.push((line, rgba(170, 170, 170, 255))); + for text in horizon_client::item_tooltip::firework_lines(stack, &translate) { + push(&mut lines, text, rgba(170, 170, 170, 255)); } if display.shows("minecraft:potion_contents") && (stack.item.ends_with("potion") || &*stack.item == "minecraft:tipped_arrow") @@ -1690,7 +1708,7 @@ impl Game<'_> { "minecraft:tipped_arrow" => 0.125, _ => 1.0, }; - for (line, cat) in brewing::tooltip(stack.potion(), scale, &|k| { + for (text, cat) in brewing::tooltip(stack.potion(), scale, &|k| { e.translate(k).map(str::to_owned) }) { let c = match cat { @@ -1698,18 +1716,19 @@ impl Game<'_> { brewing::Category::Harmful => rgba(255, 85, 85, 255), brewing::Category::Neutral => rgba(170, 170, 170, 255), }; - lines.push((line, c)); + push(&mut lines, text, c); } } if display.shows("minecraft:trim") && let Some((material, pattern)) = stack.data().and_then(|d| d.trim.clone()) { - lines.push(( + push( + &mut lines, e.translate("item.minecraft.smithing_template.upgrade") .unwrap_or("Upgrade:") .to_owned(), rgba(170, 170, 170, 255), - )); + ); let short = |s: &str| s.trim_start_matches("minecraft:").to_owned(); let p = e .translate(&format!("trim_pattern.minecraft.{}", short(&pattern))) @@ -1717,38 +1736,44 @@ impl Game<'_> { let m = e .translate(&format!("trim_material.minecraft.{}", short(&material))) .map_or_else(|| short(&material), str::to_owned); - lines.push((format!(" {p}"), rgba(170, 170, 170, 255))); - lines.push((format!(" {m}"), rgba(170, 170, 170, 255))); + push(&mut lines, format!(" {p}"), rgba(170, 170, 170, 255)); + push(&mut lines, format!(" {m}"), rgba(170, 170, 170, 255)); } if display.shows("minecraft:stored_enchantments") { for (text, curse) in e.tooltip(stack.stored_enchantments()) { - lines.push(( + push( + &mut lines, text, if curse { rgba(255, 85, 85, 255) } else { rgba(170, 170, 170, 255) }, - )); + ); } } if display.shows("minecraft:enchantments") { for (text, curse) in e.tooltip(stack.enchantments()) { - lines.push(( + push( + &mut lines, text, if curse { rgba(255, 85, 85, 255) } else { rgba(170, 170, 170, 255) }, - )); + ); } } // BannerPatternLayers.addToTooltip: up to six layer names. if display.shows("minecraft:banner_patterns") { for layer in horizon_client::banner::tooltip_layers(stack).iter().take(6) { let key = self.res.stations().banners.layer_key(layer); - lines.push((self.translate(&key, &key), rgba(170, 170, 170, 255))); + push( + &mut lines, + self.translate(&key, &key), + rgba(170, 170, 170, 255), + ); } } // Spawner.appendHoverText: what a spawner or trial spawner item spawns. @@ -1762,15 +1787,15 @@ impl Game<'_> { match block_entity_item::spawner_entity(stack) { Some(id) => { let key = format!("entity.{}", id.replacen(':', ".", 1)); - lines.push((self.translate(&key, &id), gray)); + push(&mut lines, self.translate(&key, &id), gray); } None => { - lines.push((String::new(), u32::MAX)); + push(&mut lines, String::new(), u32::MAX); let desc1 = self.translate("block.minecraft.spawner.desc1", "Interact with Spawn Egg:"); - lines.push((desc1, gray)); + push(&mut lines, desc1, gray); let desc2 = self.translate("block.minecraft.spawner.desc2", "Sets Mob Type"); - lines.push((format!(" {desc2}"), rgba(85, 85, 255, 255))); + push(&mut lines, format!(" {desc2}"), rgba(85, 85, 255, 255)); } } } @@ -1798,11 +1823,13 @@ impl Game<'_> { horizon_client::attack_strength::BASE_ATTACK_SPEED, ), ]; - lines.extend(horizon_client::item_tooltip::attribute_lines( + for (text, c) in horizon_client::item_tooltip::attribute_lines( &info.modifiers, Some(player_base), &translate, - )); + ) { + push(&mut lines, text, c); + } } if display.shows("minecraft:damage") && let Some(info) = self.res.items().get(&stack.item) @@ -1810,14 +1837,15 @@ impl Game<'_> { && stack.damage > 0 && self.options_advanced_tooltips() { - lines.push(( + push( + &mut lines, format!( "Durability: {} / {}", info.max_damage - stack.damage, info.max_damage ), u32::MAX, - )); + ); } // ItemStack.OP_NBT_WARNING, for a player with game master permission. if self.ui.registries.permission >= 2 && block_entity_item::op_warning(stack) { @@ -1832,7 +1860,11 @@ impl Game<'_> { "Do not use unless you know the exact contents!", ), ] { - lines.push((self.translate(key, fallback), rgba(255, 85, 85, 255))); + push( + &mut lines, + self.translate(key, fallback), + rgba(255, 85, 85, 255), + ); } } lines @@ -1863,20 +1895,27 @@ impl Game<'_> { self.settings.file.bool("advancedItemTooltips") } /// `TooltipRenderUtil`: dark box with the purple border, first line spaced. - pub(super) fn draw_tooltip_lines( + pub(super) fn draw_tooltip_lines>( &self, batch: &mut HudBatch, - lines: &[(String, u32)], + lines: &[(T, u32)], x: f32, y: f32, ) { if lines.is_empty() { return; } + let lines: Vec<_> = lines + .iter() + .map(|(text, color)| { + let text: horizon_client::text::Text = text.clone().into(); + (text.resolve_legacy(), *color) + }) + .collect(); let atlas = &self.gui.atlas; let w = lines .iter() - .map(|(t, _)| HudBatch::text_width(atlas, t)) + .map(|(t, _)| atlas.font.width_text(t)) .fold(0.0, f32::max); let h = if lines.len() == 1 { 8.0 @@ -1929,7 +1968,7 @@ impl Game<'_> { ); let mut ty = y; for (i, (text, color)) in lines.iter().enumerate() { - batch.text(atlas, text, x, ty, *color, true); + batch.text_styled(atlas, text, x, ty, *color, true); ty += if i == 0 { 12.0 } else { 10.0 }; } } @@ -1946,7 +1985,12 @@ impl Game<'_> { let lines = self.stack_tooltip(&stack); self.draw_tooltip_lines(batch, &lines, self.cursor.0, self.cursor.1); } else if let Some(text) = self.crafter_tooltip(slot) { - self.draw_tooltip_lines(batch, &[(text, u32::MAX)], self.cursor.0, self.cursor.1); + self.draw_tooltip_lines( + batch, + &[(horizon_client::text::Text::literal(text), u32::MAX)], + self.cursor.0, + self.cursor.1, + ); } } diff --git a/crates/horizon-client/src/item_tooltip.rs b/crates/horizon-client/src/item_tooltip.rs index ca6ff481b..6e51de391 100644 --- a/crates/horizon-client/src/item_tooltip.rs +++ b/crates/horizon-client/src/item_tooltip.rs @@ -487,23 +487,31 @@ pub fn lines( ) -> Vec { let mut lines = vec![name_line(stack, translate)]; if TooltipDisplay::for_stack(stack).shows("minecraft:lore") { - lines.extend(lore_lines(stack)); + lines.extend(lore_texts(stack).into_iter().map(|t| t.plain())); } lines.extend(detail_lines(stack, info, translate)); lines } -/// `LoreComponent.addToTooltip`: the saved component lines, as plain text. -fn lore_lines(stack: &ItemStack) -> Vec { +/// `ItemLore.addToTooltip`: each lore component under dark purple italic, with +/// the component's own styles (including explicit `false`) winning on children. +pub fn lore_texts(stack: &ItemStack) -> Vec { let Some(Tag::List(entries)) = stack.data().and_then(|d| d.other("minecraft:lore")) else { return Vec::new(); }; + let base = crate::text::Style { + color: Some(crate::text::DARK_PURPLE), + italic: Some(true), + ..Default::default() + }; entries .iter() .map(|entry| { - let json = crate::scoreboard::tag_to_json(entry); - let text = crate::component::to_text(&json, &mut |s| crate::text::Text::literal(s)); - text.plain() + let mut text = crate::entity_nbt::name_text(entry).resolve_legacy(); + for span in &mut text.spans { + span.style.inherit(&base); + } + text }) .collect() } @@ -512,6 +520,42 @@ fn lore_lines(stack: &ItemStack) -> Vec { mod tests { use super::*; + #[test] + fn lore_keeps_component_colours_under_dark_purple_italic() { + let mut stack = ItemStack::new("minecraft:stick", 1); + stack.data_mut().set_other( + "minecraft:lore", + Some(Tag::List(vec![ + Tag::compound([ + ("text", Tag::String("Gold line".into())), + ("color", Tag::String("gold".into())), + ("italic", Tag::Byte(0)), + ]), + Tag::String("Plain lore".into()), + ])), + ); + let lines = lore_texts(&stack); + assert_eq!(lines.len(), 2); + assert_eq!(lines[0].plain(), "Gold line"); + assert_eq!(lines[0].spans[0].style.color, Some(crate::text::GOLD)); + assert!(!lines[0].spans[0].style.is_italic()); + assert_eq!(lines[1].plain(), "Plain lore"); + assert_eq!( + lines[1].spans[0].style.color, + Some(crate::text::DARK_PURPLE) + ); + assert!(lines[1].spans[0].style.is_italic()); + assert!(TooltipDisplay::for_stack(&stack).shows("minecraft:lore")); + stack.data_mut().set_other( + "minecraft:tooltip_display", + Some(Tag::compound([( + "hidden_components", + Tag::List(vec![Tag::String("minecraft:lore".into())]), + )])), + ); + assert!(!TooltipDisplay::for_stack(&stack).shows("minecraft:lore")); + } + #[test] fn tooltip_display_controls_name_and_component_visibility() { let mut stack = ItemStack::new("minecraft:diamond_sword", 1); From 0609fb2bebdc082c335361c3da65a188a8f77ef0 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 17:30:37 +0100 Subject: [PATCH 09/13] Tooltip: lore after the enchantments, as ItemStack.addDetailsToTooltip Vanilla adds LORE after CONTAINER, BANNER_PATTERNS, FIREWORKS, POTION_CONTENTS, TRIM and the enchantments, and before the attribute modifiers, not right under the name. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/stations.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/horizon-client/src/game/stations.rs b/crates/horizon-client/src/game/stations.rs index fd7bd2642..5d8a2c3fe 100644 --- a/crates/horizon-client/src/game/stations.rs +++ b/crates/horizon-client/src/game/stations.rs @@ -1674,12 +1674,6 @@ impl Game<'_> { if display.name_visible(self.screen == Screen::Creative) { lines.push((horizon_client::text::Text::legacy(&name), color)); } - // ItemLore.addToTooltip: after the name, before other component lines. - if display.shows("minecraft:lore") { - for text in horizon_client::item_tooltip::lore_texts(stack) { - lines.push((text, u32::MAX)); - } - } let translate = |k: &str| e.translate(k).map(str::to_owned); let push = |lines: &mut Vec<(horizon_client::text::Text, u32)>, s: String, c: u32| { lines.push((horizon_client::text::Text::legacy(&s), c)); @@ -1776,6 +1770,13 @@ impl Game<'_> { ); } } + // ItemLore.addToTooltip: after the enchantments, before the attributes + // (ItemStack.addDetailsToTooltip). + if display.shows("minecraft:lore") { + for text in horizon_client::item_tooltip::lore_texts(stack) { + lines.push((text, u32::MAX)); + } + } // Spawner.appendHoverText: what a spawner or trial spawner item spawns. if display.shows("minecraft:block_entity_data") && matches!( From 5ee1130719904c4101a0b13748fc53b1adaab1ee Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 17:53:13 +0100 Subject: [PATCH 10/13] horizon-dualsense: iOS comments name only what exists The repo has no horizon-gamecontroller crate, and on iOS the Link never opens, so no rumble covers vibration there. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-dualsense/Cargo.toml | 5 ++--- crates/horizon-dualsense/src/device.rs | 3 +-- crates/horizon-dualsense/src/haptics_stub.rs | 5 ++--- crates/horizon-dualsense/src/lib.rs | 3 +-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/crates/horizon-dualsense/Cargo.toml b/crates/horizon-dualsense/Cargo.toml index 1a41e5703..feb25026b 100644 --- a/crates/horizon-dualsense/Cargo.toml +++ b/crates/horizon-dualsense/Cargo.toml @@ -10,9 +10,8 @@ description = "The DualSense's output over HID: rumble, adaptive triggers, light log = "0.4" # hidapi has no iOS backend and its build script stops there, so the output's two -# dependencies go only to the targets that have one. On iOS the crate builds empty: pads -# are read through GameController (horizon-gamecontroller), which only reads, and the -# DualSense's own output waits for a desktop. +# dependencies go only to the targets that have one. On iOS the crate builds without +# output: the Link never opens. [target.'cfg(not(target_os = "ios"))'.dependencies] # MIT; bundles the C hidapi under its BSD licence option. hidraw on Linux (libudev, as gilrs), # IOKit on macOS (opened shared, so gilrs keeps reading the pad), the HID API on Windows. diff --git a/crates/horizon-dualsense/src/device.rs b/crates/horizon-dualsense/src/device.rs index 0b11ac415..f8e544ea6 100644 --- a/crates/horizon-dualsense/src/device.rs +++ b/crates/horizon-dualsense/src/device.rs @@ -165,8 +165,7 @@ impl Link { } } - /// No output on iOS: hidapi has no backend there, and iOS reads pads through - /// GameController (horizon-gamecontroller), which only reads. The Link never opens. + /// No output on iOS: hidapi has no backend there. The Link never opens. #[cfg(target_os = "ios")] pub fn start() -> Link { Link { diff --git a/crates/horizon-dualsense/src/haptics_stub.rs b/crates/horizon-dualsense/src/haptics_stub.rs index 7afc944ca..dc4e61667 100644 --- a/crates/horizon-dualsense/src/haptics_stub.rs +++ b/crates/horizon-dualsense/src/haptics_stub.rs @@ -1,6 +1,5 @@ -//! No HD haptics on iOS: the trick plays vibrations through the pad's own four-channel audio -//! device over USB, and a phone has neither that device nor the audio stack the real module -//! needs. The motors' rumble through [`crate::Link`] covers vibration instead. +//! No HD haptics on iOS: they play through the pad's own four-channel audio device over USB, +//! which needs cpal, and cpal is left out there with hidapi (see Cargo.toml). /// The pad's audio output, playing the queued samples (left, right actuator). pub struct Haptics; diff --git a/crates/horizon-dualsense/src/lib.rs b/crates/horizon-dualsense/src/lib.rs index 80831ee00..4ae55de9a 100644 --- a/crates/horizon-dualsense/src/lib.rs +++ b/crates/horizon-dualsense/src/lib.rs @@ -1,8 +1,7 @@ //! The DualSense's output report, built by hand (docs/controllers.md "DualSense output"): the //! compatible-vibration motors, the adaptive triggers, the lightbar and the player LEDs. Gilrs //! keeps reading the pad; this crate only writes to it, over hidapi ([`device`]). -//! On iOS the crate builds without hidapi, which has no backend there: [`Link`] never opens, -//! and the pad is read through GameController, which only reads. +//! On iOS the crate builds without hidapi, which has no backend there: [`Link`] never opens. //! //! The byte layout is the one documented by the Linux kernel's `hid-playstation.c` and SDL's //! `SDL_hidapi_ps5.c`: a 47-byte block shared by both transports, sent as report 0x02 over USB From 90eda915d5dec7d02c929ec867262bfe867d396f Mon Sep 17 00:00:00 2001 From: Joansitoh Date: Sun, 25 Oct 2026 18:58:52 +0100 Subject: [PATCH 11/13] Add a lore tooltip harness against ItemLore.addToTooltip. The styled lines have to keep matching vanilla, including an explicit non-italic span and a lore component hidden by tooltip_display. --- .../examples/probe/lore_tooltip_fixture.rs | 53 +++++++++++++++++ crates/horizon-client/examples/probe/main.rs | 2 + .../parity/VanillaLoreTooltipOracle.java | 58 +++++++++++++++++++ tools/test_lore_tooltip_parity.py | 41 +++++++++++++ 4 files changed, 154 insertions(+) create mode 100644 crates/horizon-client/examples/probe/lore_tooltip_fixture.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLoreTooltipOracle.java create mode 100644 tools/test_lore_tooltip_parity.py diff --git a/crates/horizon-client/examples/probe/lore_tooltip_fixture.rs b/crates/horizon-client/examples/probe/lore_tooltip_fixture.rs new file mode 100644 index 000000000..350d9be81 --- /dev/null +++ b/crates/horizon-client/examples/probe/lore_tooltip_fixture.rs @@ -0,0 +1,53 @@ +//! Lore tooltip companion for tools/test_lore_tooltip_parity.py: the spans +//! `item_tooltip::lore_texts` gives each stack (SNBT, one per line). +use horizon_client::{ + item_data::parse_stack, + item_tooltip::{TooltipDisplay, lore_texts}, +}; +use std::{error::Error, fmt::Write}; + +pub fn main() -> Result<(), Box> { + let args: Vec = crate::args().collect(); + let input = std::fs::read_to_string(&args[1])?; + let mut output = String::new(); + for line in input + .lines() + .filter(|l| !l.is_empty() && !l.starts_with('#')) + { + let stack = parse_stack(line)?.ok_or("empty stack")?; + let display = TooltipDisplay::for_stack(&stack); + if !display.shows("minecraft:lore") { + writeln!(output, "-")?; + continue; + } + let lines = lore_texts(&stack); + if lines.is_empty() { + writeln!(output, "-")?; + continue; + } + let mut rendered = Vec::new(); + for text in lines { + let mut spans = Vec::new(); + for span in &text.spans { + if span.text.is_empty() { + continue; + } + let style = &span.style; + spans.push(format!( + "{}\t{}\t{}\t{}\t{}\t{}\t{}", + span.text, + style.color.map(|c| c as i32).unwrap_or(-1), + style.bold == Some(true), + style.italic == Some(true), + style.underlined == Some(true), + style.strikethrough == Some(true), + style.obfuscated == Some(true), + )); + } + rendered.push(spans.join(" | ")); + } + writeln!(output, "{}", rendered.join(" || "))?; + } + std::fs::write(&args[2], output)?; + Ok(()) +} diff --git a/crates/horizon-client/examples/probe/main.rs b/crates/horizon-client/examples/probe/main.rs index f05c2a662..e80088fd0 100644 --- a/crates/horizon-client/examples/probe/main.rs +++ b/crates/horizon-client/examples/probe/main.rs @@ -49,6 +49,7 @@ mod input_probe; mod interaction_input_fixture; mod lan_probe; mod light_parity; +mod lore_tooltip_fixture; mod marker_particles_probe; mod menu_fixture; mod mipmap_probe; @@ -133,6 +134,7 @@ probes! { interaction_input_fixture, lan_probe, light_parity, + lore_tooltip_fixture, marker_particles_probe, menu_fixture, mipmap_probe, diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLoreTooltipOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLoreTooltipOracle.java new file mode 100644 index 000000000..462a8016a --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLoreTooltipOracle.java @@ -0,0 +1,58 @@ +package dev.horizonlab.parity; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Optional; +import net.minecraft.core.component.DataComponents; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.component.ItemLore; +import net.minecraft.world.item.component.TooltipDisplay; + +/** + * The styled lines {@code ItemLore.addToTooltip} adds, one stack (SNBT) per input + * line. Each line is its visited spans ({@code text, colour, bold, italic, + * underlined, strikethrough, obfuscated}); lines are separated by {@code ||}. + */ +public final class VanillaLoreTooltipOracle { + public static void main(String[] args) throws Exception { + ParityData.init(); + var context = Item.TooltipContext.of(ParityData.lookup); + var output = new ArrayList(); + for (String line : Files.readAllLines(Path.of(args[0]))) { + if (line.isBlank() || line.startsWith("#")) continue; + var stack = ParityData.stack(line); + var display = stack.getOrDefault(DataComponents.TOOLTIP_DISPLAY, TooltipDisplay.DEFAULT); + ItemLore lore = stack.get(DataComponents.LORE); + if (lore == null || !display.shows(DataComponents.LORE)) { + output.add("-"); + continue; + } + var lines = new ArrayList(); + lore.addToTooltip(context, component -> lines.add(spans(component)), TooltipFlag.NORMAL, stack); + output.add(lines.isEmpty() ? "-" : String.join(" || ", lines)); + } + Files.write(Path.of(args[1]), output); + } + + /** {@code Component.visit} from {@code Style.EMPTY}: the style a tooltip draws. */ + static String spans(Component component) { + var out = new StringBuilder(); + component.visit((style, text) -> { + if (text.isEmpty()) return Optional.empty(); + if (out.length() > 0) out.append(" | "); + int color = style.getColor() == null ? -1 : style.getColor().getValue(); + out.append(text).append('\t').append(color).append('\t') + .append(style.isBold()).append('\t') + .append(style.isItalic()).append('\t') + .append(style.isUnderlined()).append('\t') + .append(style.isStrikethrough()).append('\t') + .append(style.isObfuscated()); + return Optional.empty(); + }, Style.EMPTY); + return out.toString(); + } +} diff --git a/tools/test_lore_tooltip_parity.py b/tools/test_lore_tooltip_parity.py new file mode 100644 index 000000000..d262a3542 --- /dev/null +++ b/tools/test_lore_tooltip_parity.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +"""Compare item lore tooltip styles with the pinned vanilla client. + +Vanilla prints what ``ItemLore.addToTooltip`` adds after ``ComponentUtils.mergeStyles`` +with dark purple italic (VanillaLoreTooltipOracle). Horizon prints what +``item_tooltip::lore_texts`` gives (examples/probe/lore_tooltip_fixture). +""" +try: + from . import lab, oracle_harness as harness +except ImportError: + import lab, oracle_harness as harness + +# SNBT stacks. A lore line is a text component; italic:0b is an explicit false. +CASES = [ + '{id:"minecraft:stick",count:1}', + '{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'"Plain"\']}}', + '{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'{"text":"Gold","color":"gold","italic":0b}\']}}', + '{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'{"text":"A","extra":[{"text":"B","color":"aqua","italic":0b}]}\']}}', + '{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'"One"\',\'{"text":"Two","bold":1b}\']}}', + '{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'"Hidden"\'],"minecraft:tooltip_display":{hidden_components:["minecraft:lore"]}}}', + '{id:"minecraft:stick",count:1,components:{"minecraft:lore":[\'{"text":"Line","underlined":1b,"strikethrough":1b}\']}}', +] + + +def cases(build): + path = build / 'cases.txt' + path.write_text(''.join(line + '\n' for line in CASES)) + return path, len(CASES) + + +if __name__ == '__main__': + harness.differential( + 'lore-tooltip-parity', 'VanillaLoreTooltipOracle', 'lore_tooltip_fixture', cases, + 'Item lore tooltip lines: dark purple italic, child colours, explicit non-italic, and tooltip_display', + sources=[ + lab.ROOT / 'crates/horizon-client/src/item_tooltip.rs', + lab.ROOT / 'crates/horizon-client/src/item_data.rs', + lab.ROOT / 'crates/horizon-client/src/text.rs', + lab.ROOT / 'crates/horizon-client/src/component.rs', + ], + expected_lines=len(CASES)) From 9ec5f1ddbc31908eaa27735a01ecd8ba9cf44182 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 19:51:09 +0100 Subject: [PATCH 12/13] Rockets: a guest's boost rocket hurts them; fireworks sent to a server's clients FireworkRocketEntity.dealExplosionDamage hurts attachedToEntity with the full 5 + 2 per explosion: a guest's boost rocket now hurts that guest instead of nobody. The host's encoder (network_stack) now sends minecraft:fireworks and minecraft:firework_explosion too, so a rocket's flight duration and a star's explosion reach the server thread's window, LAN guests and a dedicated server's players; the creative slot encoder shares it. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/fireworks.rs | 15 ++++++-- crates/horizon-client/src/game/remote.rs | 21 +++--------- crates/horizon-client/src/lan/guest.rs | 38 +++++++++++++++++++++ 3 files changed, 55 insertions(+), 19 deletions(-) diff --git a/crates/horizon-client/src/game/fireworks.rs b/crates/horizon-client/src/game/fireworks.rs index 623e0e147..7838c9590 100644 --- a/crates/horizon-client/src/game/fireworks.rs +++ b/crates/horizon-client/src/game/fireworks.rs @@ -251,8 +251,19 @@ impl Game<'_> { let at = [r.position.x, r.position.y, r.position.z]; if !r.explosions.is_empty() { let damage = 5.0 + r.explosions.len() as f32 * 2.0; - if r.attached && r.guest.is_none() { - self.hurt_player_by("minecraft:fireworks", damage); + // The player it boosts takes the full damage, a guest as well. + if r.attached { + match r.guest { + None => self.hurt_player_by("minecraft:fireworks", damage), + Some(conn) => { + if let Some(mut host) = self.lan.take() { + self.as_guest(&mut host, conn, |g| { + g.hurt_player_by("minecraft:fireworks", damage); + }); + self.lan = Some(host); + } + } + } } let from = r.position; let hits: Vec<(u32, f32)> = { diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 5a8582ac9..d8b370af4 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -769,23 +769,10 @@ impl Game<'_> { horizon_protocol::item::Component::Int(s.damage as i32), )); } - if let Some((flight, explosions)) = s.data().and_then(|d| d.fireworks.clone()) { - stack.added.push(( - horizon_protocol::item::component::FIREWORKS, - horizon_protocol::item::Component::Fireworks { - flight: i32::from(flight), - explosions: explosions - .iter() - .map(|e| horizon_protocol::item::FireworkExplosion { - shape: e.shape as i32, - colors: e.colors.iter().map(|c| *c as i32).collect(), - fade: e.fade.iter().map(|c| *c as i32).collect(), - trail: e.trail, - twinkle: e.twinkle, - }) - .collect(), - }, - )); + if let Some(d) = s.data() { + stack + .added + .extend(horizon_client::lan::guest::firework_components(d)); } Some(stack) } diff --git a/crates/horizon-client/src/lan/guest.rs b/crates/horizon-client/src/lan/guest.rs index 440b58284..4bafe7866 100644 --- a/crates/horizon-client/src/lan/guest.rs +++ b/crates/horizon-client/src/lan/guest.rs @@ -431,6 +431,43 @@ impl Guest { } } +/// `FireworkExplosion.STREAM_CODEC`'s fields (`Shape` by its BY_ID order). +fn network_explosion( + e: &crate::particles::FireworkExplosion, +) -> horizon_protocol::item::FireworkExplosion { + horizon_protocol::item::FireworkExplosion { + shape: e.shape as i32, + colors: e.colors.iter().map(|c| *c as i32).collect(), + fade: e.fade.iter().map(|c| *c as i32).collect(), + trail: e.trail, + twinkle: e.twinkle, + } +} + +/// A rocket's `minecraft:fireworks` and a star's `minecraft:firework_explosion`. +pub fn firework_components( + d: &crate::item_data::StackData, +) -> Vec<(i32, horizon_protocol::item::Component)> { + use horizon_protocol::item::{Component, component}; + let mut out = Vec::new(); + if let Some((flight, explosions)) = &d.fireworks { + out.push(( + component::FIREWORKS, + Component::Fireworks { + flight: i32::from(*flight), + explosions: explosions.iter().map(network_explosion).collect(), + }, + )); + } + if let Some(e) = &d.firework_explosion { + out.push(( + component::FIREWORK_EXPLOSION, + Component::FireworkExplosion(network_explosion(e)), + )); + } + out +} + /// The off hand slot is conventionally 40 in saves and 45 in the menu. /// `synced_id` names an entry of a synced registry (enchantments, trim /// materials and patterns) by its id on this connection. @@ -521,6 +558,7 @@ fn network_stack( horizon_protocol::item::Component::Int(i32::from(mode)), )); } + stack.added.extend(firework_components(d)); // A loaded crossbow's ammunition. if !d.charged.is_empty() { let charged = d From a4a709c2d698788c30af6612d1870be9fc5e5763 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 22:16:18 +0100 Subject: [PATCH 13/13] Roadmap: OpenGL shipped in v0.2.63; three players' ideas kept by Ludovic One-command server install, launcher-style game menus (off by default), AppImage and a Nix flake. Co-Authored-By: Claude Opus 5.5 --- ROADMAP.md | 45 ++++++++++++++++++++++++----------- roadmap/roadmap.toml | 49 ++++++++++++++++++++++++++++++++++----- website/data/roadmap.json | 44 +++++++++++++++++++++++++++++++---- 3 files changed, 114 insertions(+), 24 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 7e4cc9937..a04eca2ce 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -16,7 +16,7 @@ Horizon is Minecraft: Java Edition 26.3 rewritten from scratch in Rust, so it ru - **Single player as a server: the last differences**: Single player now runs a small server in the background, as vanilla does. We are fixing what still behaves differently there; every fix also works for LAN and server players. - **Horizon's mod registry**: One place for mods, modpacks and resource packs made for Horizon: browse them on the website and install them from the launcher in one click. -**Next**: Microsoft sign-in (coming soon); CurseForge in the mod browser (coming soon); Fresh benchmarks against vanilla; Pistons push players and mobs; Horizon on Intel Macs; Faster world creation and entry on small CPUs; Servers that hold 20 TPS with 50 to 100 players; Low-end computers: Steam Deck, old Macs, 8 GB; Native upscaling; A batch of targeted optimisations; A Convert to Rust button for what isn't rewritten yet; Mods with code: machines, magic, mobs; Data packs in the mod browser; Prepare a version without Java; Server console, bans and a full admin API; Hosting polish: Windows service, safe updates; Guided hosting with Tailscale and an invite button; An official Docker image for servers; One single-player path: remove the in-frame world; Villages and combat, exactly as in vanilla; Choose the audio output device; Mods that read and change the world; Machines and blocks with inventories (API 0.4); Lua and other languages for mods; Well-known shader looks, rewritten for Horizon; A visible beta label; Wayland and Hyprland polish; A versioned agent-control protocol; Port mods with your own AI agent; Horizon on X (coming soon); Pipeline protection and a GitHub App for agents; Signed updates everywhere, installers included. +**Next**: Microsoft sign-in (coming soon); CurseForge in the mod browser (coming soon); Fresh benchmarks against vanilla; Pistons push players and mobs; Horizon on Intel Macs; Faster world creation and entry on small CPUs; Servers that hold 20 TPS with 50 to 100 players; Low-end computers: Steam Deck, old Macs, 8 GB; Native upscaling; A batch of targeted optimisations; A Convert to Rust button for what isn't rewritten yet; Mods with code: machines, magic, mobs; Data packs in the mod browser; Prepare a version without Java; Server console, bans and a full admin API; Hosting polish: Windows service, safe updates; Guided hosting with Tailscale and an invite button; An official Docker image for servers; One single-player path: remove the in-frame world; Villages and combat, exactly as in vanilla; Choose the audio output device; Mods that read and change the world; Machines and blocks with inventories (API 0.4); Lua and other languages for mods; Well-known shader looks, rewritten for Horizon; A visible beta label; Wayland and Hyprland polish; A versioned agent-control protocol; Port mods with your own AI agent; Horizon on X (coming soon); Pipeline protection and a GitHub App for agents; Signed updates everywhere, installers included; A server you install with one command. **How to help**: Play it and tell us what differs from vanilla (Discord or GitHub), run the benchmark on your computer, vote for what you want next, or pick one of the Help wanted items. @@ -374,6 +374,16 @@ More: [docs/server.md](docs/server.md) +#### A server you install with one command + +Install and run a Horizon dedicated server from a terminal with a single command, no launcher needed, for VPSes and headless machines. + +
Technical + +A player's idea (#horizon-ideas). `horizon-server` already runs headless; left: an install script (Linux/macOS shell, Windows PowerShell) that fetches the signed release, checks it, asks for or points at the player's own game files and starts the server, documented in [docs/hosting.md](docs/hosting.md). + +
+ ### Mods and API #### Mods that read and change the world @@ -790,18 +800,6 @@ Issue [#1709](https://github.com/ludovic111/horizon/issues/1709): aarch64 builds -#### OpenGL for old computers - -A way to play on old PCs and Linux machines that have no Vulkan or DirectX 12, through OpenGL. - -
Technical - -Players on older hardware ask whether Vulkan is the only way. Horizon draws with wgpu, which has an OpenGL backend; what is needed is to see which features hold up on it, how fast it runs, and a launcher switch like the DirectX 12 fallback that already ships. - -More: [docs/graphics.md](docs/graphics.md) - -
- #### Android, iOS and the browser Versions of Horizon for Android, iOS and web browsers. Nothing official yet; contributors have started the first pieces. @@ -812,6 +810,16 @@ No official build. Android was first closed as not planned, with touch controls, +#### AppImage and a Nix flake + +Install Horizon on any Linux distribution as an AppImage, and on NixOS through a Nix flake. + +
Technical + +A player's idea (#horizon-ideas). An AppImage of the launcher and game from the release workflow, and a flake.nix packaging the release binaries with their runtime libraries (Vulkan loader, X11/Wayland, ALSA), the way horizon-parity's NixOS setup runs them today. + +
+ ### Horizon extras #### A complete video studio inside the game @@ -824,6 +832,16 @@ Three stages. Recording: capture gameplay in a keypress with an encoder thread a +#### Game menus in the launcher's style + +An optional look for the game's own menus and options that matches the Horizon launcher. Off by default: the vanilla menus stay as they are. + +
Technical + +A player's idea (#horizon-ideas). A built-in resource pack or a Horizon setting that restyles the title, pause and options screens with the launcher's design tokens (crates/horizon-theme), following [docs/design-system.md](docs/design-system.md); off by default because it changes the vanilla look. + +
+ ### AI and agents #### An optional AI teammate @@ -936,6 +954,7 @@ Vanilla's `Chicken.aiStep` updates `flap` and `flapSpeed` when the chicken isn't ## Recently shipped +- **OpenGL for old computers** (v0.2.63): Horizon now starts on old PCs whose graphics card has no Vulkan or DirectX 12 driver: it switches to OpenGL by itself, and Options > Graphics can pick OpenGL by hand. [#1917](https://github.com/ludovic111/horizon/issues/1917) · [#1920](https://github.com/ludovic111/horizon/issues/1920) · [#1936](https://github.com/ludovic111/horizon/issues/1936) - **Server resource packs** (v0.2.48): Servers can send you their resource pack: Horizon asks, downloads it and applies it, like vanilla. [#1562](https://github.com/ludovic111/horizon/issues/1562) · [#1569](https://github.com/ludovic111/horizon/issues/1569) · [#1570](https://github.com/ludovic111/horizon/issues/1570) - **Single player on its own server thread** (v0.2.39): Single player runs on a server thread, as vanilla does, so the world keeps ticking smoothly while the window draws. [#1514](https://github.com/ludovic111/horizon/issues/1514) · [docs/server-levels.md](docs/server-levels.md) - **GPU occlusion culling on Macs** (v0.2.17): On Macs the GPU now skips terrain hidden behind hills and caves: 8 to 48% more frames per second at 32 chunks on an M4 Pro. [#1434](https://github.com/ludovic111/horizon/issues/1434) diff --git a/roadmap/roadmap.toml b/roadmap/roadmap.toml index 34ae8a955..669596fba 100644 --- a/roadmap/roadmap.toml +++ b/roadmap/roadmap.toml @@ -968,13 +968,15 @@ links = ["#1709"] [[item]] id = "opengl-fallback" title = "OpenGL for old computers" -status = "later" +status = "shipped" +shipped_in = "v0.2.63" area = "platforms" -plain = "A way to play on old PCs and Linux machines that have no Vulkan or DirectX 12, through OpenGL." -dev = """Players on older hardware ask whether Vulkan is the only way. Horizon draws with wgpu, which has an OpenGL \ -backend; what is needed is to see which features hold up on it, how fast it runs, and a launcher switch like \ -the DirectX 12 fallback that already ships.""" -links = ["docs/graphics.md"] +plain = """Horizon now starts on old PCs whose graphics card has no Vulkan or DirectX 12 driver: it switches to OpenGL \ +by itself, and Options > Graphics can pick OpenGL by hand.""" +dev = """wgpu's GL backend (WGL on Windows, EGL on Linux) as the last fallback after Vulkan and DirectX 12 (#1917), \ +sprite arrays and CPU sprite animation for drivers without compute (#1920), no indirect draws below GL 4.3 \ +(#1936). Minimum OpenGL 3.3 core. Shader packs don't run on it yet.""" +links = ["#1917", "#1920", "#1936"] [[item]] id = "phones-and-browser" @@ -1187,3 +1189,38 @@ plain = """The launcher's Servers page creates, starts, backs up and updates a H invites friends.""" dev = """The launcher's Servers page (#1026) over `horizon-server` (docs/hosting.md).""" links = ["#1026", "docs/hosting.md"] + +[[item]] +id = "cli-server-install" +title = "A server you install with one command" +status = "next" +area = "servers" +plain = """Install and run a Horizon dedicated server from a terminal with a single command, no launcher needed, for \ +VPSes and headless machines.""" +dev = """A player's idea (#horizon-ideas). `horizon-server` already runs headless; left: an install script \ +(Linux/macOS shell, Windows PowerShell) that fetches the signed release, checks it, asks for or points at the \ +player's own game files and starts the server, documented in docs/hosting.md.""" +links = ["docs/hosting.md"] + +[[item]] +id = "launcher-look-menus" +title = "Game menus in the launcher's style" +status = "later" +area = "extras" +plain = """An optional look for the game's own menus and options that matches the Horizon launcher. Off by default: \ +the vanilla menus stay as they are.""" +dev = """A player's idea (#horizon-ideas). A built-in resource pack or a Horizon setting that restyles the title, \ +pause and options screens with the launcher's design tokens (crates/horizon-theme), following \ +docs/design-system.md; off by default because it changes the vanilla look.""" +links = ["docs/design-system.md"] + +[[item]] +id = "linux-packages" +title = "AppImage and a Nix flake" +status = "later" +area = "platforms" +plain = """Install Horizon on any Linux distribution as an AppImage, and on NixOS through a Nix flake.""" +dev = """A player's idea (#horizon-ideas). An AppImage of the launcher and game from the release workflow, and a \ +flake.nix packaging the release binaries with their runtime libraries (Vulkan loader, X11/Wayland, ALSA), \ +the way horizon-parity's NixOS setup runs them today.""" +links = [] diff --git a/website/data/roadmap.json b/website/data/roadmap.json index 4af2a460f..58d697257 100644 --- a/website/data/roadmap.json +++ b/website/data/roadmap.json @@ -964,13 +964,16 @@ { "id": "opengl-fallback", "title": "OpenGL for old computers", - "status": "later", + "status": "shipped", "area": "platforms", - "plain": "A way to play on old PCs and Linux machines that have no Vulkan or DirectX 12, through OpenGL.", - "dev": "Players on older hardware ask whether Vulkan is the only way. Horizon draws with wgpu, which has an OpenGL backend; what is needed is to see which features hold up on it, how fast it runs, and a launcher switch like the DirectX 12 fallback that already ships.", + "plain": "Horizon now starts on old PCs whose graphics card has no Vulkan or DirectX 12 driver: it switches to OpenGL by itself, and Options > Graphics can pick OpenGL by hand.", + "dev": "wgpu's GL backend (WGL on Windows, EGL on Linux) as the last fallback after Vulkan and DirectX 12 (#1917), sprite arrays and CPU sprite animation for drivers without compute (#1920), no indirect draws below GL 4.3 (#1936). Minimum OpenGL 3.3 core. Shader packs don't run on it yet.", "links": [ - "docs/graphics.md" - ] + "#1917", + "#1920", + "#1936" + ], + "shipped_in": "v0.2.63" }, { "id": "phones-and-browser", @@ -1202,6 +1205,37 @@ "docs/hosting.md" ], "shipped_in": "launcher-v0.15.0" + }, + { + "id": "cli-server-install", + "title": "A server you install with one command", + "status": "next", + "area": "servers", + "plain": "Install and run a Horizon dedicated server from a terminal with a single command, no launcher needed, for VPSes and headless machines.", + "dev": "A player's idea (#horizon-ideas). `horizon-server` already runs headless; left: an install script (Linux/macOS shell, Windows PowerShell) that fetches the signed release, checks it, asks for or points at the player's own game files and starts the server, documented in docs/hosting.md.", + "links": [ + "docs/hosting.md" + ] + }, + { + "id": "launcher-look-menus", + "title": "Game menus in the launcher's style", + "status": "later", + "area": "extras", + "plain": "An optional look for the game's own menus and options that matches the Horizon launcher. Off by default: the vanilla menus stay as they are.", + "dev": "A player's idea (#horizon-ideas). A built-in resource pack or a Horizon setting that restyles the title, pause and options screens with the launcher's design tokens (crates/horizon-theme), following docs/design-system.md; off by default because it changes the vanilla look.", + "links": [ + "docs/design-system.md" + ] + }, + { + "id": "linux-packages", + "title": "AppImage and a Nix flake", + "status": "later", + "area": "platforms", + "plain": "Install Horizon on any Linux distribution as an AppImage, and on NixOS through a Nix flake.", + "dev": "A player's idea (#horizon-ideas). An AppImage of the launcher and game from the release workflow, and a flake.nix packaging the release binaries with their runtime libraries (Vulkan loader, X11/Wayland, ALSA), the way horizon-parity's NixOS setup runs them today.", + "links": [] } ], "journal": [