[PR #4326] [MERGED] Throw a replaced armour piece that doesn't fit, as Player.drop does #5563

Closed
opened 2026-11-03 05:13:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4326
Author: @DUzzL
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/issue-4321-creative-armor-swap


📝 Commits (4)

  • 193c856 Swap worn armour with the held piece in creative mode
  • b094aa1 Pin the creative armour swap with tests and a pure swap plan
  • 50a501c Discard the replaced armour in creative when the inventory is full
  • c355728 Merge main; keep only the survival drop from the eyes

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/armor_stands.rs (+2 -1)

📄 Description

🤖 Opened by DUzzL's AI agent, not by DUzzL personally.

Refs #4321 (the creative swap itself was fixed by #4231)

Update (rdbtCVS's agent): after main merged #4231, this PR was trimmed to 2 lines: in survival, a replaced armour piece that doesn't fit the inventory is thrown from the eyes like Player.drop(stack, false) (throw_from_eyes), instead of spawned motionless at eye height. The text below describes the original, larger change.

Cause: in equip_from_hand (game/armor_stands.rs) the worn piece was handed back to the hand only in the survival branch (if !self.creative). In creative the old piece was dropped and the held stack was left unchanged.

Change: creative mode now swaps the worn piece into the hand when one item is held, as survival does. With a stack of more than one, creative keeps the stack and gives or drops the old piece; a remainder that does not fit is dropped, so nothing is lost or duplicated. Survival behaviour is unchanged.

Tested: cargo fmt --check and cargo clippy -p horizon-client --all-targets -- -D warnings and cargo test -p horizon-client --bins armor (4 passed, existing armor-stand tests) pass. No unit test was added: the function needs a full Game.

Not tested: no in-game run. The swap rule was written from memory of vanilla Equippable.swapWithEquipmentSlot; there is no vanilla source in .local/ here, so it is not checked against the source. tools/pr_ready.py not run.


🔄 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/4326 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/issue-4321-creative-armor-swap` --- ### 📝 Commits (4) - [`193c856`](https://github.com/horizon-rust/horizon/commit/193c85660ae9f21fedf29a9867827c03d09d5f87) Swap worn armour with the held piece in creative mode - [`b094aa1`](https://github.com/horizon-rust/horizon/commit/b094aa114f3fc5cce60cc123d33593dfd2259129) Pin the creative armour swap with tests and a pure swap plan - [`50a501c`](https://github.com/horizon-rust/horizon/commit/50a501c3344dc24a034e6cfc9d4a523a55e2c720) Discard the replaced armour in creative when the inventory is full - [`c355728`](https://github.com/horizon-rust/horizon/commit/c3557288e693336467024788f567bcf3e14af548) Merge main; keep only the survival drop from the eyes ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/armor_stands.rs` (+2 -1) </details> ### 📄 Description > 🤖 Opened by DUzzL's AI agent, not by DUzzL personally. Refs #4321 (the creative swap itself was fixed by #4231) **Update (rdbtCVS's agent):** after main merged #4231, this PR was trimmed to 2 lines: in survival, a replaced armour piece that doesn't fit the inventory is thrown from the eyes like `Player.drop(stack, false)` (`throw_from_eyes`), instead of spawned motionless at eye height. The text below describes the original, larger change. **Cause:** in `equip_from_hand` (`game/armor_stands.rs`) the worn piece was handed back to the hand only in the survival branch (`if !self.creative`). In creative the old piece was dropped and the held stack was left unchanged. **Change:** creative mode now swaps the worn piece into the hand when one item is held, as survival does. With a stack of more than one, creative keeps the stack and gives or drops the old piece; a remainder that does not fit is dropped, so nothing is lost or duplicated. Survival behaviour is unchanged. **Tested:** `cargo fmt --check` and `cargo clippy -p horizon-client --all-targets -- -D warnings` and `cargo test -p horizon-client --bins armor` (4 passed, existing armor-stand tests) pass. No unit test was added: the function needs a full `Game`. **Not tested:** no in-game run. The swap rule was written from memory of vanilla `Equippable.swapWithEquipmentSlot`; there is no vanilla source in `.local/` here, so it is not checked against the source. `tools/pr_ready.py` not run. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:25 +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#5563
No description provided.