[PR #7159] [MERGED] A puffed pufferfish stings the mobs that touch it #7383

Closed
opened 2026-11-03 06:38:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7159
Author: @MSedgeMC
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/pufferfish-sting-touch


📝 Commits (3)

📊 Changes

4 files changed (+185 additions, -19 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+28 -0)
📝 crates/horizon-client/src/mobs.rs (+10 -0)
📝 crates/horizon-client/src/mobs/aquatic.rs (+146 -18)
📝 tools/port_map/game-011.tsv (+1 -1)

📄 Description

Vanilla's Pufferfish.aiStep queries Mob.class inside the fish's own box inflated by 0.3 with TARGETING_CONDITIONS (forNonCombat().ignoreInvisibilityTesting().ignoreLineOfSight().selector(SCARY_MOB): alive, and not in #not_scary_for_pufferfish), and calls Pufferfish.touch on each of them: doTeamsAllowDamage, then mob.hurtServer(level, damageSources().mobAttack(this), getPuffState() + 1), and when that hit lands the mob gets MobEffects.POISON for 60 * getPuffState() ticks and the fish plays PUFFER_FISH_STING at volume 1, pitch 1. playerTouch is the player path, separate.

Horizon had only the player path in mobs/aquatic.rs: PufferfishPuffGoal puffed the fish up when a mob came within 2 blocks, but the mob that then touched the fish was never hurt, so a pufferfish could not hurt any mob at all — not even the zombies it inflates for.

ai_step now runs the loop (sting_touching_mobs), the #not_scary_for_pufferfish species list moved out of the puff goal into not_scary_for_pufferfish so that both read the same tag, and a new MobEvent::PufferfishSting applies the hit in game/creatures.rs and plays entity.puffer_fish.sting only when the hit landed, at the fish's position and not for a silent fish, as Entity.playSound does.

Proven: on the build VM, cargo test -q -p horizon-client-lib --lib pufferfish_sting_tests passes the new a_puffed_pufferfish_stings_the_mobs_that_touch_it (1 passed): puff state 1 stings a zombie for 2, puff state 2 for 3, a deflated pufferfish stings nobody, a zombie a block away is not touched, and a cod and a squid (both #not_scary_for_pufferfish) are left alone. With the new call site disabled the same test fails (left: [], right: [(2, 2.0)]). cargo clippy -q -p horizon-client-lib --lib and cargo clippy -q -p horizon-client --lib print nothing, rustfmt --edition 2024 --check is clean on the three files, and python3 tools/port_ledger.py map-check tools/port_map/game-011.tsv reports 148 rows, no problems. The vanilla order and numbers are javap -p -c -constants net.minecraft.world.entity.animal.fish.Pufferfish → aiStep, touch, playerTouch and its static initializer, plus data/minecraft/tags/entity_type/not_scary_for_pufferfish.json of 26.3.

Not proven: (corrected after merge: the poison is applied - mobs/aquatic.rs::sting_touching_mobs emits MobEvent::PufferfishSting { poison_ticks } and game/creatures.rs calls t.add_effect("minecraft:poison", poison_ticks, 0) on a landed hit, ticked by mobs/ai.rs::tick_effects; the original note below was wrong) the poison the stung mob should get — effects on another mob have no channel in the simulation (a cave spider's poison on a mob is missing in the same way), so only the hit and its sound are modelled. doTeamsAllowDamage goes through teams_allow_damage, but no test covers a team. I did not run the game, so I have not seen a zombie take the sting; the in-game check is a zombie pushed against a puffed-up pufferfish, which should now lose health instead of none.

Corrects the Pufferfish.touch row of tools/port_map/game-011.tsv.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7159 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/pufferfish-sting-touch` --- ### 📝 Commits (3) - [`b661190`](https://github.com/horizon-rust/horizon/commit/b661190137cbe0bd159b2ffc0fc0f26ee929b31a) Sting the mobs a puffed pufferfish touches - [`fa297fc`](https://github.com/horizon-rust/horizon/commit/fa297fc040c272e46989e3e90f08737ac8fb23e0) Merge main into #7159 - [`2e1fae8`](https://github.com/horizon-rust/horizon/commit/2e1fae8f9fd06908a9fd73a795d8bacf98a007c2) Poison the mob a pufferfish stings ### 📊 Changes **4 files changed** (+185 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+28 -0) 📝 `crates/horizon-client/src/mobs.rs` (+10 -0) 📝 `crates/horizon-client/src/mobs/aquatic.rs` (+146 -18) 📝 `tools/port_map/game-011.tsv` (+1 -1) </details> ### 📄 Description Vanilla's `Pufferfish.aiStep` queries `Mob.class` inside the fish's own box inflated by `0.3` with `TARGETING_CONDITIONS` (`forNonCombat().ignoreInvisibilityTesting().ignoreLineOfSight().selector(SCARY_MOB)`: alive, and not in `#not_scary_for_pufferfish`), and calls `Pufferfish.touch` on each of them: `doTeamsAllowDamage`, then `mob.hurtServer(level, damageSources().mobAttack(this), getPuffState() + 1)`, and when that hit lands the mob gets `MobEffects.POISON` for `60 * getPuffState()` ticks and the fish plays `PUFFER_FISH_STING` at volume 1, pitch 1. `playerTouch` is the player path, separate. Horizon had only the player path in `mobs/aquatic.rs`: `PufferfishPuffGoal` puffed the fish up when a mob came within 2 blocks, but the mob that then touched the fish was never hurt, so a pufferfish could not hurt any mob at all — not even the zombies it inflates for. `ai_step` now runs the loop (`sting_touching_mobs`), the `#not_scary_for_pufferfish` species list moved out of the puff goal into `not_scary_for_pufferfish` so that both read the same tag, and a new `MobEvent::PufferfishSting` applies the hit in `game/creatures.rs` and plays `entity.puffer_fish.sting` only when the hit landed, at the fish's position and not for a silent fish, as `Entity.playSound` does. **Proven:** on the build VM, `cargo test -q -p horizon-client-lib --lib pufferfish_sting_tests` passes the new `a_puffed_pufferfish_stings_the_mobs_that_touch_it` (`1 passed`): puff state 1 stings a zombie for 2, puff state 2 for 3, a deflated pufferfish stings nobody, a zombie a block away is not touched, and a cod and a squid (both `#not_scary_for_pufferfish`) are left alone. With the new call site disabled the same test fails (`left: [], right: [(2, 2.0)]`). `cargo clippy -q -p horizon-client-lib --lib` and `cargo clippy -q -p horizon-client --lib` print nothing, `rustfmt --edition 2024 --check` is clean on the three files, and `python3 tools/port_ledger.py map-check tools/port_map/game-011.tsv` reports `148 rows, no problems`. The vanilla order and numbers are `javap -p -c -constants net.minecraft.world.entity.animal.fish.Pufferfish` → `aiStep`, `touch`, `playerTouch` and its static initializer, plus `data/minecraft/tags/entity_type/not_scary_for_pufferfish.json` of 26.3. **Not proven:** *(corrected after merge: the poison is applied - `mobs/aquatic.rs::sting_touching_mobs` emits `MobEvent::PufferfishSting { poison_ticks }` and `game/creatures.rs` calls `t.add_effect("minecraft:poison", poison_ticks, 0)` on a landed hit, ticked by `mobs/ai.rs::tick_effects`; the original note below was wrong)* the poison the stung mob should get — effects on another mob have no channel in the simulation (a cave spider's poison on a mob is missing in the same way), so only the hit and its sound are modelled. `doTeamsAllowDamage` goes through `teams_allow_damage`, but no test covers a team. I did not run the game, so I have not seen a zombie take the sting; the in-game check is a zombie pushed against a puffed-up pufferfish, which should now lose health instead of none. Corrects the `Pufferfish.touch` row of `tools/port_map/game-011.tsv`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:38:42 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7383
No description provided.