Skip to content

Drop Creators

Harley O'Connor edited this page Jul 20, 2021 · 8 revisions

As of 0.10.0 Beta 18, drop creators for trees are configurable via the tree pack Json system. Note that this is in early stages and will be developed upon and added to in future betas.

Description

Drop creators control which items a dynamic tree should drop. This comes in the form of four different drop types, as listed below:

  • Harvest [dynamictrees:harvest] - Defines the items the tree leaves drop when the tree is harvested.
  • Voluntary [dynamictrees:voluntary] - Defines the items the tree leaves drop randomly over time, usually their seeds.
  • Leaves [dyanmictrees:leaves] - Defines the items the tree leaves drop when the leaves are destroyed individually by the player.
  • Logs [dynamictrees:logs] - Defines the items the tree branches drop when the tree is harvested.

Customisation

The Species Json has a new array property called drop_creators, which is where all custom drop creators will be defined. Just like with gen features, these can be added in two ways:

  1. A string which specifies the registry name of the drop creator. In this case the default configuration properties are used.
  2. A Json object which specified both the registry name of the drop creator under the name key, and the properties of the drop creator as an embedded object under the properties key.

For example, adding a seed drop creator without any properties using the first method can be done as follows:

{
  "drop_creators": [
    "seed"
  ]
}

The species will now drop seeds. However, this can also be done with the second method if you wanted to increase the rarity, for example:

{ 
  "drop_creators": [
    {
      "name": "seed",
      "properties": {
        "rarity": 1.2
      }
    }
  ]
}

This structure applies to all drop creator types. Below are specified the drop creators added by DT itself.

Drop Creator Types

Normal

The most simple drop creator, defining the drops to use for each "drop type". This drop creator's registry name is dynamictrees:normal.

Properties

Key Description Valid Types Default Value
drops A map of drop types, as defined in the description section, to their drops object. Json Object Empty Map

The map above takes a drops object for each drop type. This comes in two types:

Name ID Description Properties
Normal dynamictrees:normal A regular drops list, defined by a list of items it can drop, a rarity, and a chance value.
ID Type Default
items List of item stacks.
rarity Float 1.0
chance Integer 200
Weighted dynamictrees:weighted A weighted drops map. Note that the rarity and chance are evenly split among the drops according to their weight.
ID Type Default
items Map of item registry names to their weight.
rarity Float 1.0
chance Integer 200

Examples

For example, if you wanted to make apple tree leaves drop apples on harvest, you could add the below to the apple tree Json:

{
  "_comment": "Other Apple species properties here...",
  "drop_creators": [
    "log",
    "stick",
    {
      "name": "normal",
      "properties": {
        "drops": {
          "harvest": {
            "id": "normal",
            "properties": {
              "items": [
                {
                  "id": "apple",
                  "Count": 1
                }
              ]
            }
          }
        }
      }
    }
  ]
}

Alternatively, if you wanted the apple tree to have a 1 in 4 chance per apple drop to instead drop a golden apple, you could use a weighted drops list as below:

{
  "_comment": "Other Apple species properties here...",
  "drop_creators": [
    "log",
    "stick",
    {
      "name": "normal",
      "properties": {
        "drops": {
          "harvest": {
            "id": "weighted",
            "properties": {
              "items": {
                "apple": 3,
                "golden_apple": 1
              },
              "rarity": 0.8
            }
          }
        }
      }
    }
  ]
}

Loot Table

Probably the most customisable drop creator, allowing you to take full advantage of vanilla's drop creator Jsons.