Wiki 9Minecraft Wiki 9Minecraft

How to Add a Custom Crop to Botany Pots with KubeJS

Java EditionModGuides 4FAQ 10Related mods 48
DownloadKubeJS Botany Pots Mod

Get the files on 9Minecraft

Writing the Crop Recipe

Crops in this mod are registered through a server script event. Create a .js file in your kubejs/server_scripts folder and use ServerEvents.recipes. The crop method takes a seed item, a list of soil categories it can grow on, a display block, a loot array, and a growth tick value.

`js

ServerEvents.recipes(event => {

event.recipes.botanypots.crop(

"minecraft:wheat_seeds",

["dirt"],

{ block: "minecraft:wheat" },

[Item.of("minecraft:wheat").withChance(100).withRolls(1, 3)],

1200,

1

)

})

`

Understanding Each Argument

  • Seed item: the item players place into the pot to start growing.
  • Categories: which soils the crop accepts. These must match categories you defined on your soil recipes.
  • Display block: what visually appears on top of the pot as it grows.
  • Loot array: the drops. withChance weights entries against each other, and withRolls(min, max) controls how many times that entry is rolled.
  • growthTicks: base time to mature.
  • growthModifier: usually left at 1; it scales growth speed.

Reload with /reload after saving to test the crop in-game.

More guides for this mod