From 183382cd2beead9560f0d6303106b9886dd3307c Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Mon, 26 Oct 2026 15:13:34 +0100 Subject: [PATCH 1/2] Fire the fishing_rod_hooked trigger when a hook is reeled in --- .../horizon-client/src/game/advancements.rs | 29 +++++++++++++++++++ crates/horizon-client/src/game/fishing.rs | 24 +++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game/advancements.rs b/crates/horizon-client/src/game/advancements.rs index 0f76d0ca9..082bf0d62 100644 --- a/crates/horizon-client/src/game/advancements.rs +++ b/crates/horizon-client/src/game/advancements.rs @@ -708,6 +708,35 @@ impl Game<'_> { let it = item_view(stack); self.trigger(name, |c, w| adv::item_entity(c, &me, target, &it, w)); } + /// `FishingRodHookedTrigger`: the rod, what the hook is in (or the hook) + /// and the items it caught. + pub(super) fn trigger_fishing_rod_hooked( + &mut self, + rod: &ItemStack, + hooked: &EntityView, + items: &[ItemStack], + ) { + let me = self.player_entity(); + let rod = item_view(rod); + let hooked = hooked.clone(); + let items: Vec = items.iter().map(item_view).collect(); + self.trigger("minecraft:fishing_rod_hooked", move |c, w| { + let pctx = adv::Entities { + this: Some(&me), + origin: me.position, + tool: None, + block_pos: None, + }; + let ectx = adv::Entities { + this: Some(&hooked), + ..pctx + }; + adv::conditions(&c["player"], &pctx, w) + && adv::item(&c["rod"], &rod, w) + && adv::conditions(&c["entity"], &ectx, w) + && (c["item"].is_null() || items.iter().any(|i| adv::item(&c["item"], i, w))) + }); + } /// `EnterBlockTrigger`: the block, its state properties and the player. pub(super) fn trigger_enter_block(&mut self, state: horizon_world::registry::BlockStateId) { let Some(definition) = self.pack.assets.registry.state(state).cloned() else { diff --git a/crates/horizon-client/src/game/fishing.rs b/crates/horizon-client/src/game/fishing.rs index d454df406..33d93fb82 100644 --- a/crates/horizon-client/src/game/fishing.rs +++ b/crates/horizon-client/src/game/fishing.rs @@ -2,6 +2,7 @@ //! bobbing, lure and bite timers, open water, hooking mobs, retrieving the //! `gameplay/fishing` loot) and `FishingHookRenderer` (bobber and line). use super::{Game, view_vector}; +use horizon_client::advancements::EntityView; use horizon_client::lan::{entity::States, hub::Hub}; use horizon_client::{ blocks::Fluid, @@ -77,7 +78,7 @@ impl Game<'_> { let at = [p.position.x, p.position.y, p.position.z]; let pitch = 0.4 / (self.world.random.next_float() * 0.4 + 0.8); if self.hook.is_some() { - let damage = self.retrieve_hook(); + let damage = self.retrieve_hook(stack); self.damage_held(damage); self.audio.play( "minecraft:entity.fishing_bobber.retrieve", @@ -143,7 +144,7 @@ impl Game<'_> { true } /// `FishingHook.retrieve`: the rod damage it costs. - fn retrieve_hook(&mut self) -> u32 { + fn retrieve_hook(&mut self, rod: &ItemStack) -> u32 { let Some(hook) = self.hook.take() else { return 0; }; @@ -166,6 +167,15 @@ impl Game<'_> { m.velocity.z + d.z * 0.1, ); } + // CriteriaTriggers.FISHING_ROD_HOOKED with no items. + let hooked = self + .mobs + .iter() + .find(|m| m.id == id) + .map(|m| self.mob_entity(m)); + if let Some(hooked) = hooked { + self.trigger_fishing_rod_hooked(rod, &hooked, &[]); + } damage = 5; } else if hook.nibble > 0 { let biome = self.biome_name_at(hook.position); @@ -184,6 +194,7 @@ impl Game<'_> { self.world.random = random; // FishingHook.retrieve: fish_caught for a catch. self.stats.custom("fish_caught", 1); + let mut caught = Vec::new(); for stack in items { let mut item = ItemStack { item: Arc::from(stack.item.as_str()), @@ -205,6 +216,7 @@ impl Game<'_> { if let Some(potion) = &stack.potion { item = item.with_potion(potion); } + caught.push(item.clone()); let (dx, dy, dz) = ( owner.x - hook.position.x, owner.y - hook.position.y, @@ -224,6 +236,14 @@ impl Game<'_> { let xp = self.world.random.next_int_bound(6).unwrap_or(0) as u32 + 1; self.spawn_orbs([owner.x, owner.y + 0.5, owner.z + 0.5], xp); } + // CriteriaTriggers.FISHING_ROD_HOOKED: the hook itself is the entity. + let bobber = EntityView { + kind: "minecraft:fishing_bobber".into(), + position: [hook.position.x, hook.position.y, hook.position.z], + on_ground: hook.on_ground, + ..Default::default() + }; + self.trigger_fishing_rod_hooked(rod, &bobber, &caught); damage = 1; } if hook.on_ground { From af6faa88e51f6d7632191124b6e49f5a9ceaff8f Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Mon, 26 Oct 2026 16:06:30 +0100 Subject: [PATCH 2/2] Report the hook's open-water flag to the fishing_rod_hooked trigger --- crates/horizon-client/src/game/fishing.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/horizon-client/src/game/fishing.rs b/crates/horizon-client/src/game/fishing.rs index 33d93fb82..a2c3dcf1d 100644 --- a/crates/horizon-client/src/game/fishing.rs +++ b/crates/horizon-client/src/game/fishing.rs @@ -241,6 +241,7 @@ impl Game<'_> { kind: "minecraft:fishing_bobber".into(), position: [hook.position.x, hook.position.y, hook.position.z], on_ground: hook.on_ground, + fishing_open_water: Some(hook.open_water), ..Default::default() }; self.trigger_fishing_rod_hooked(rod, &bobber, &caught);