Skip to content

Block loot dropChance is calculated wrong #62

Description

@ieperen3039

One of the files generated using this generator is https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.20/blockLoot.json

I noticed that the drop_chance field is always 1 divided by the size of the drops table, which is incorrect.
Consider the entry for "stone":

{
    "block": "stone",
    "drops": [
      {
        "item": "stone",
        "dropChance": 0.5,
        "stackSizeRange": [
          1,
          1
        ],
        "silkTouch": true
      },
      {
        "item": "cobblestone",
        "dropChance": 0.5,
        "stackSizeRange": [
          1,
          1
        ],
        "noSilkTouch": true
      }
    ]
  },

Most blocks that have different drops for silktouch and non-silktouch (like stone and brown_mushroom) have a 1/2 drop chance for both the silk touch drop and the non-silktouch drop.

Blocks that drop items with a 1/3 change are all blocks with 3 possible drops (amethyst_cluster and gilded_blackstone)

The pitcher_crop has 5 different possible drops, all of which have 1/5 drop chance.

It looks like the function lootItemDrop.estimateDropChance(looting?: number, luck?: number) is intended specifically for inventory loot, and should not be used to calculate items dropped from blocks.
I suspect that only weights have to be considered.

I would make a PR myself, but I have no JavaScrip experience or setup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions