[PR #1896] [MERGED] Items thrown out of the creative inventory drop on servers and the server thread #3845

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

📋 Pull Request Information

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

Base: main ← Head: fix/creative-drop-on-server


📝 Commits (2)

  • dab1366 Creative screen drops reach the server: SetCreativeModeSlot(-1)
  • c181428 Merge origin/main into fix/creative-drop-on-server

📊 Changes

3 files changed (+67 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+6 -2)
📝 crates/horizon-client/src/game/lan_actions.rs (+33 -0)
📝 crates/horizon-client/src/game/remote.rs (+28 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What the player reported

.dezerx on Discord ("Few bugs" thread): throwing an item out of the creative inventory does nothing.

Vanilla rule

CreativeModeInventoryScreen.slotClicked outside the window with a carried stack, on an item tab or the inventory tab, drops the stack (an item tab's right click drops one of it). It does this with Player.drop (predicted: the hand swings) and MultiPlayerGameMode.handleCreativeModeItemDrop, which sends SetCreativeModeSlot(-1, stack). A stack picked from a creative tab exists only on the client, so the server learns of it only from that packet. ServerGamePacketListenerImpl.handleSetCreativeModeSlot takes a slot below 0 as a drop: an infinite-materials player, a valid count, and dropSpamThrottler (TickThrottler(20, 1480)) under its threshold, then player.drop(stack, true).

Cause

As a client of a server (single player on its server thread, LAN, dedicated), a click outside the creative screen sent a ContainerClick to slot -999. The server has no carried stack for a creative pick, so nothing dropped. The client still cleared its carried stack. In-frame was fine.

Change

  • Client (remote_creative_drop): outside clicks on the creative screen send SetCreativeModeSlot(-1, stack) with the stack, or one of it on an item tab's right click, and swing the hand.
  • Server (lan_actions.rs): SetCreativeModeSlot with a slot below 0 drops the stack from the guest's hand through player_drop (creative only, count ≤ max stack). Each drop adds 20 to a per-player counter that loses one per tick, and drops stop above 1480 with vanilla's log line.

Tested (horizon-ctl, fresh temp homes, env isolation from CLAUDE.md)

Open the creative screen, pick oak logs from the first tab, click outside the window, close, list the entities:

carried after the click dropped
main, server thread (default) none nothing
this branch, server thread none an oak log item entity
this branch, in-frame none an oak log item entity

Harnesses: creative, dedicated_server PASS.

python3 tools/pr_ready.py --quick:

Check Result
Scope ✅ 3 files, +67 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (12 s)
clippy ✅ (3 min 28 s)
tests: horizon-client ✅ 1238 passed (14 min 7 s)
doc tests ✅ 0 passed (6 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 30 affected, to run in CI (--quick): arrow, block_particles, block_removal, breaking_model, command_exec, composter, crafter, dedicated_server, dispenser, enchanting, interaction_input, locator_bar and 18 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 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/1896 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/creative-drop-on-server` --- ### 📝 Commits (2) - [`dab1366`](https://github.com/horizon-rust/horizon/commit/dab13669f513ec00b24b591188bf3382d2bad96b) Creative screen drops reach the server: SetCreativeModeSlot(-1) - [`c181428`](https://github.com/horizon-rust/horizon/commit/c1814283e05a757abce0e8dc58388e2e485908ee) Merge origin/main into fix/creative-drop-on-server ### 📊 Changes **3 files changed** (+67 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+6 -2) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+33 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+28 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What the player reported .dezerx on Discord ("Few bugs" thread): throwing an item out of the creative inventory does nothing. ## Vanilla rule `CreativeModeInventoryScreen.slotClicked` outside the window with a carried stack, on an item tab or the inventory tab, drops the stack (an item tab's right click drops one of it). It does this with `Player.drop` (predicted: the hand swings) and `MultiPlayerGameMode.handleCreativeModeItemDrop`, which sends `SetCreativeModeSlot(-1, stack)`. A stack picked from a creative tab exists only on the client, so the server learns of it only from that packet. `ServerGamePacketListenerImpl.handleSetCreativeModeSlot` takes a slot below 0 as a drop: an infinite-materials player, a valid count, and `dropSpamThrottler` (`TickThrottler(20, 1480)`) under its threshold, then `player.drop(stack, true)`. ## Cause As a client of a server (single player on its server thread, LAN, dedicated), a click outside the creative screen sent a `ContainerClick` to slot -999. The server has no carried stack for a creative pick, so nothing dropped. The client still cleared its carried stack. In-frame was fine. ## Change - Client (`remote_creative_drop`): outside clicks on the creative screen send `SetCreativeModeSlot(-1, stack)` with the stack, or one of it on an item tab's right click, and swing the hand. - Server (`lan_actions.rs`): `SetCreativeModeSlot` with a slot below 0 drops the stack from the guest's hand through `player_drop` (creative only, count ≤ max stack). Each drop adds 20 to a per-player counter that loses one per tick, and drops stop above 1480 with vanilla's log line. ## Tested (`horizon-ctl`, fresh temp homes, env isolation from CLAUDE.md) Open the creative screen, pick oak logs from the first tab, click outside the window, close, list the entities: | | carried after the click | dropped | |---|---|---| | main, server thread (default) | none | **nothing** | | this branch, server thread | none | an oak log item entity | | this branch, in-frame | none | an oak log item entity | Harnesses: `creative`, `dedicated_server` PASS. `python3 tools/pr_ready.py --quick`: | Check | Result | | --- | --- | | Scope | ✅ 3 files, +67 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (12 s) | | clippy | ✅ (3 min 28 s) | | tests: horizon-client | ✅ 1238 passed (14 min 7 s) | | doc tests | ✅ 0 passed (6 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 30 affected, to run in CI (--quick): arrow, block_particles, block_removal, breaking_model, command_exec, composter, crafter, dedicated_server, dispenser, enchanting, interaction_input, locator_bar and 18 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:44 +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#3845
No description provided.