[PR #2200] [MERGED] Throw leftover items from the eyes, and creative players keep their stack on an armor stand #4098

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

📋 Pull Request Information

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

Base: main ← Head: fix/item-drop-direction-and-creative-stand


📝 Commits (1)

  • 4ae514d Throw leftover items from the eyes, and creative players keep their stack on an armor stand

📊 Changes

4 files changed (+22 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+13 -8)
📝 crates/horizon-client/src/game/armor_stands.rs (+5 -0)
📝 crates/horizon-client/src/game/potions.rs (+2 -1)
📝 crates/horizon-client/src/game/stations.rs (+2 -1)

📄 Description

What and why

Leftover items fly out like a drop, not straight up. When an item no longer fits in the inventory, vanilla calls player.drop(stack, false): the item spawns at eye height minus 0.3 and is thrown along the look direction (speed 0.3, with the usual random spread), without naming the player as the thrower. Horizon spawned these items with a fixed upward speed of 0.1 and no direction. They now use the same throw as the drop key (throw_from_eyes), minus the thrower. Fixed for:

  • the crafting grid and the carried stack when a screen closes;
  • what is left over from a closed workstation and from crafting remainders (give_or_drop);
  • the filled bucket when the held stack has more than one bucket (also checked against vanilla: the old code spawned it at the eyes with no throw);
  • cauldron results and bottle or bucket swaps (ItemUtils.createFilledResult).

The cursor stack dropped when a dead player is removed no longer sets the player as the thrower either, since vanilla drops it with drop(carried, false).

Creative players keep their stack on an armor stand. In creative, clicking an empty stand slot used to move the item out of the hand. Vanilla places a copy of one item and keeps the stack, so a creative player can dress a stand without losing the item.

Vanilla reference

  • AbstractContainerMenu.dropOrPlaceInInventory, Inventory.placeItemBackInInventory and ItemUtils.createFilledResult call player.drop(stack, false).
  • LivingEntity.createItemStackToDrop(stack, randomly = false, thrownFromHand = false): position eyeY - 0.3, pickup delay 40, motion (-sinY * cosX * 0.3 + cos(dir) * pow2, -sinX * 0.3 + 0.1 + (r - r) * 0.1, cosY * cosX * 0.3 + sin(dir) * pow2); the thrower is set only when thrownFromHand.
  • ArmorStand.swapItem: when player.hasInfiniteMaterials() and the slot is empty and the player's stack is not, setItemSlot(slot, playerItemStack.copyWithCount(1)) and nothing is taken from the player.

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/2200 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/item-drop-direction-and-creative-stand` --- ### 📝 Commits (1) - [`4ae514d`](https://github.com/horizon-rust/horizon/commit/4ae514d0ae464b255b3df073d7c9b7f97d452cc5) Throw leftover items from the eyes, and creative players keep their stack on an armor stand ### 📊 Changes **4 files changed** (+22 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+13 -8) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+5 -0) 📝 `crates/horizon-client/src/game/potions.rs` (+2 -1) 📝 `crates/horizon-client/src/game/stations.rs` (+2 -1) </details> ### 📄 Description ## What and why **Leftover items fly out like a drop, not straight up.** When an item no longer fits in the inventory, vanilla calls `player.drop(stack, false)`: the item spawns at eye height minus 0.3 and is thrown along the look direction (speed 0.3, with the usual random spread), without naming the player as the thrower. Horizon spawned these items with a fixed upward speed of 0.1 and no direction. They now use the same throw as the drop key (`throw_from_eyes`), minus the thrower. Fixed for: - the crafting grid and the carried stack when a screen closes; - what is left over from a closed workstation and from crafting remainders (`give_or_drop`); - the filled bucket when the held stack has more than one bucket (also checked against vanilla: the old code spawned it at the eyes with no throw); - cauldron results and bottle or bucket swaps (`ItemUtils.createFilledResult`). The cursor stack dropped when a dead player is removed no longer sets the player as the thrower either, since vanilla drops it with `drop(carried, false)`. **Creative players keep their stack on an armor stand.** In creative, clicking an empty stand slot used to move the item out of the hand. Vanilla places a copy of one item and keeps the stack, so a creative player can dress a stand without losing the item. ## Vanilla reference - `AbstractContainerMenu.dropOrPlaceInInventory`, `Inventory.placeItemBackInInventory` and `ItemUtils.createFilledResult` call `player.drop(stack, false)`. - `LivingEntity.createItemStackToDrop(stack, randomly = false, thrownFromHand = false)`: position `eyeY - 0.3`, pickup delay 40, motion `(-sinY * cosX * 0.3 + cos(dir) * pow2, -sinX * 0.3 + 0.1 + (r - r) * 0.1, cosY * cosX * 0.3 + sin(dir) * pow2)`; the thrower is set only when `thrownFromHand`. - `ArmorStand.swapItem`: when `player.hasInfiniteMaterials()` and the slot is empty and the player's stack is not, `setItemSlot(slot, playerItemStack.copyWithCount(1))` and nothing is taken from the player. ## 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:39 +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#4098
No description provided.