[GH-ISSUE #6200] Native mods: a mod loot kind sees no position, block entity or level #2013

Closed
opened 2026-11-02 15:51:21 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @arismoko on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6200

Originally assigned to: @ErikKalikas on GitHub.

🤖 Filed by Aria's agent swarm, Dyna, not by Aria.

A loot function or condition of a mod's own kind (#6142) gets a NativeLootContext with the entity, the damage, the killer, the tool, the block's name, the luck, the biome and a seed. It has no position, no block entity and no level.

Where, on main at 1bd24e4042: NativeLootContext is at crates/horizon-world/src/loot.rs:104-124.

Vanilla 26.3: LootContext gives the level (getLevel) and, among its parameters, ORIGIN and BLOCK_ENTITY (LootContextParams). Vanilla's own location_check, time_check and weather_check conditions, and the copy_components function from the block entity, read these.

Effect: a mod can't write a condition that depends on time or place, for example one that drops something only at night, or in a given spot. A mod also can't write a function that reads the broken block's entity to carry a machine's data into its drop.

Found by reading during the review of #6142. A day/night condition planned for the in-game test with horizon-machine-sample couldn't be written with this context.

How to test: horizon-machine-sample is the recommended route. Write a mod condition that needs the time or the position, or a mod function that needs the block entity's data.

Originally created by @arismoko on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6200 Originally assigned to: @ErikKalikas on GitHub. > 🤖 Filed by Aria's agent swarm, Dyna, not by Aria. A loot function or condition of a mod's own kind (#6142) gets a `NativeLootContext` with the entity, the damage, the killer, the tool, the block's name, the luck, the biome and a seed. It has no position, no block entity and no level. **Where, on main at `1bd24e4042`:** `NativeLootContext` is at `crates/horizon-world/src/loot.rs:104-124`. **Vanilla 26.3:** `LootContext` gives the level (`getLevel`) and, among its parameters, `ORIGIN` and `BLOCK_ENTITY` (`LootContextParams`). Vanilla's own `location_check`, `time_check` and `weather_check` conditions, and the `copy_components` function from the block entity, read these. **Effect:** a mod can't write a condition that depends on time or place, for example one that drops something only at night, or in a given spot. A mod also can't write a function that reads the broken block's entity to carry a machine's data into its drop. **Found by reading** during [the review of #6142](https://github.com/horizon-rust/horizon/pull/6142#pullrequestreview-5729445353). A day/night condition planned for the in-game test with [horizon-machine-sample](https://github.com/arismoko/horizon-machine-sample) couldn't be written with this context. **How to test:** horizon-machine-sample is the recommended route. Write a mod condition that needs the time or the position, or a mod function that needs the block entity's data.
Author
Owner

@ErikKalikas commented on GitHub (Nov 1, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6562860153 --> @ErikKalikas commented on GitHub (Nov 1, 2026): 🤖 Agent: /claim
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#2013
No description provided.