fzzyhmstrs / EMI_loot

12 stars 10 forks source link

incorrect chances when reading percent chances via API for block and chest loot. #46

Closed walksanatora closed 1 week ago

walksanatora commented 8 months ago

currently, when reading API it always reads as having a 100% chance to get that item. when in reality the % is diffrent. this should hopefully be a simple change in BlockLootRecipe.java probably just weight/100f to get the actual chance

fzzyhmstrs commented 8 months ago

You might be conflating a conditional chance and the rolled weight? I'd have to take a closer look, and an example of the exact case you are checking (including entire loot table) would help. If there is an item that is the only item in a pool, but has a Condition that it only appears X% of the time, it will roll "100%" of the time per that tooltip, with the condition added on separately that the pool itself only rolls "X%" (the icons next to the item)

walksanatora commented 8 months ago

here is a example. block drops for leaves.

    {
        "id": {
            "namespace": "emi",
            "path": "emi_loot/block_drops/minecraft/blocks/oak_leaves"
        },
        "type": {
            "namespace": "emi_loot",
            "path": "block_drops"
        },
        "input": [],
        "output": [
            {
                "id": {
                    "namespace": "minecraft",
                    "path": "oak_leaves"
                },
                "ammount": 1,
                "chance": 1.0
            },
            {
                "id": {
                    "namespace": "minecraft",
                    "path": "apple"
                },
                "ammount": 1,
                "chance": 1.0
            },
            {
                "id": {
                    "namespace": "minecraft",
                    "path": "stick"
                },
                "ammount": 1,
                "chance": 1.0
            },
            {
                "id": {
                    "namespace": "minecraft",
                    "path": "oak_sapling"
                },
                "ammount": 1,
                "chance": 1.0
            }
        ]
    }

leaves do not have a 100% chance to drop a sapling but the UI and such report it as 100% (or am I just going insane) and in the case of starter chest loot. the bonus chest only has a 29.2% chance per-slot to have oak logs. but it still has 100% according to the EMI recipe

fzzyhmstrs commented 1 week ago

That "chance" field in that output has nothing to do with drop chance (which can be non-deterministic), that's "chance" as defined in EMI's API. Saplings in particular are a tricky example, as they are defined with a "Table Bonus with Fortune" condition, which isn't easily definable because it uses a lookup table. The condition tooltip thus only says "Drops increased with fortune", and that's all it can easily say. In general, as I mentioned, the combination of condition tip and stated chance is the "real" chance.

Wheat seeds for example; these things need to be considered together. It Drops 100% of an item 12.5% of the time.: image image

With the often non-deterministic reality of loot tables, this is about as clear as I can get, since with this same example, drop rate is also increased with fortune, making "chance" non-constant image