[PR #2562] [MERGED] A potion from the creative inventory keeps its contents in the hotbar #4428

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

📋 Pull Request Information

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

Base: main ← Head: fix/potion-contents-in-the-creative-inventory


📝 Commits (5)

  • 67b6e75 The container screen's press state does not survive the screen
  • 7ae20a5 A potion from the creative inventory keeps its contents in the hotbar
  • 66bec37 Merge remote-tracking branch 'upstream/main' into fix/container-press-state-lifetime
  • 17fa6e8 Merge remote-tracking branch 'upstream/main' into fix/potion-contents-in-the-creative-inventory
  • 407053f Merge #2561

📊 Changes

3 files changed (+116 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/container_screen.rs (+43 -0)
📝 crates/horizon-client/src/game.rs (+13 -8)
📝 crates/horizon-client/src/menu.rs (+60 -0)

📄 Description

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

What and why

#1832 reported that a potion taken from the creative inventory and put in the hotbar "instantly turns into the uncraftable potion".

On main the hand-over already keeps the stack as it is — the item tab's stack is the real one (Creative::from_json parses each tab item with item_data::parse_stack, so its minecraft:potion_contents is read back into StackData.potion), Creative::click_display copies the stack whole (ItemStack { count, ..s.clone() }), and the item picker menu's click puts that same stack in the hotbar. The wire path keeps it too (#1796, #1874).

What was missing is a test that keeps it that way, so this pull request adds one: the creative screen hands the potion over, and the hotbar slot holds the brew (minecraft:swiftness), not the uncraftable potion (a minecraft:potion with no potion_contents at all).

What is still lost, and is not what the report describes: potion_contents' custom colour, custom effects and custom name. Horizon models only the brew (StackData.potion).

Fixes #1832

Vanilla reference

  • net.minecraft.world.item.alchemy.PotionContents — the component: potion, customColor, customEffects, customName; PotionContents.createItemStack(item, potion) is what an item tab's potion stack is.
  • net.minecraft.world.item.CreativeModeTabs.generatePotionEffectTypes — the item tab's potions are PotionContents.createItemStack(item, potion), one per minecraft:potion entry of the registry.
  • net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen.ItemPickerMenu — the item tab's slots hold those stacks, and slotClicked hands the stack over unchanged.
  • net.minecraft.world.item.component.PotionContents (the data component) — PotionContents.EMPTY is the uncraftable potion.

Self-check

  • cargo test -p horizon-client --lib -- menu::tests::a_creative_potion
    → 1 passed; 0 failed (a_creative_potion_keeps_its_contents_in_the_hotbar).
  • cargo fmt -p horizon-client → clean.
  • python3 tools/check_public_tree.py → "Public tree check passed." (run by the commit hook).

🤖 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/2562 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/potion-contents-in-the-creative-inventory` --- ### 📝 Commits (5) - [`67b6e75`](https://github.com/horizon-rust/horizon/commit/67b6e75c0b4361c9aa2fb04ea020410cf0fe5167) The container screen's press state does not survive the screen - [`7ae20a5`](https://github.com/horizon-rust/horizon/commit/7ae20a5b294ebc8891ae8faabc42496c187356d3) A potion from the creative inventory keeps its contents in the hotbar - [`66bec37`](https://github.com/horizon-rust/horizon/commit/66bec37b55fb14359210adc76e050eb2f1b2ae7f) Merge remote-tracking branch 'upstream/main' into fix/container-press-state-lifetime - [`17fa6e8`](https://github.com/horizon-rust/horizon/commit/17fa6e826c3d8a118a5dff618a1152dd59ce6b38) Merge remote-tracking branch 'upstream/main' into fix/potion-contents-in-the-creative-inventory - [`407053f`](https://github.com/horizon-rust/horizon/commit/407053f37c1e652e46753dfe75378a5ecc36702e) Merge #2561 ### 📊 Changes **3 files changed** (+116 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/container_screen.rs` (+43 -0) 📝 `crates/horizon-client/src/game.rs` (+13 -8) 📝 `crates/horizon-client/src/menu.rs` (+60 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself. ## What and why #1832 reported that a potion taken from the creative inventory and put in the hotbar "instantly turns into the uncraftable potion". On `main` the hand-over already keeps the stack as it is — the item tab's stack is the real one (`Creative::from_json` parses each tab item with `item_data::parse_stack`, so its `minecraft:potion_contents` is read back into `StackData.potion`), `Creative::click_display` copies the stack whole (`ItemStack { count, ..s.clone() }`), and the item picker menu's click puts that same stack in the hotbar. The wire path keeps it too (#1796, #1874). What was missing is a test that keeps it that way, so this pull request adds one: the creative screen hands the potion over, and the hotbar slot holds the brew (`minecraft:swiftness`), not the uncraftable potion (a `minecraft:potion` with no `potion_contents` at all). What is still lost, and is not what the report describes: `potion_contents`' custom colour, custom effects and custom name. Horizon models only the brew (`StackData.potion`). Fixes #1832 ## Vanilla reference - `net.minecraft.world.item.alchemy.PotionContents` — the component: `potion`, `customColor`, `customEffects`, `customName`; `PotionContents.createItemStack(item, potion)` is what an item tab's potion stack is. - `net.minecraft.world.item.CreativeModeTabs.generatePotionEffectTypes` — the item tab's potions are `PotionContents.createItemStack(item, potion)`, one per `minecraft:potion` entry of the registry. - `net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen.ItemPickerMenu` — the item tab's slots hold those stacks, and `slotClicked` hands the stack over unchanged. - `net.minecraft.world.item.component.PotionContents` (the data component) — `PotionContents.EMPTY` is the uncraftable potion. ## Self-check - `cargo test -p horizon-client --lib -- menu::tests::a_creative_potion` → `1 passed; 0 failed` (`a_creative_potion_keeps_its_contents_in_the_hotbar`). - `cargo fmt -p horizon-client` → clean. - `python3 tools/check_public_tree.py` → "Public tree check passed." (run by the commit hook). 🤖 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:17:04 +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#4428
No description provided.