Skip to content

docs: Document public API for customizing gravel sieve ore probabilities#136

Closed
Copilot wants to merge 1 commit intomasterfrom
copilot/exclude-ores-from-gravel-sieve
Closed

docs: Document public API for customizing gravel sieve ore probabilities#136
Copilot wants to merge 1 commit intomasterfrom
copilot/exclude-ores-from-gravel-sieve

Conversation

Copy link

Copilot AI commented Mar 19, 2026

Users had no way to discover that gravelsieve exposes a public API for excluding or adjusting ore drop probabilities, requiring code inspection to find it.

Changes

  • README: Document the gravelsieve.set_probabilities() API, including how to exclude specific ores by setting their probability to 0

Usage

From a dependent mod (declare gravelsieve in mod.conf):

gravelsieve.set_probabilities({
    ["default:gravel"] = {
        ["default:gold_lump"] = 0,   -- excluded
        ["default:diamond"] = 0,     -- excluded
    }
})

Remaining probabilities are automatically normalized. The call is safe to make at load time — all overrides are merged after all mods have loaded, so load order doesn't matter.

Original prompt

This section details on the original issue you should resolve

<issue_title>excluding ores from the gravel sieve</issue_title>
<issue_description>is there a way I can easily exclude ores from being able to be sieved?</issue_description>

<agent_instructions>Can you answer this. My guess the minetest.after(2,... is after the list output</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@joe7575 Yes, this is possible without modifying the gravelsieve code! The mod exposes a public API for this.

From your own mod (which should list gravelsieve as a dependency in mod.conf), call:

gravelsieve.set_probabilities({
    ["default:gravel"] = {
        ["mymod:ore_i_want_excluded"] = 0,
        -- add more ores to exclude here
    }
})

Setting an ore's probability to 0 effectively excludes it from sieving results. The remaining probabilities are automatically normalized.

This works because gravelsieve.set_probabilities() collects all overrides and merges them after all mods have loaded, so load order doesn't matter as long as the dependency is declared.

@joe7575 No, the standalone [Minetest-Gravelsieve](https://github.com/joe7575/Minetest-Gravelsieve) does not have the `set_probabilities()` API — that was added later in the techpack version.

However, the gravelsieve.ore_probability table is global, so you can still remove ores from another mod. You just need to do it after the ore table is populated (which happens via minetest.after(2, ...)):

-- In your own mod's init.lua (with gravelsieve as dependency):
minetest.after(2, function()
    gravelsieve.ore_probability["default:gold_lump"] = nil
    gravelsieve.ore_probability["default:diamond"] = nil
    -- remove any other ores you want to exclude
end)

Setting the entry to nil removes the ore entirely from possible sieve results.</comment_new>


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI requested a review from joe7575 March 19, 2026 10:48
Copilot stopped work on behalf of joe7575 due to an error March 19, 2026 10:48
Copilot AI changed the title [WIP] Exclude ores from being able to be sieved docs: Document public API for customizing gravel sieve ore probabilities Mar 19, 2026
@joe7575 joe7575 closed this Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

excluding ores from the gravel sieve

2 participants