[PR #2230] [MERGED] Fire the player_hurt_entity and entity_hurt_player advancement triggers #4123

Closed
opened 2026-11-03 04:14:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2230
Author: @kacpherek
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/player-hurt-entity-trigger


📝 Commits (3)

  • 5fa4231 Fire player_hurt_entity and entity_hurt_player advancement triggers
  • b62095d Run the trident player_hurt_entity trigger as the thrower
  • 393b8ef Merge main into fix/player-hurt-entity-trigger

📊 Changes

5 files changed (+198 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/advancements.rs (+46 -0)
📝 crates/horizon-client/src/game.rs (+9 -0)
📝 crates/horizon-client/src/game/advancements.rs (+71 -0)
📝 crates/horizon-client/src/game/creatures.rs (+35 -0)
📝 crates/horizon-client/src/game/trident.rs (+37 -0)

📄 Description

What and why

Horizon never fired the player_hurt_entity and entity_hurt_player advancement triggers, so "Take Aim" (shoot an arrow at a mob), "Throw a trident", "Overoverkill" and "Not Today, Thank You" (block a projectile with a shield) could not be earned.

This adds a DamagePredicate check (dealt, taken, blocked, source entity, damage type tags, direct entity) and fires:

  • player_hurt_entity when the player's melee hit, an arrow or a thrown trident hurts a mob.
  • entity_hurt_player when a mob or projectile hurts the player or is blocked by a shield.

It runs in the shared game code, so a guest's hits and a guest's arrows count for the guest.

Vanilla reference

  • LivingEntity.hurtServer (ENTITY_HURT_PLAYER / PLAYER_HURT_ENTITY calls)
  • PlayerHurtEntityTrigger, EntityHurtPlayerTrigger
  • DamagePredicate, DamageSourcePredicate
  • adventure/shoot_arrow, throw_trident, overoverkill, story/deflect_arrow

Self-check

cargo check -p horizon-client passes.


🔄 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/2230 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/player-hurt-entity-trigger` --- ### 📝 Commits (3) - [`5fa4231`](https://github.com/horizon-rust/horizon/commit/5fa423169f8fe5791f4cf31ee5b97e485806e46a) Fire player_hurt_entity and entity_hurt_player advancement triggers - [`b62095d`](https://github.com/horizon-rust/horizon/commit/b62095dfcb58d5bd3b77bd40b1cdea70e4766de4) Run the trident player_hurt_entity trigger as the thrower - [`393b8ef`](https://github.com/horizon-rust/horizon/commit/393b8ef7e6f8267ea8c1830deef2bdcfef8ef0b3) Merge main into fix/player-hurt-entity-trigger ### 📊 Changes **5 files changed** (+198 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/advancements.rs` (+46 -0) 📝 `crates/horizon-client/src/game.rs` (+9 -0) 📝 `crates/horizon-client/src/game/advancements.rs` (+71 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+35 -0) 📝 `crates/horizon-client/src/game/trident.rs` (+37 -0) </details> ### 📄 Description ## What and why Horizon never fired the `player_hurt_entity` and `entity_hurt_player` advancement triggers, so "Take Aim" (shoot an arrow at a mob), "Throw a trident", "Overoverkill" and "Not Today, Thank You" (block a projectile with a shield) could not be earned. This adds a `DamagePredicate` check (dealt, taken, blocked, source entity, damage type tags, direct entity) and fires: - `player_hurt_entity` when the player's melee hit, an arrow or a thrown trident hurts a mob. - `entity_hurt_player` when a mob or projectile hurts the player or is blocked by a shield. It runs in the shared game code, so a guest's hits and a guest's arrows count for the guest. ## Vanilla reference - `LivingEntity.hurtServer` (ENTITY_HURT_PLAYER / PLAYER_HURT_ENTITY calls) - `PlayerHurtEntityTrigger`, `EntityHurtPlayerTrigger` - `DamagePredicate`, `DamageSourcePredicate` - `adventure/shoot_arrow`, `throw_trident`, `overoverkill`, `story/deflect_arrow` ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:14:51 +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#4123
No description provided.