Skip to content

Resource Generator

Sky James edited this page Aug 28, 2023 · 3 revisions

The Resource Generator contains information about potential loot that can be generated each resource generation cycle. There are several built-in resource generators; see each entry for usage and details.

Usage

Create a JSON file located at data/[namespace]/axolootl/resource_generators/[path].json where [namespace]:[path] is the ID of the Resource Generator. Names must be lowercase and contain no spaces.

Data

The following data is required for all resource generators.

  • type (namespaced ID)
    • The registry ID of the Resource Generator

Item Stack

Many Resource Generator JSONs require Item Stacks. In most cases, the entire Item Stack can be defined, or for an Item Stack with one item and no NBT data, the item ID is sufficient.

The following are equivalent:

"item": "minecraft:bread"
"item": {
  "id": "minecraft:bread",
  "Count": 1
}

Weighted List

Many Resource Generator JSONs require weighted lists of varying types. Weighted Lists are a list of Weighted Entry objects. The probability of each entry is entry weight / total weight

Data

  • weight (number) Required
    • The entry weight. Must be greater than 0.
  • data (object) Required
    • Some object JSON values. For example, an Item Stack weighted list requires either the item ID or an object with id and Count

JSON Format

"weighted_list": [
  {
    "weight": 3, # the weight of the first entry
    "data": "minecraft:bread" # an item stack data entry, for example
  },
  {
    "weight": 1, # the weight of the second entry
    "data": { # an item stack data entry, for example
      "id": "minecraft:bread",
      "Count": 2
    }
  }
]

Empty Resource Generator

Generates no items.

Data

[none]

JSON Format

The following Resource Generator generates nothing.

{
  "type": "axolootl:empty"
}

Reference Resource Generator

References another registered Resource Generator

Data

  • id (namespaced ID) Required
    • The Resource Generator ID

JSON Format

The following Resource Generator generates the same items as the Resource Generator at data/axolootl/axolootl/resource_generators/stone.json

{
  "type": "axolootl:reference",
  "id": "axolootl:stone"
}

Item Resource Generator

Selects a single Item Stack from a list of one or more Item Stacks.

Data

JSON Format

The following Resource Generator generates 1 bread.

{
  "type": "axolootl:item",
  "item": "minecraft:bread"
}

The following Resource Generator has a 2/3 chance to generate 1 bread and a 1/3 chance to generate 5 bread.

{
  "type": "axolootl:item"
  "item": [
    {
      "weight": 2,
      "data": "minecraft:bread"
    },
    {
      "weight": 1,
      "data": {
        "id": "minecraft:bread",
        "Count": 5
      }
    }
  ]
}

Item Tag Resource Generator

Selects a single item from an item tag.

Data

  • tag (namespaced ID) Required

JSON Format

The following Resource Generator generates a random item from the forge:rods/wooden item tag.

{
  "type": "axolootl:tag",
  "tag": "forge:rods/wooden"
}

Block Resource Generator

Contains one or more block states and generates the same items that would result from breaking the block with an optional tool.

Data

  • tool (Item Stack) Optional
    • The item to simulate breaking a block. Defaults to no item.
  • block_provider (Block State Provider) Required
    • The Block State Provider to determine which block to simulate. For best results, use "minecraft:simple_state_provider" or "minecraft:weighted_state_provider"

JSON Format

The following Resource Generator generates the same loot that would drop when breaking a gravel block with a stone shovel that is enchanted with Fortune I.

{
  "type": "axolootl:block",
  "tool": {
    "id": "minecraft:stone_shovel",
    "Count": 1,
    "tag": {
      "Enchantments": [
        {
          "id": "minecraft:fortune",
          "lvl": 1
        }
      ]
    }
  },
  "block_provider": {
    "type": "minecraft:simple_state_provider",
    "state": {
      "Name": "minecraft:gravel"
    }
  }
}

Mob Resource Generator

Rolls an entity death loot table.

Loot Table Entry

Contains the Loot Table ID and an Item Stack to display when summarizing loot drops. This is necessary because loot tables are a "black box" and the result items cannot be known ahead of time.

Data

The Loot Table Entry can be defined by a single Loot Table ID (which will display a stone sword) or a combination of Loot Table ID and the icon to display.

  • id (namespaced ID) Required
    • The Loot Table ID
  • display (Item Stack) Optional
    • The Item Stack to show the player when summarizing resource generator results

Data

JSON Format

The following Resource Generator generates random loot from the Creeper loot table with the default icon.

{
  "type": "axolootl:mob",
  "loot_table": "minecraft:entities/creeper"
}

The following Resource Generator generates random loot from the Creeper loot table with a display icon of a creeper head.

{
  "type": "axolootl:mob",
  "loot_table": {
    "id": "minecraft:entities/creeper",
    "display": "minecraft:creeper_head"
  }
}

The following Resource Generator has a 3/5 chance to generate random loot from the Creeper loot table and 2/5 chance to generate random loot from the Yellow Sheep loot table.

{
  "type": "axolootl:mob",
  "loot_table": [
    {
      "weight": 3,
      "data": {
        "id": "minecraft:entities/creeper",
        "display": "minecraft:creeper_head"
      }
    },
    {
      "weight": 2,
      "data": "minecraft:entities/sheep/yellow"
    }
  ]
}

Select Resource Generator

Contains a Weighted List of Resource Generator references or definitions. One Resource Generator is chosen at random to generate items.

Data

  • rolls (number) Optional
    • The number of times to randomly select and apply a resource generator. Defaults to 1
  • pool (Weighted List) Required
    • A Weighted List of Resource Generator IDs or definitions

JSON Format

The following Resource Generator has a 3/5 chance to generate bread, 1/5 chance to generate an item from the "minecraft:fishes" tag, and 1/5 chance to generate nothing.

{
  "type": "axolootl:select",
  "pool": [
    {
      "weight": 3,
      "data": {
        "type": "axolootl:item",
        "item": "minecraft:bread"
      }
    },
    {
      "weight": 1,
      "data": {
        "type": "axolootl:tag",
        "tag": "minecraft:fishes"
      }
    },
    {
      "weight": 1,
      "data": "axolootl:empty"
    }
  ]
}

And Resource Generator

Contains a Holder Set of Resource Generator references or definitions and combines the results.

Data

JSON Format

The following Resource Generator generates random loot from the Creeper loot table and 4 experience bottles.

{
  "type": "axolootl:and",
  "values": [
    {
      "type": "axolootl:mob",
      "loot_table": {
        "id": "minecraft:entities/creeper",
        "display": "minecraft:creeper_head"
      }
    },
    {
      "type": "axolootl:item",
      "item": {
        "id": "minecraft:experience_bottle",
        "Count": 4
      }
    }
  ]
}
Clone this wiki locally