Skip to content

Datapack Information

Tyler Hancock edited this page Oct 31, 2023 · 6 revisions

This mod uses the vanilla data pack system to load crops, soils, and fertilizers. This system allows mods, modpacks, and servers to alter the existing content in the mod or add completely new content. This guide assumes that you are already familiar with datapacks and know how to use them. You can learn more about data packs here. If you are developing a modpack it is also recommended to use the Open Loader mod to automatically load your datapacks from the config folder.

Soils

Soil files are used to add support for new soils for the botany pots. Soils determine the type of crops a pot can grow and can also apply a growth modifier to change how fast crops will grow. You can find the vanilla soil files as an example here.

Properties

Soil files have access to the following properties.

  • type: This tells Minecraft what type of data is in your file. Soils will always use botanypots:soil for this value.
  • input: Defines the type of item used to place the soil in the pot. This uses the same format as crafting ingredients and can match items, tags, and other supported ingredient options.
  • display: The block to display inside the pot. You can learn more about customizing these in the DisplayStates section of the guide.
  • categories: An array of categories that the soil can grow. Any crop with at least one matching category can grow in the soil. There is no practical limit to the number of categories you can define.
  • growthModifier: A speed modifier applied to the growth of the crop. A value of 1 will not change the growth time while a value of 2 will make the crop grow twice as fast. Negative values are not allowed, but a value of 0.5 would make the crop grow 50% slower.

Example Soil

{
  "type": "botanypots:soil",
  "input": {
    "item": "minecraft:dirt"
  },
  "display": {
    "block": "minecraft:dirt"
  },
  "categories": [
    "dirt"
  ],
  "growthModifier": 1
}

Crops

Crop files are used to add support for new crops. They define properties such as the growth time of the crop and the items that drop when the crop is harvested. You can find the vanilla crop files as an example here.

Properties

Crops have access to the following properties.

  • type: - This tells Minecraft what type of data is in your file. Crops will always use botanypots:crop for this value.
  • seed: - Defines the type of item used to place the crop in the pot. This uses the same format as crafting ingredients and can match items, tags, and other supported ingredient options.
  • categories: - An array of categories that the crop can grow in. Any soil with at least one matching category can grow the crop. There is no practical limit to the number of categories you can define.
  • growthTicks: - The amount of time in ticks that a normal harvest cycle will take. There are 20 ticks in a second. Most crops take 1200 ticks by default which is a minute.
  • display: - The block to display inside the pot. You can learn more about customizing these in the DisplayStates section of the guide.
  • drops: The items that will drop when the crop is harvested. You can learn more about this in the HarvestDrops section.

HarvestDrops

Each drop has a few properties that you can customize.

  • chance: - The percent chance that the item will drop when the crop is harvested. This is a value from 0 to 1, where 0 is a 0% chance, 0.5 is a 50% chance, and 1 is a 100% chance.
  • output: - The item to output. This uses the same format as crafting recipe outputs.
  • minRolls / maxRolls: - By default each drop entry will only be rolled once however these options will allow you to roll the entry less or more times. This is determined by randomly selecting an inclusive value between the min and max. If you set the min to 0 there is a chance for no drops to generate.

Example Crop

{
  "type": "botanypots:crop",
  "seed": {
    "item": "minecraft:carrot"
  },
  "categories": [
    "dirt",
    "farmland"
  ],
  "growthTicks": 1200,
  "display": {
    "type": "botanypots:aging",
    "block": "minecraft:carrots"
  },
  "drops": [
    {
      "chance": 1.00,
      "output": {
        "item": "minecraft:carrot"
      },
      "minRolls": 1,
      "maxRolls": 2
    },
    {
      "chance": 0.15,
      "output": {
        "item": "minecraft:carrot"
      },
      "minRolls": 1,
      "maxRolls": 2
    }
  ]
}

Fertilizer

Fertilizer files are used to add support for new bonemeal like items. You can find the vanilla fertilizers here.

Properties

Fertilizer files have the following properties.

  • type: This tells Minecraft what type of data is in your file. Fertilizers will always use botanypots:fertilizer for this value.
  • ingredient: Defines the type of item that can be used as a fertilizer. This uses the same format as crafting ingredients and can match items, tags, and other supported ingredient options.
  • min_growth: The minimum amount of growth ticks to add to the growth cycle.
  • max_growth: The maximum amount of growth ticks to add to the growth cycle.

Example

{
  "type": "botanypots:fertilizer",
  "ingredient": {
    "item": "minecraft:bone_meal"
  },
  "min_growth": 400,
  "max_growth": 550
}

Pot Interactions

Pot interactions are a special type of recipe that allow you to work with the items inside of the pot directly. For example right clicking the pot with a hoe to turn dirt into farmland. You can find the vanilla pot interactions as an example here.

Properties

  • type: - This tells Minecraft what type of data is in your file. Pot interactions will always use botanypots:pot_interaction for this value.
  • held_ingredient: - The condition for the held item being used on the pot. This uses the same format as a crafting recipe ingredient.
  • soil_ingredient: - An optional condition for the item in the soil slot. This uses the same format as a crafting recipe ingredient.
  • seed_ingredient: - An optional condition for the item in the seed slot. This uses the same format as a crafting recipe ingredient.
  • soil_output: - An optional item stack to replace the item in the soil slot. This uses the same format as crafting recipe outputs.
  • seed_output: - An optional item stack to replace the item in the seed slot. This uses the same format as crafting recipe outputs.
  • sound: - A sound to play when the interaction takes place.
  • drops: - A list of items to drop when the interaction happens.

Example

{
  "type": "botanypots:pot_interaction",
  "held_ingredient": {
    "tag": "bookshelf:hoes"
  },
  "soil_ingredient": {
    "item": "minecraft:rooted_dirt"
  },
  "soil_output": {
    "item": "minecraft:dirt",
    "count": 1
  },
  "sound": {
    "sound": "minecraft:item.hoe.till",
    "category": "blocks"
  },
  "drops": [
    {
      "item": "minecraft:hanging_roots"
    }
  ]
}

DisplayStates

Display states allow you to customize how a block is rendered by the pot. These consist of a few components and can get very complex if you want them to.

botanypots:simple

A simple display state that renders the blockstate as it is.

Properties

  • block: - The ID of the block to render.
  • properties: - An optional set of blockstate properties.
  • scale: - Scales the block along the x, y, and z axis. Can be used to make the block bigger or smaller.
  • offset: - Offsets the position of the block. This can be used to make renders that are multiple blocks high or have special shapes.
  • rotation: - An array of rotations to apply to the block model.
  • renderFluid: - Some blocks will render a fluid around them by default. Setting this to false will ignore that fluid.

botanypots:transitional

Has the ability to render different block states over time based on the growth progress of the crop. For example if there are 3 phases defined each phase will render for 33% of the time. If there are 5 phases they will each render for 20% of the time.

Properties

  • phases: - An array of display states to render.

botanypots:aging

Similar to botanypots:transitional however the phases are automatically generated behind the scenes based on the age property of the block. This allows blocks like wheat to automatically transition between their growth stages without manually defining all 7 states. If the block doesn't have an age property it will just render using a simple display state based on the default state.

Properties

  • block: - The ID of the block to generate phases from.