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:pathformat.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.
Crop.create("examplepack:gold", <item:minecraft:gold_nugget>, <blockstate:minecraft:gold_block>, 3000, 2, ["stone"]);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:pathformat.
Removes a crop based on it’s id.
Crop.remove("botanypots:crop/wheat");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:pathformat.seed<IIngredient> The item used to plant the crop.
Sets the item used to plant the crop.
Crop.setSeed("botanypots:crop/wheat", <item:minecraft:diamond>);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:pathformat.display<MCBlockState> The block to display when rendering the crop.
Sets the block rendered for the crop.
Crop.setDisplay("botanypots:crop/wheat", <blockstate:minecraft:snow_block>);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:pathformat.tickRate<int> The updated tick rate. One of the factors for how long a crop takes to grow.
Sets the crop tick factor.
Crop.setTickRate("botanypots:crop/wheat", 5000);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:pathformat.multiplier<float> The updated multiplier. Another factor for how long the crop takes to grow.
Sets the growth multiplier/modifier for the crop.
Crop.setGrowthMofieir("botanypots:crop/wheat", 1.8);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:pathformat.categoriesToAdd<string[]> An array of categories to associate with the crop.
Crop.addCategory("botanypots:crop/wheat", ["stone", "snow"]);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:pathformat.categoriesToRemove<string[]> An array of categories to dissociate with the crop.
Crop.removeCategory("botanypots:crop/wheat", ["dirt"]);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:pathformat.
Crop.clearCategories("botanypots:crop/wheat");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:pathformat.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.
Crop.addDrop("botanypots:crop/wheat", <item:minecraft:diamond>, 0.05, 1, 1);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:pathformat.toRemove<IIngredient> The ingredient to match against for removal
Removes any drops that have a matching item.
Crop.removeDrop("botanypots:crop/wheat", <item:minecraft:wheat_seeds>);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.
// Log all ids to the crafttweaker.log filefor cropId in Crop.getAllIds() { println(cropId);}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.
Crop.removeAll();