[PR #2326] [MERGED] Hurt mobs that touch a cactus or a sweet berry bush #4206

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

📋 Pull Request Information

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

Base: main ← Head: fix/mob-cactus-berry-damage


📝 Commits (3)

  • b283f2a Hurt mobs that touch a cactus or a sweet berry bush
  • e9797d6 Use the berry damage type for sweet berry bushes and check the whole move for contact
  • 9663d6f Merge main into fix/mob-cactus-berry-damage

📊 Changes

6 files changed (+81 additions, -6 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/world_cmds.rs (+2 -1)
📝 crates/horizon-client/src/game/creatures.rs (+1 -0)
📝 crates/horizon-client/src/mobs.rs (+15 -4)
📝 crates/horizon-client/src/mobs/ai.rs (+54 -0)
📝 crates/horizon-client/src/mobs/living.rs (+8 -1)
📝 crates/horizon-client/src/mobs/sulfur_cube.rs (+1 -0)

📄 Description

What and why

Mobs took no damage from cactus or sweet berry bushes: a zombie with no AI standing against a cactus kept full health, and mobs walked through berry bushes at full speed. Only the player reacted to those blocks.

Each mob tick now runs the block-contact step after movement, over the blocks its box touched at the start and at the end of the tick:

  • cactus hurts the mob for 1 (cactus damage);
  • sweet berry bush (every living mob except foxes and bees) forgets the fall, slows the mob's next move to 0.8 / 0.75 / 0.8, and in a grown bush (age not 0) hurts it for 1 when it moved at least 0.003 on X or Z this tick.

The slowdown is a new stuck_multiplier on the mob, applied once in do_move like Entity.move does. Mobs are ticked by the same code on the server thread and in-frame, so both paths get it. Cactus against dropped items is not touched (that is a separate PR).

Vanilla reference

  • CactusBlock.entityInside: entity.hurt(cactus, 1.0F).
  • SweetBerryBushBlock.entityInside: makeStuckInBlock(0.8, 0.75, 0.8), the age check, the 0.003 movement test using oldPosition() - position(), and the sweetBerryBush hurt of 1.
  • Entity.makeStuckInBlock (resets fall distance) and Entity.move (stuckSpeedMultiplier).
  • LivingEntity.aiStep -> Entity.applyEffectsFromBlocks.

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/2326 **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/mob-cactus-berry-damage` --- ### 📝 Commits (3) - [`b283f2a`](https://github.com/horizon-rust/horizon/commit/b283f2ad314243210014263184ebf826eca53f68) Hurt mobs that touch a cactus or a sweet berry bush - [`e9797d6`](https://github.com/horizon-rust/horizon/commit/e9797d69d0ea0b5ee0b75c68a9b483cdbf13f364) Use the berry damage type for sweet berry bushes and check the whole move for contact - [`9663d6f`](https://github.com/horizon-rust/horizon/commit/9663d6f53ebc467116130f8f94c9593a40cc932c) Merge main into fix/mob-cactus-berry-damage ### 📊 Changes **6 files changed** (+81 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/world_cmds.rs` (+2 -1) 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs.rs` (+15 -4) 📝 `crates/horizon-client/src/mobs/ai.rs` (+54 -0) 📝 `crates/horizon-client/src/mobs/living.rs` (+8 -1) 📝 `crates/horizon-client/src/mobs/sulfur_cube.rs` (+1 -0) </details> ### 📄 Description ## What and why Mobs took no damage from cactus or sweet berry bushes: a zombie with no AI standing against a cactus kept full health, and mobs walked through berry bushes at full speed. Only the player reacted to those blocks. Each mob tick now runs the block-contact step after movement, over the blocks its box touched at the start and at the end of the tick: - cactus hurts the mob for 1 (cactus damage); - sweet berry bush (every living mob except foxes and bees) forgets the fall, slows the mob's next move to 0.8 / 0.75 / 0.8, and in a grown bush (age not 0) hurts it for 1 when it moved at least 0.003 on X or Z this tick. The slowdown is a new `stuck_multiplier` on the mob, applied once in `do_move` like `Entity.move` does. Mobs are ticked by the same code on the server thread and in-frame, so both paths get it. Cactus against dropped items is not touched (that is a separate PR). ## Vanilla reference - `CactusBlock.entityInside`: `entity.hurt(cactus, 1.0F)`. - `SweetBerryBushBlock.entityInside`: `makeStuckInBlock(0.8, 0.75, 0.8)`, the age check, the 0.003 movement test using `oldPosition() - position()`, and the `sweetBerryBush` hurt of 1. - `Entity.makeStuckInBlock` (resets fall distance) and `Entity.move` (`stuckSpeedMultiplier`). - `LivingEntity.aiStep` -> `Entity.applyEffectsFromBlocks`. ## 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:15:29 +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#4206
No description provided.