Home Commands Examples Getting Started With Scripts Global Keywords
Generic Recipe Manipulation
CropManager FertilizerManager PotInteractionManager SoilManager

CropManager

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import mods.botanypots.CropManager;

Description

Implements

CropManager implements the following interfaces:

IRecipeManager<Crop>,CommandStringDisplayable

Undocumented Interfaces

Iterable<Recipe>

Members

addCrop(id as string, seed as IIngredient, soilCategories as List<string>, growthTicks as int, results as HarvestEntry[], displayState as DisplayState, lightLevel as int = 0)
Adds a crop.
script.zs
// CropManager.addCrop(id as string, seed as IIngredient, soilCategories as List<string>, growthTicks as int, results as HarvestEntry[], displayState as DisplayState, lightLevel as int = 0);
<recipetype:botanypots:crop>.addCrop("soil_test", <item:minecraft:diamond>, ["category1"], 200, [HarvestResult.of(0.75, <item:minecraft:apple>)], <blockstate:minecraft:dirt>, 1);

Parameters:

id Type: string - The ID of the crop.
seed Type: IIngredient - The seed ingredient.
soilCategories Type: List<string> - The list of soil categories.
growthTicks Type: int - The number of growth ticks.
results Type: HarvestEntry[] - The array of harvest entries.
displayState Type: DisplayState - The display state for the crop.
lightLevel (optional) Type: int - The optional light level that the crop will give off. Defaults to 0

Default Value: 0

addCrop(id as string, seed as IIngredient, soilCategories as List<string>, growthTicks as int, results as HarvestEntry[], displayStates as DisplayState[], lightLevel as int = 0)
Adds a crop.
script.zs
// CropManager.addCrop(id as string, seed as IIngredient, soilCategories as List<string>, growthTicks as int, results as HarvestEntry[], displayStates as DisplayState[], lightLevel as int = 0);
<recipetype:botanypots:crop>.addCrop("soil_test", <item:minecraft:diamond>, ["category1"], 200, [HarvestResult.of(0.75, <item:minecraft:apple>)], [<blockstate:minecraft:dirt>], 1);

Parameters:

id Type: string - The ID of the crop.
seed Type: IIngredient - The seed ingredient.
soilCategories Type: List<string> - The list of soil categories.
growthTicks Type: int - The number of growth ticks.
results Type: HarvestEntry[] - The array of harvest entries.
displayStates Type: DisplayState[] - The array of display states for the crop.
lightLevel (optional) Type: int - The optional light level that the crop will give off. Defaults to 0

Default Value: 0

addJsonRecipe(name as string, mapData as MapData)
script.zs
// CropManager.addJsonRecipe(name as string, mapData as MapData);
<recipetype:botanypots:crop>.addJsonRecipe(myString, myMapData);

Parameters:

name Type: string
mapData Type: MapData
Getter
script.zs
// CropManager.allRecipes as List<Recipe>
<recipetype:botanypots:crop>.allRecipes

Return Type: List<Recipe>

allRecipes() as List<Recipe>
script.zs
// CropManager.allRecipes() as List<Recipe>;
<recipetype:botanypots:crop>.allRecipes();

Return Type: List<Recipe>

Getter
script.zs
// CropManager.commandString as string
<recipetype:botanypots:crop>.commandString

Return Type: string

commandString() as string
script.zs
// CropManager.commandString() as string;
<recipetype:botanypots:crop>.commandString();

Return Type: string

getRecipeByName(name as string) as Recipe
script.zs
// CropManager.getRecipeByName(name as string) as Recipe;
<recipetype:botanypots:crop>.getRecipeByName(myString);

Parameters:

name Type: string

Return Type: Recipe

modify(id as string, modifier as BiFunction<BasicCrop, ResourceLocation, BasicCrop>) as bool
Modifies the given BasicCrop, replacing it with the new one from the function.

Returns: true if the crop was found, and is a BasicCrop, false otherwise.

script.zs
// CropManager.modify(id as string, modifier as BiFunction<BasicCrop, ResourceLocation, BasicCrop>) as bool;
<recipetype:botanypots:crop>.modify("botanypots:minecraft/crop/wheat", (id, old) => BasicCrop.of(id, old.seed, old.soilCategories, old.growthTicks / 2, old.results, old.displayStates, old.lightLevel));

Parameters:

id Type: string - The id of the crop to replace.
modifier Type: BiFunction<BasicCrop, ResourceLocation, BasicCrop> - the modifier to apply to the crop.

Return Type: bool

Getter
script.zs
// CropManager.recipeMap as Recipe[ResourceLocation]
<recipetype:botanypots:crop>.recipeMap

Return Type: Recipe[ResourceLocation]

recipeMap() as Recipe[ResourceLocation]
script.zs
// CropManager.recipeMap() as Recipe[ResourceLocation];
<recipetype:botanypots:crop>.recipeMap();

Return Type: Recipe[ResourceLocation]

removeAll()
script.zs
// CropManager.removeAll();
<recipetype:botanypots:crop>.removeAll();
removeByModid(modid as string, exclude as function(t as string) as bool = (name as string) as bool => false)
script.zs
// CropManager.removeByModid(modid as string, exclude as function(t as string) as bool = (name as string) as bool => false);
<recipetype:botanypots:crop>.removeByModid(myString, myPredicate);

Parameters:

modid Type: string
exclude (optional) Type: function(t as string) as bool

Default Value: (name as string) as bool => false

removeByName(names as string[])
script.zs
// CropManager.removeByName(names as string[]);
<recipetype:botanypots:crop>.removeByName(myString[]);

Parameters:

names Type: string[]
removeByRegex(regex as string, exclude as function(t as string) as bool = (name as string) as bool => false)
script.zs
// CropManager.removeByRegex(regex as string, exclude as function(t as string) as bool = (name as string) as bool => false);
<recipetype:botanypots:crop>.removeByRegex(myString, myPredicate);

Parameters:

regex Type: string
exclude (optional) Type: function(t as string) as bool

Default Value: (name as string) as bool => false