Crops
Class path: mods.botanypots.Crop
Use
To use, import the class with import mods.botanypots.Crop;
at the beginning of your script.
Create A Crop
Crop.create(id, seed, display, tickRate, multiplier, categories);
id
<string> The id of the crop. This is a namespaced id an must be in the validnamespace:path
format.seed
<IIngredient> The item used to plant the crop.display
<MCBlockState> The block to display when rendering the crop.tickRate
<int> One of the factors for how long a crop takes to grow.multiplier
<float> Another factor for how long the crop takes to grow.categories
<string[]> An array of soil categories this crop can be grown in.
This can be used to create a new crop. Keep in mind that drops need to be added separately.
Remove A Crop
Crop.remove(id);
id
<string> The id of the crop to remove. This is a namespaced id an must be in the validnamespace:path
format.
Removes a crop based on it’s id.
Set Seed Item
Crop.setSeed(id, seed);
id
<string> The id of the crop. This is a namespaced id an must be in the validnamespace:path
format.seed
<IIngredient> The item used to plant the crop.
Sets the item used to plant the crop.
Set Display Block
Crop.setDisplay(id, state);
id
<string> The id of the crop. This is a namespaced id an must be in the validnamespace:path
format.display
<MCBlockState> The block to display when rendering the crop.
Sets the block rendered for the crop.
Set Tick Rate
Crop.setTickRate(id, tickRate);
id
<string> The id of the crop. This is a namespaced id an must be in the validnamespace:path
format.tickRate
<int> The updated tick rate. One of the factors for how long a crop takes to grow.
Sets the crop tick factor.
Set Growth Multiplier
Crop.setGrowthModifier(id, multiplier);
id
<string> The id of the crop. This is a namespaced id an must be in the validnamespace:path
format.multiplier
<float> The updated multiplier. Another factor for how long the crop takes to grow.
Sets the growth multiplier/modifier for the crop.
Changing Crop Categories
Changes the categories associated with the crop. Categories are used to match the valid soils to the crop.
Add a Category to a Crop
Crop.addCategory(id, categoriesToAdd);
id
<string> The id of the crop. This is a namespaced id an must be in the validnamespace:path
format.categoriesToAdd
<string[]> An array of categories to associate with the crop.
Remove a Category From a Crop
Crop.removeCategory(id, categoriesToRemove);
id
<string> The id of the crop. This is a namespaced id an must be in the validnamespace:path
format.categoriesToRemove
<string[]> An array of categories to dissociate with the crop.
Clear All Categories From a Crop
Crop.clearCategories(id);
id
<string> The id of the crop. This is a namespaced id an must be in the validnamespace:path
format.
Crop Drops
Adding Drops
Crop.addDrop(id, drop, chance, min, max);
id
<string> The id of the crop to add a drop to. This is a namespaced id an must be in the validnamespace:path
format.drop
<IItemStack> The item to drop.chance
<float> The chance it drops.min
<int> The min amount of that item to give.max
<int> The max amount of that item to give.
This adds a new potential drop to the crop.
Removing Drops
Crop.removeDrop(id, toRemove);
id
<string> The id of the crop to remove a drop from. This is a namespaced id an must be in the validnamespace:path
format.toRemove
<IIngredient> The ingredient to match against for removal
Removes any drops that have a matching item.
Getting All Ids
Crop.getAllIds();
- Returns: <string[]> An array of all known crop ids at the time this is ran.
This will give you an array of all the known crop ids at the time.
Removing All Crops
This will completely remove all the crops currently registered. This is useful for if you want to recreate all the data from scratch through scripts.