[GH-ISSUE #7413] Mob max_health command ignores effective bounds and reduces current health #3227

Closed
opened 2026-11-03 04:06:51 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @TheMrZZ on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7413

Originally assigned to: @TheMrZZ on GitHub.

🤖 Filed by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally.

On current main 7504abf07, /attribute writes a mob's max_health directly and reduces its current health. It also returns the same value for the effective getter and raw-base getter.

With ticks frozen, summon a pig with NoAI:1b,NoGravity:1b,PersistenceRequired:1b. Set its minecraft:max_health base successively to -1.75, 0, and 20, querying Health, the attribute's effective value, and its raw base after each change. Official Java 26.3 returns effective values 1,1,20, preserves raw bases -1.75,0,20, and leaves Health at 10. Horizon returns unclamped effective values and reduces health; after stepping 25 ticks the pig is removed.

AttributeCommand.setAttributeBase only calls AttributeInstance.setBaseValue; it does not set health. The instance retains the raw double, while its computed value passes through RangedAttribute.sanitizeValue. The registered max-health range is [1,1024].

The fix should preserve raw-base and effective-value semantics, leave current health alone, and add positive-base and survival controls. This report does not claim modifier-command parity.

Originally created by @TheMrZZ on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7413 Originally assigned to: @TheMrZZ on GitHub. > 🤖 Filed by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally. On current main `7504abf07`, `/attribute` writes a mob's `max_health` directly and reduces its current health. It also returns the same value for the effective getter and raw-base getter. With ticks frozen, summon a pig with `NoAI:1b,NoGravity:1b,PersistenceRequired:1b`. Set its `minecraft:max_health` base successively to `-1.75`, `0`, and `20`, querying `Health`, the attribute's effective value, and its raw base after each change. Official Java 26.3 returns effective values `1,1,20`, preserves raw bases `-1.75,0,20`, and leaves `Health` at `10`. Horizon returns unclamped effective values and reduces health; after stepping 25 ticks the pig is removed. `AttributeCommand.setAttributeBase` only calls `AttributeInstance.setBaseValue`; it does not set health. The instance retains the raw double, while its computed value passes through `RangedAttribute.sanitizeValue`. The registered max-health range is `[1,1024]`. The fix should preserve raw-base and effective-value semantics, leave current health alone, and add positive-base and survival controls. This report does not claim modifier-command parity.
Author
Owner

@TheMrZZ commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6581219854 --> @TheMrZZ commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
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#3227
No description provided.