Skip to content

Datapack Information

Tyler Hancock edited this page Dec 5, 2019 · 6 revisions

This mod uses the vanilla data pack system to load all of it's data. If you run a mod pack or a server you can create custom data packs to alter the mod or add support for additional features. If you are a mod developer you can also use your mod's data folder to add built in support for Botany Pots without any Java code!

Quick Links

Soil

Soil files are used to add support for new soil blocks. They define the item used to get the soil into the pot and several other properties. Soil files are loaded from data/botanypots_soils/modid/ where modid is the namespace for your mod or datapack. You can find examples of all default soils here.

Here is a break down of the various properties of a crop file followed by an example file and a summary.

  • input - The item used to get the fertilizer. This uses the vanilla Ingredient format and can be an item, an item tag, or even a list of items. For best results it is recommended that only one item is defined as an input.
  • display - This is the block displayed in the pot. The sub tag of block is used to define the block to display. The sub tag of properties is an optional tag that can be used to specify block state properties such as the age or rotation.
  • categories - This is an array of category strings. These are used to match crops to their valid soils.
  • ticks - This is the amount of world ticks it takes for the soil to produce a growth tick for a crop. Higher numbers mean that crops will take longer to grow.
{
  "input": {
    "item": "minecraft:dirt"
  },
  "display": {
    "block": "minecraft:dirt"
  },
  "categories": ["dirt"],
  "ticks": 250
}

To sumarize the above json, this defines a new soil in the dirt category. It has a base growth tick rate of 250 world ticks. It is obtained by putting dirt in a pot, and will look like dirt.

Crops

Crop files are used to add support for new crops. They define the seed to plant the crop, what the crop produces, and several other things. Crop files are loaded from data/botanypots_crops/modid/ where modid is the namespace for your mod or datapack. You can find all default crops here.

Here is a break down of the various properties of a crops file followed by an example file.

  • seed - This is the seed item that is used to plant the crop. You can use item tags or any other format that is supported by a vanilla ingredient, although it is recommended to only have one valid seed input.
  • categories - This is an array of strings which contain all the soil categories that the crop can be planted on.
  • growthTicks - The number of growth ticks required for the crop to be ready for harvest. The higher the value the longer it will take to grow. This can not be 0 or negative.
  • growthModifier - A general modifier added to the growth time for the crop. The higher the value the longer it will take. Lower than 1 will speed it up. This can not be 0 or negative.
  • display - This is the block displayed when the crop grows. The sub tag of block is used to define the block to display. The sub tag of properties is an optional tag that can be used to specify block state properties such as the age or rotation.
  • results - Results is an array of items that the crop can yield when harvested. Each entry has a percent chance value which is rolled for each entry. If the check succeeds then the yield will contain the result's output which is an ItemStack object. They will also get between minRolls and *maxRolls copies of that item.
{
  "seed": {
    "item": "minecraft:wheat_seeds"
  },
  "categories":["farmland"],
  "growthTicks": 3,
  "growthModifier": 1.2,
  "display": {
    "block": "minecraft:wheat",
    "properties": {
      "age": 7
    }
  },
  "results": [
    {
      "chance": 0.75,
      "output": {
        "item": "minecraft:wheat"
      },
      "minRolls": 1,
      "maxRolls": 1
    },
    {
      "chance": 0.05,
      "output": {
        "item": "minecraft:wheat"
      },
      "minRolls": 1,
      "maxRolls": 2
    },
    {
      "chance": 0.05,
      "output": {
        "item": "minecraft:wheat_seeds"
      },
      "minRolls": 1,
      "maxRolls": 2
    }
  ]
}

To summarize the above json, it adds a wheat crop that is created by using a wheat seed on any soil in the farmland category. It will be displayed as the max growth stage of the crop block while rendering. There is a 75% chance that the crop will yield one wheat, and a 5% chance that it will yield an additional one to two wheat, and another 5% chance that it will drop one to two wheat seeds. The crop will take soilTicks X 1.2 X 3 ticks to mature.

Fertilizer

Fertilizer files are used to add support for new fertilizer items. Players can use fertilizer items to temporarily speed up the growing time of a crop. Fertilizers are loaded from data/botanypots_fertilizers/modid/ where modid is the namespace for your mod or data pack. You can find all default fertilizers here.

Here is a break down of the various properties of a fertilizer file followed by an example file and a summary.

  • fertilizer - This is the item to assign the fertilizer properties to. This is an ingredient meaning you can use an item, an item tag, or even a list of items.
  • minTicks - The lowest amount of ticks to accelerate the growth of the crop by.
  • maxTicks - The highest amount of ticks to accelerate the growth of the crop by.
{
  "fertilizer": {
    "item": "minecraft:bone_meal"
  },
  "minTicks": 50,
  "maxTicks": 80
}

To summarize the above file, this defines bone meal as a fertilizer. When bone meal is right clicked on a botany pot it will accelerate the growth time by 50 to 80 world ticks.

Clone this wiki locally