模组:果树数据
阅读
2024-10-15更新
最新编辑:sizau
阅读:
更新日期:2024-10-15
最新编辑:sizau
←目录
不完整的翻译 本文或部分尚未完全翻译成中文。
欢迎您通过编辑帮助其建设。 |
此页面解释该游戏是如何存储和解析果树数据。
原始数据
果树数据存储在Content\Data\FruitTrees.xnb中, 编辑文件时需进行解包。
以下是1.6.8版本的果树原始数据:
数据 |
---|
{
"628": {
"PlantableLocationRules": null,
"DisplayName": "[LocalizedText Strings\\Objects:Cherry_Name]",
"Seasons": [
"Spring"
],
"Fruit": [
{
"Season": null,
"Chance": 1.0,
"Condition": null,
"Id": "Default",
"ItemId": "(O)638",
"RandomItemId": null,
"MaxItems": null,
"MinStack": -1,
"MaxStack": -1,
"Quality": -1,
"ObjectInternalName": null,
"ObjectDisplayName": null,
"ToolUpgradeLevel": -1,
"IsRecipe": false,
"StackModifiers": null,
"StackModifierMode": "Stack",
"QualityModifiers": null,
"QualityModifierMode": "Stack",
"ModData": null,
"PerItemCondition": null
}
],
"Texture": "TileSheets\\fruitTrees",
"TextureSpriteRow": 0,
"CustomFields": null
},
"629": {
"PlantableLocationRules": null,
"DisplayName": "[LocalizedText Strings\\Objects:Apricot_Name]",
"Seasons": [
"Spring"
],
"Fruit": [
{
"Season": null,
"Chance": 1.0,
"Condition": null,
"Id": "Default",
"ItemId": "(O)634",
"RandomItemId": null,
"MaxItems": null,
"MinStack": -1,
"MaxStack": -1,
"Quality": -1,
"ObjectInternalName": null,
"ObjectDisplayName": null,
"ToolUpgradeLevel": -1,
"IsRecipe": false,
"StackModifiers": null,
"StackModifierMode": "Stack",
"QualityModifiers": null,
"QualityModifierMode": "Stack",
"ModData": null,
"PerItemCondition": null
}
],
"Texture": "TileSheets\\fruitTrees",
"TextureSpriteRow": 1,
"CustomFields": null
},
"630": {
"PlantableLocationRules": null,
"DisplayName": "[LocalizedText Strings\\Objects:Orange_Name]",
"Seasons": [
"Summer"
],
"Fruit": [
{
"Season": null,
"Chance": 1.0,
"Condition": null,
"Id": "Default",
"ItemId": "(O)635",
"RandomItemId": null,
"MaxItems": null,
"MinStack": -1,
"MaxStack": -1,
"Quality": -1,
"ObjectInternalName": null,
"ObjectDisplayName": null,
"ToolUpgradeLevel": -1,
"IsRecipe": false,
"StackModifiers": null,
"StackModifierMode": "Stack",
"QualityModifiers": null,
"QualityModifierMode": "Stack",
"ModData": null,
"PerItemCondition": null
}
],
"Texture": "TileSheets\\fruitTrees",
"TextureSpriteRow": 2,
"CustomFields": null
},
"631": {
"PlantableLocationRules": null,
"DisplayName": "[LocalizedText Strings\\Objects:Peach_Name]",
"Seasons": [
"Summer"
],
"Fruit": [
{
"Season": null,
"Chance": 1.0,
"Condition": null,
"Id": "Default",
"ItemId": "(O)636",
"RandomItemId": null,
"MaxItems": null,
"MinStack": -1,
"MaxStack": -1,
"Quality": -1,
"ObjectInternalName": null,
"ObjectDisplayName": null,
"ToolUpgradeLevel": -1,
"IsRecipe": false,
"StackModifiers": null,
"StackModifierMode": "Stack",
"QualityModifiers": null,
"QualityModifierMode": "Stack",
"ModData": null,
"PerItemCondition": null
}
],
"Texture": "TileSheets\\fruitTrees",
"TextureSpriteRow": 3,
"CustomFields": null
},
"632": {
"PlantableLocationRules": null,
"DisplayName": "[LocalizedText Strings\\Objects:Pomegranate_Name]",
"Seasons": [
"Fall"
],
"Fruit": [
{
"Season": null,
"Chance": 1.0,
"Condition": null,
"Id": "Default",
"ItemId": "(O)637",
"RandomItemId": null,
"MaxItems": null,
"MinStack": -1,
"MaxStack": -1,
"Quality": -1,
"ObjectInternalName": null,
"ObjectDisplayName": null,
"ToolUpgradeLevel": -1,
"IsRecipe": false,
"StackModifiers": null,
"StackModifierMode": "Stack",
"QualityModifiers": null,
"QualityModifierMode": "Stack",
"ModData": null,
"PerItemCondition": null
}
],
"Texture": "TileSheets\\fruitTrees",
"TextureSpriteRow": 4,
"CustomFields": null
},
"633": {
"PlantableLocationRules": null,
"DisplayName": "[LocalizedText Strings\\Objects:Apple_Name]",
"Seasons": [
"Fall"
],
"Fruit": [
{
"Season": null,
"Chance": 1.0,
"Condition": null,
"Id": "Default",
"ItemId": "(O)613",
"RandomItemId": null,
"MaxItems": null,
"MinStack": -1,
"MaxStack": -1,
"Quality": -1,
"ObjectInternalName": null,
"ObjectDisplayName": null,
"ToolUpgradeLevel": -1,
"IsRecipe": false,
"StackModifiers": null,
"StackModifierMode": "Stack",
"QualityModifiers": null,
"QualityModifierMode": "Stack",
"ModData": null,
"PerItemCondition": null
}
],
"Texture": "TileSheets\\fruitTrees",
"TextureSpriteRow": 5,
"CustomFields": null
},
"69": {
"PlantableLocationRules": null,
"DisplayName": "[LocalizedText Strings\\Objects:Banana_Name]",
"Seasons": [
"Summer"
],
"Fruit": [
{
"Season": null,
"Chance": 1.0,
"Condition": null,
"Id": "Default",
"ItemId": "(O)91",
"RandomItemId": null,
"MaxItems": null,
"MinStack": -1,
"MaxStack": -1,
"Quality": -1,
"ObjectInternalName": null,
"ObjectDisplayName": null,
"ToolUpgradeLevel": -1,
"IsRecipe": false,
"StackModifiers": null,
"StackModifierMode": "Stack",
"QualityModifiers": null,
"QualityModifierMode": "Stack",
"ModData": null,
"PerItemCondition": null
}
],
"Texture": "TileSheets\\fruitTrees",
"TextureSpriteRow": 7,
"CustomFields": null
},
"835": {
"PlantableLocationRules": null,
"DisplayName": "[LocalizedText Strings\\Objects:Mango_Name]",
"Seasons": [
"Summer"
],
"Fruit": [
{
"Season": null,
"Chance": 1.0,
"Condition": null,
"Id": "Default",
"ItemId": "(O)834",
"RandomItemId": null,
"MaxItems": null,
"MinStack": -1,
"MaxStack": -1,
"Quality": -1,
"ObjectInternalName": null,
"ObjectDisplayName": null,
"ToolUpgradeLevel": -1,
"IsRecipe": false,
"StackModifiers": null,
"StackModifierMode": "Stack",
"QualityModifiers": null,
"QualityModifierMode": "Stack",
"ModData": null,
"PerItemCondition": null
}
],
"Texture": "TileSheets\\fruitTrees",
"TextureSpriteRow": 8,
"CustomFields": null
}
}
|
数据格式
Data/FruitTrees 由以下字符串组成:
字段 | 说明 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DisplayName | 是一个可标记字符串用于放置树种类的名称,其返回值不带“tree”(例如 Cherry 表示为樱桃树)。 | ||||||||||||
Seasons | 果树结果的季节,该数据类型由season names列组成( spring, summer, fall, or winter)。 | ||||||||||||
Fruit | 当果树处于当季时,水果项(fruit items)将每天添加到对应的果树上。
This consists of a list of models with these fields:
| ||||||||||||
Texture | The asset name for the texture under the game's Content folder. Use \ (or \\ in JSON) to separate name segments if needed. For example, vanilla fruit trees use TileSheets\fruitTrees. | ||||||||||||
TextureSpriteRow | The tree's row index in the Texture spritesheet (e.g. 0 for the first tree, 1 for the second tree, etc). | ||||||||||||
PlantableLocationRules | (Optional) The rules to decide which locations you can plant the sapling in, if applicable. The first matching rule is used. This can override location checks (e.g. crops being limited to the farm), but not built-in requirements like crops needing dirt.
This consists of a list of models with these fields:
| ||||||||||||
CustomFields | The custom fields for this entry. |
For example, this content pack adds a custom fruit tree, including custom items for the sapling and fruit:
{
"Format": "2.3.0",
"Changes": [
// add fruit + sapling items
// note: sapling must have an edibility under 0 (usually -300) to be plantable
{
"Action": "EditData",
"Target": "Data/Objects",
"Entries": {
"{{ModId}}_Pufferfruit": {
"Name": "{{ModId}}_Pufferfruit", // best practice to match the ID, since it's sometimes used as an alternate ID
"DisplayName": "Pufferfruit",
"Description": "An example fruit item.",
"Type": "Basic",
"Category": -6,
"Price": 1200,
"Texture": "Mods/{{ModId}}/Objects",
"SpriteIndex": 0
},
"{{ModId}}_Puffersapling": {
"Name": "{{ModId}}_Puffersapling",
"DisplayName": "Puffersapling",
"Description": "An example tree sapling.",
"Type": "Basic",
"Category": -74,
"Price": 1200,
"Texture": "Mods/{{ModId}}/Objects",
"SpriteIndex": 1
}
}
},
// add fruit tree
{
"Action": "EditData",
"Target": "Data/FruitTrees",
"Entries": {
"{{ModId}}_Puffersapling": {
"DisplayName": "Pufferfruit",
"Seasons": [ "spring" ],
"Fruit": [
{
"Id": "E{{ModId}}_Pufferfruit",
"ItemId": "{{ModId}}_Pufferfruit"
}
],
"Texture": "Mods/{{ModId}}/FruitTrees",
"TextureSpriteRow": 0
}
}
},
// add images
{
"Action": "Load",
"Target": "Mods/{{ModId}}/FruitTrees, Mods/{{ModId}}/Objects",
"FromFile": "assets/{{TargetWithoutPath}}.png" // assets/FruitTrees.png, assets/Objects.png
},
]
}
The fruit trees can then be added to the game by giving the player a sapling item in the usual ways (e.g. from a shop).
Fruit items
For C# mods, the fruitsOnTree field (number of fruit on the tree) has been replaced by fruit (list of fruit items).
Spawning fruit trees
Custom trees can be added to the game in two ways:
- Spawn them on map tiles when the location is created, using the new SpawnTree: fruit
<tree ID>
[growth stage on location created]
[growth stage on day-update regrowth]
tile property. This must be added on the Paths layer, which must also have tile index 34 from the paths tilesheet. - Or give the player a seed item in the usual ways (e.g. from a shop, mail letter, etc).