Crops
Link to crops
Class path: mods.botanypots.Crop
Use
Link to use
To use, import the class with import mods.botanypots.Crop;
at the beginning of your script.
Create A Crop
Link to 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.
ZenScript CopyCrop.create("examplepack:gold", <item:minecraft:gold_nugget>, <blockstate:minecraft:gold_block>, 3000, 2, ["stone"]);
Remove A Crop
Link to 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.
ZenScript CopyCrop.remove("botanypots:crop/wheat");
Set Seed Item
Link to 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.
ZenScript CopyCrop.setSeed("botanypots:crop/wheat", <item:minecraft:diamond>);
Set Display Block
Link to 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.
ZenScript CopyCrop.setDisplay("botanypots:crop/wheat", <blockstate:minecraft:snow_block>);
Set Tick Rate
Link to 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.
ZenScript CopyCrop.setTickRate("botanypots:crop/wheat", 5000);
Set Growth Multiplier
Link to 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.
ZenScript CopyCrop.setGrowthMofieir("botanypots:crop/wheat", 1.8);
Changing Crop Categories
Link to 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
Link to 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.
ZenScript CopyCrop.addCategory("botanypots:crop/wheat", ["stone", "snow"]);
Remove a Category From a Crop
Link to 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.
ZenScript CopyCrop.removeCategory("botanypots:crop/wheat", ["dirt"]);
Clear All Categories From a Crop
Link to 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.
ZenScript CopyCrop.clearCategories("botanypots:crop/wheat");
Crop Drops
Link to crop-drops
Adding Drops
Link to 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.
ZenScript CopyCrop.addDrop("botanypots:crop/wheat", <item:minecraft:diamond>, 0.05, 1, 1);
Removing Drops
Link to 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.
ZenScript CopyCrop.removeDrop("botanypots:crop/wheat", <item:minecraft:wheat_seeds>);
Getting All Ids
Link to 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.
ZenScript Copy// Log all ids to the crafttweaker.log file
for cropId in Crop.getAllIds() {
println(cropId);
}
Removing All Crops
Link to 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.
ZenScript CopyCrop.removeAll();