Line 538: |
Line 538: |
| | | |
| ==Custom fruit trees== | | ==Custom fruit trees== |
− | Fruit trees are a bit different since they have three separate entities (the sapling item, the fruit tree itself, and the fruit item it produces). Note that the key in <samp>Data/FruitTrees</samp> is the sapling's item ID, and the value references the fruit's item ID. | + | You can now add custom [[Fruit Trees|fruit trees]] by editing the modified <samp>Data/fruitTrees</samp> asset. This consists of a <samp>string</samp>→<samp>string</samp> lookup, where the key is the sapling item ID and the value is a slash (<samp>/</samp>)-delimited list of these fields: |
| + | |
| + | {| class="wikitable" |
| + | |- |
| + | ! index |
| + | ! field |
| + | ! effect |
| + | |- |
| + | | 0 |
| + | | tree ID |
| + | | A key which uniquely identifies this tree. For vanilla trees, this matches the spritesheet index. For custom trees, the ID should only contain alphanumeric/underscore/dot characters. |
| + | |- |
| + | | 1 |
| + | | season |
| + | | The season in which the fruit tree bears fruit. |
| + | |- |
| + | | 2 |
| + | | fruit |
| + | | The unqualified object ID for the fruit it produces. |
| + | |- |
| + | | 3 |
| + | | sapling price |
| + | | The price to purchase the sapling item from a shop. |
| + | |- |
| + | | 4 |
| + | | sprite index |
| + | | The tree's row index in the spritesheet (e.g. 0 for the first tree, 1 for the second tree, etc). If omitted, the game will try to parse the item ID as an index. |
| + | |- |
| + | | 5 |
| + | | texture |
| + | | The asset name for the texture under the game's <samp>Content</samp> folder. Use <samp>\</samp> (or <samp>\\</samp> in JSON) to separate name segments if needed. For example, fruit trees use <samp>TileSheets\fruitTrees</samp> by default. |
| + | |} |
| + | |
| + | For example, this content pack adds a custom fruit tree, including [[#Custom items|custom items]] for the sapling and fruit: |
| | | |
| {{#tag:syntaxhighlight|<nowiki> | | {{#tag:syntaxhighlight|<nowiki> |
Line 560: |
Line 593: |
| "Target": "Data/FruitTrees", | | "Target": "Data/FruitTrees", |
| "Entries": { | | "Entries": { |
− | "Example.ModId_Puffersapling": "0/spring/Example.ModId_Pufferfruit/0/Mods\\Example.ModId\\FruitTrees" | + | "Example.ModId_Puffersapling": "Example.ModId_Puffertree/spring/Example.ModId_Pufferfruit/1000/0/Mods\\Example.ModId\\FruitTrees" |
| } | | } |
| }, | | }, |
Line 572: |
Line 605: |
| ] | | ] |
| }</nowiki>|lang=javascript}} | | }</nowiki>|lang=javascript}} |
| + | |
| + | The fruit trees can then be added to the game by giving the player a sapling item in the usual ways (e.g. from [[#Custom shops|a shop]]). |
| | | |
| ==Custom wild trees== | | ==Custom wild trees== |