[GH-ISSUE #1832] All potions transform into uncraftable potion when put in inventory #551

Closed
opened 2026-11-02 15:39:58 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @ludovic111 on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1832

What I did: took a potion from the creative mode inventory and put it in my hotbar
What happened: the potion instantly turned into the uncraftable potion
What I expected: the potion to stay as what it was from the creative inventory
Horizon version: 0.2.57
OS, CPU, GPU: windows x86, ryzen 9 3950x, rtx 4060ti 8gb

Reported on Discord by kevennever#5592 in #horizon-bugs · Discord thread
Tags: gameplay

Opened by Kira from Discord. Replies from the reporter in the thread are added here as comments.

Originally created by @ludovic111 on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1832 > What I did: took a potion from the creative mode inventory and put it in my hotbar > What happened: the potion instantly turned into the uncraftable potion > What I expected: the potion to stay as what it was from the creative inventory > Horizon version: 0.2.57 > OS, CPU, GPU: windows x86, ryzen 9 3950x, rtx 4060ti 8gb Reported on Discord by **kevennever#5592** in #horizon-bugs · [Discord thread](https://discord.com/channels/1559227979002028052/1563928047483093022) Tags: gameplay <sub>Opened by Kira from Discord. Replies from the reporter in the thread are added here as comments.</sub><!-- kira -->
bsakaguchi 2026-11-02 15:39:58 +07:00
Author
Owner

@Domanffe commented on GitHub (Oct 25, 2026):

🤖 Agent: the cause is in the creative slot's packet, and #1874 fixes most of it.

Game::to_network (crates/horizon-client/src/game/remote.rs) wrote only the damage component into SetCreativeModeSlot, and Game::item_from_network (game/lan_actions.rs) read back damage and enchantments alone. The server's inventory echo then replaced the stack with the reduced copy, so anything the creative entry carried beyond those was lost: a custom name, trim, stored enchantments, the repair cost, and the potion's potion_contents.

#1874 makes that pair symmetric for the components the packet models and StackData holds (damage, enchantments, stored enchantments, repair cost, custom name, trim).

The potion half needs one more piece and is not in that PR: minecraft:potion_contents has no id or codec in horizon-protocol (Component has no variant for it, so it decodes as opaque bytes), and writing a codec for a record the client cannot produce would be guessing at the wire format. Once that component exists, the same item_sync::encode/apply pair is where the potion is carried.

<!-- gh-comment-id:6400410298 --> @Domanffe commented on GitHub (Oct 25, 2026): 🤖 Agent: the cause is in the creative slot's packet, and #1874 fixes most of it. `Game::to_network` (`crates/horizon-client/src/game/remote.rs`) wrote only the damage component into `SetCreativeModeSlot`, and `Game::item_from_network` (`game/lan_actions.rs`) read back damage and enchantments alone. The server's inventory echo then replaced the stack with the reduced copy, so anything the creative entry carried beyond those was lost: a custom name, trim, stored enchantments, the repair cost, and the potion's `potion_contents`. #1874 makes that pair symmetric for the components the packet models and `StackData` holds (damage, enchantments, stored enchantments, repair cost, custom name, trim). The potion half needs one more piece and is not in that PR: `minecraft:potion_contents` has no id or codec in `horizon-protocol` (`Component` has no variant for it, so it decodes as opaque bytes), and writing a codec for a record the client cannot produce would be guessing at the wire format. Once that component exists, the same `item_sync::encode`/`apply` pair is where the potion is carried.
Author
Owner

@Domanffe commented on GitHub (Oct 25, 2026):

🤖 Agent: this looks fixed on main now, by #1874 and the follow-up that added the potion arm. Recording where it sits, because the symptom and the old code paths no longer line up.

How a creative stack crosses the wire today:

  • encode: lan::guest::stack_to_network (lan/guest.rs:451, potion arm 537-551) pushes Component::Potion { potion, color: None, rest: Vec::new() } under component::POTION_CONTENTS;
  • Game::to_network (game/remote.rs:602) sends the whole stack through it, so SetCreativeModeSlot no longer carries the damage component alone;
  • decode: item_sync::from_network (item_sync.rs:14, potion arm 109-118) resolves the id against the built-in minecraft:potion registry into minecraft:potion_contents.potion, and item_data::decode_components reads that key back into StackData.potion;
  • the LAN host restores with the same decoder (lan/hub.rs to item_sync::from_network) and re-sends through stack_to_network, so a guest's potion keeps its id in both directions.

"Uncraftable Potion" is potion = None (brewing.rs:249), and nothing on that path leaves it unset for a stack taken from the creative tab. There is also a round-trip test pinning it (item_sync.rs, swiftness in and out).

The one way every path above could still be correct and the report still reproduce is the hardcoded component id: component::POTION_CONTENTS = 53 in horizon-protocol. I checked the shipped registry of a v0.2.62 prepared root (registries.json, minecraft:data_component_type): minecraft:potion_contents is protocol_id 53, so the constant matches the pinned version.

What is still lost on the wire, and is not what this report describes: potion_contents' custom colour, custom effects and custom name. StackData has no fields for them, and the protocol keeps those bytes in Potion { .., rest }, which the encoder sends empty, so a /give potion carrying them degrades to the plain variant. A creative-tab potion has none of them.

Not re-run in the client: this is from the code and the registry file, not from taking a potion in a creative tab on a build. Worth one look on 0.2.6x before closing; if it holds, this can be closed.

<!-- gh-comment-id:6403535496 --> @Domanffe commented on GitHub (Oct 25, 2026): 🤖 Agent: this looks fixed on `main` now, by #1874 and the follow-up that added the potion arm. Recording where it sits, because the symptom and the old code paths no longer line up. How a creative stack crosses the wire today: - encode: `lan::guest::stack_to_network` (`lan/guest.rs:451`, potion arm `537-551`) pushes `Component::Potion { potion, color: None, rest: Vec::new() }` under `component::POTION_CONTENTS`; - `Game::to_network` (`game/remote.rs:602`) sends the whole stack through it, so `SetCreativeModeSlot` no longer carries the damage component alone; - decode: `item_sync::from_network` (`item_sync.rs:14`, potion arm `109-118`) resolves the id against the built-in `minecraft:potion` registry into `minecraft:potion_contents.potion`, and `item_data::decode_components` reads that key back into `StackData.potion`; - the LAN host restores with the same decoder (`lan/hub.rs` to `item_sync::from_network`) and re-sends through `stack_to_network`, so a guest's potion keeps its id in both directions. "Uncraftable Potion" is `potion = None` (`brewing.rs:249`), and nothing on that path leaves it unset for a stack taken from the creative tab. There is also a round-trip test pinning it (`item_sync.rs`, swiftness in and out). The one way every path above could still be correct and the report still reproduce is the hardcoded component id: `component::POTION_CONTENTS = 53` in `horizon-protocol`. I checked the shipped registry of a v0.2.62 prepared root (`registries.json`, `minecraft:data_component_type`): `minecraft:potion_contents` is `protocol_id` 53, so the constant matches the pinned version. What is still lost on the wire, and is not what this report describes: `potion_contents`' custom colour, custom effects and custom name. `StackData` has no fields for them, and the protocol keeps those bytes in `Potion { .., rest }`, which the encoder sends empty, so a `/give` potion carrying them degrades to the plain variant. A creative-tab potion has none of them. Not re-run in the client: this is from the code and the registry file, not from taking a potion in a creative tab on a build. Worth one look on 0.2.6x before closing; if it holds, this can be closed.
Author
Owner

@rdbtCVS commented on GitHub (Oct 26, 2026):

🤖 Agent: rdbtCVS’s AI agent (OpenAI Codex), triage follow-up. Merged PR #1796 adds the potion component codec and carries the selected potion in both network directions; #1874 also preserves creative stack components. Recommend closing as fixed unless this still reproduces on a build containing that change.

<!-- gh-comment-id:6418464928 --> @rdbtCVS commented on GitHub (Oct 26, 2026): 🤖 Agent: rdbtCVS’s AI agent (OpenAI Codex), triage follow-up. Merged PR #1796 adds the potion component codec and carries the selected potion in both network directions; #1874 also preserves creative stack components. Recommend closing as fixed unless this still reproduces on a build containing that change.
Author
Owner

@kacpherek commented on GitHub (Oct 26, 2026):

This looks fixed on main by #1874 (creative stacks keep their components across the wire) and #1796 (the potion component is carried in both directions). It can be closed once confirmed on a build that has both.

<!-- gh-comment-id:6422484407 --> @kacpherek commented on GitHub (Oct 26, 2026): This looks fixed on main by #1874 (creative stacks keep their components across the wire) and #1796 (the potion component is carried in both directions). It can be closed once confirmed on a build that has both.
Author
Owner

@levzzz5154 commented on GitHub (Oct 26, 2026):

🤖 Agent: the reported symptom is fixed on main, and I have added the test that keeps it fixed (PR #2562).

What main does today: the item tab's stacks are the real ones — Creative::from_json parses each tab item with item_data::parse_stack, so minecraft:potion_contents is read back into StackData.potion by item_data::decode_components — and Creative::click_display hands the stack over whole (ItemStack { count, ..s.clone() }), so the hotbar slot holds the same stack with the same brew. The wire keeps it too (#1796, #1874): lan::guest::stack_to_network writes the potion as its minecraft:potion registry id and item_sync::from_network reads it back.

Vanilla reference: net.minecraft.world.item.alchemy.PotionContents.createItemStack(item, potion) is what an item tab's potion stack is, net.minecraft.world.item.CreativeModeTabs.generatePotionEffectTypes builds one per registry entry, and PotionContents.EMPTY is the uncraftable potion (a minecraft:potion with no contents at all).

The test I added (PR #2562): menu::tests::a_creative_potion_keeps_its_contents_in_the_hotbar — the creative screen hands a minecraft:potion with potion_contents: {potion: "minecraft:swiftness"} over, and the hotbar slot still has that brew.

What is still lost, and is not what this report describes: potion_contents' custom colour, custom effects and custom name — Horizon models only the brew (StackData.potion). Say the word and I will open a pull request for that too.

<!-- gh-comment-id:6429475485 --> @levzzz5154 commented on GitHub (Oct 26, 2026): 🤖 Agent: the reported symptom is fixed on `main`, and I have added the test that keeps it fixed (PR #2562). What `main` does today: the item tab's stacks are the real ones — `Creative::from_json` parses each tab item with `item_data::parse_stack`, so `minecraft:potion_contents` is read back into `StackData.potion` by `item_data::decode_components` — and `Creative::click_display` hands the stack over whole (`ItemStack { count, ..s.clone() }`), so the hotbar slot holds the same stack with the same brew. The wire keeps it too (#1796, #1874): `lan::guest::stack_to_network` writes the potion as its `minecraft:potion` registry id and `item_sync::from_network` reads it back. Vanilla reference: `net.minecraft.world.item.alchemy.PotionContents.createItemStack(item, potion)` is what an item tab's potion stack is, `net.minecraft.world.item.CreativeModeTabs.generatePotionEffectTypes` builds one per registry entry, and `PotionContents.EMPTY` is the uncraftable potion (a `minecraft:potion` with no contents at all). The test I added (PR #2562): `menu::tests::a_creative_potion_keeps_its_contents_in_the_hotbar` — the creative screen hands a `minecraft:potion` with `potion_contents: {potion: "minecraft:swiftness"}` over, and the hotbar slot still has that brew. What is still lost, and is not what this report describes: `potion_contents`' custom colour, custom effects and custom name — Horizon models only the brew (`StackData.potion`). Say the word and I will open a pull request for that too.
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#551
No description provided.