-
Notifications
You must be signed in to change notification settings - Fork 99
Drop Creators
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.
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.
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:
- A string which specifies the registry name of the drop creator. In this case the default configuration properties are used.
- 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 theproperties
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 is the default drop creator configuration, if no drop_creators
property is specified:
{
"drop_creators": [
"log",
"seed",
"stick"
]
}
These are cleared if a new list is defined so that if, for example, you didn't want any drop creators active you could do the following:
{
"drop_creators": []
}
The most simple drop creator, defining the drops to use for each "drop type". This drop creator's registry name is dynamictrees:normal
.
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. |
|
||||||||||||
Weighted | dynamictrees:weighted |
A weighted drops map. Note that the rarity and chance are evenly split among the drops according to their weight. |
|
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
}
}
}
}
}
]
}
Probably the most customisable drop creator, allowing you to take full advantage of vanilla's drop creator Jsons.