Dragon Egg Loot Modifiers - MWall541/Dragon-Mounts-Legacy GitHub Wiki

โ””โ”€โ”€โ”€data
    โ””โ”€โ”€โ”€example_addon
        โ””โ”€โ”€โ”€loot_modifiers
                egg_chance_by_config.json
                egg_chance_by_random.json
                replace_first_example.json

Forge introduces a feature called "Loot Modifiers" where mod developers can define behavior as a result of loot generation. An instance of a type is defined in json. Dragon Mounts implements a dragonmounts:dragon_egg_loot type loot modifier, which is used to determine what loot table a dragon egg might appear in, and what breed of the egg.

This page will go in depth of each possible entry for a new type loot modifier using dragonmounts:dragon_egg_loot

"type"

Expects: String (Resource location pointing to the type of loot modifier)

Example: "type": "dragonmounts:dragon_egg_loot"

The type of loot modifier to use. This is a forge provided property, so I won't go in depth about it. It's self explanatory, and this page assumes your using dragonmounts:dragon_egg_loot anyway.

"egg_breed"

Expects: String (Resoource location pointing to the type of dragon breed)

Example: "egg_breed": "example_addon:example_breed"

This is the type of breed the egg will be when it appears in the loot table(s) that we are modifying.

"replace_first" (Optional)

Defaults to: false

Expects: Boolean

Example: "replace_first": true

Setting this to true will replace the very first generated item in the loot table. This is useful for situations where only one item from the loot table is desired, since the default behavior of the dragon_egg_loot type simply adds a new dragon egg item to the collection of generated items. A major example for usage is in Archaeology type loot tables with suspicious sand/gravel. Brushing expects only one item to appear, which makes sense. If this was false in a brushing context, the egg would never appear since it'll always be the second item. If this was true, it would appear. (Assuming all conditions are met.)

"conditions"

Expects: A list of condition types

Example:

  "conditions": [
    {
      "condition": "forge:loot_table_id",
      "loot_table_id": "minecraft:chests/simple_dungeon"
    },
    {
      "condition": "minecraft:random_chance",
      "chance": 0.25
    }
  ]

Another forge provided property. I again won't go much in depth about it. It takes in a list of loot condition type objects, which you'd typically use in normal loot tables.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ