[GH-ISSUE #3305] Suggestions and few station bugs from porting content mods (item properties, hardcoded item IDs, smithing recipes) #922

Open
opened 2026-11-02 15:42:53 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SolomonNumb1 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3305

1.stations.rs ignores object ingredients in smithing recipes

In crates/horizon-client/src/crafting.rs, Ingredient::parse properly handles Value::Object (e.g. {"item": "..."} or {"tag": "..."})
in crates/horizon-client/src/stations.rs (around line 485), the local ingredient() function only checks for Value::String and Value::Array:

for s in match v {
    Value::String(s) => vec![s.clone()],
    Value::Array(a) => a.iter().filter_map(|x| x.as_str().map(str::to_owned)).collect(),
    _ => vec![],
}

Because modern 1.21 datapack/mod recipes often serialize ingredients as objects ("template": {"item": "..."}), stations.rs parses them into empty lists vec![]. This completely bricks the smithing table for those recipes because smithing_accepts rejects every item

  • Fix suggestion: Sync stations.rs ingredient() logic with crafting.rs to unwrap {"item": "..."} and {"tag": "..."}

2. Item mechanics hardcoded to exact vanilla IDs (Mace, Trident)

special weapon mechanics check exact string matches against vanilla IDs:

  • In game/mace.rs: .is_some_and(|s| &*s.item == "minecraft:mace")
  • In game/trident.rs: if &*stack.item == "minecraft:trident"
    If a mod registers a custom item with template: "minecraft:mace" or minecraft:trident, it doesn't get the smash attack or throwing ability because the ID check fails
  • Suggestion: Check whether the item's template is a mace/trident (or check item properties/tags) instead of matching &*s.item == "minecraft:...".

3. Custom properties for items in ItemFile

Blocks have a nice properties map (hardness, light, friction, etc.), but ItemFile in crates/horizon-mods/src/content.rs only allows max_stack_size and rarity (with #[serde(deny_unknown_fields)]):

struct ItemFile {
    template: String,
    max_stack_size: Option<u8>,
    rarity: Option<Rarity>,
}

Because of this, any modded sword or pickaxe is stuck with the exact mining speed and attack damage of its vanilla template

  • Suggestion: It would be awesome to add an optional properties field to ItemFile (e.g., attack_damage, mining_speed, armor) so tier progression in mods can actually feel distinct
Originally created by @SolomonNumb1 on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3305 ### 1.`stations.rs` ignores object ingredients in smithing recipes In `crates/horizon-client/src/crafting.rs`, `Ingredient::parse` properly handles `Value::Object` (e.g. `{"item": "..."}` or `{"tag": "..."}`) in `crates/horizon-client/src/stations.rs` (around line 485), the local `ingredient()` function only checks for `Value::String` and `Value::Array`: ``` for s in match v { Value::String(s) => vec![s.clone()], Value::Array(a) => a.iter().filter_map(|x| x.as_str().map(str::to_owned)).collect(), _ => vec![], } ``` Because modern 1.21 datapack/mod recipes often serialize ingredients as objects (`"template": {"item": "..."}`), `stations.rs` parses them into empty lists `vec![]`. This completely bricks the smithing table for those recipes because `smithing_accepts` rejects every item * **Fix suggestion:** Sync `stations.rs` `ingredient()` logic with `crafting.rs` to unwrap `{"item": "..."}` and `{"tag": "..."}` --- ### 2. Item mechanics hardcoded to exact vanilla IDs (Mace, Trident) special weapon mechanics check exact string matches against vanilla IDs: - In `game/mace.rs`: `.is_some_and(|s| &*s.item == "minecraft:mace")` - In `game/trident.rs`: `if &*stack.item == "minecraft:trident"` If a mod registers a custom item with `template: "minecraft:mace"` or `minecraft:trident`, it doesn't get the smash attack or throwing ability because the ID check fails * **Suggestion:** Check whether the item's template is a mace/trident (or check item properties/tags) instead of matching `&*s.item == "minecraft:..."`. --- ### 3. Custom `properties` for items in `ItemFile` Blocks have a nice `properties` map (`hardness`, `light`, `friction`, etc.), but `ItemFile` in `crates/horizon-mods/src/content.rs` only allows `max_stack_size` and `rarity` (with `#[serde(deny_unknown_fields)]`): ``` struct ItemFile { template: String, max_stack_size: Option<u8>, rarity: Option<Rarity>, } ``` Because of this, any modded sword or pickaxe is stuck with the exact mining speed and attack damage of its vanilla template * **Suggestion:** It would be awesome to add an optional `properties` field to `ItemFile` (e.g., `attack_damage`, `mining_speed`, `armor`) so tier progression in mods can actually feel distinct
Author
Owner

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

🤖 Agent: written by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves.

Status on main:

  1. Smithing ingredients as objects: fixed by #3384 (merged). stations.rs now parses them with Ingredient::parse.
  2. Item properties: fixed by #3739 (merged). A content mod's item file can carry components, a data component patch over its template (horizon-mods/src/content.rs).
  3. Mace and trident behaviour is still tied to the exact vanilla ids (game/mace.rs:100, game/trident.rs:176). This part is still open; #3739 calls it a design question for the maintainer.
<!-- gh-comment-id:6504422141 --> @levzzz5154 commented on GitHub (Oct 29, 2026): 🤖 Agent: written by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves. Status on main: 1. Smithing ingredients as objects: fixed by #3384 (merged). `stations.rs` now parses them with `Ingredient::parse`. 3. Item properties: fixed by #3739 (merged). A content mod's item file can carry `components`, a data component patch over its template (`horizon-mods/src/content.rs`). 2. Mace and trident behaviour is still tied to the exact vanilla ids (`game/mace.rs:100`, `game/trident.rs:176`). This part is still open; #3739 calls it a design question for the maintainer.
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#922
No description provided.