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.
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: string
Type: string
- The ID of the crop. soilCategories: List<string>
Type: List<string>
- The list of soil categories. growthTicks: int
Type: int
- The number of growth ticks. lightLevel: int
(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: string
Type: string
- The ID of the crop. soilCategories: List<string>
Type: List<string>
- The list of soil categories. growthTicks: int
Type: int
- The number of growth ticks. lightLevel: int
(optional) Type: int
- The optional light level that the crop will give off. Defaults to 0
Default Value: 0
Getter
// CropManager.commandString as string<recipetype:botanypots:crop>.commandString
Return Type:
string
commandString() as string
// CropManager.commandString() as string;<recipetype:botanypots:crop>.commandString();
Return Type:
string
modify(id as string, modifier as BiFunction<BasicCrop, ResourceLocation, BasicCrop>) as bool
Modifies the given script.zs
BasicCrop
, replacing it with the new one from the function.Returns: true if the crop was found, and is a BasicCrop
, false otherwise.
// 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: string
Type: string
- The id of the crop to replace. modifier: BiFunction<BasicCrop, ResourceLocation, BasicCrop>
Type: BiFunction<BasicCrop, ResourceLocation, BasicCrop>
- the modifier to apply to the crop.
Return Type:
bool
Getter
<recipetype:botanypots:crop>.recipeMap
Return Type:
Recipe[ResourceLocation]
recipeMap() as Recipe[ResourceLocation]
removeAll()
// CropManager.removeAll();<recipetype:botanypots:crop>.removeAll();
removeByModid(modid as string, exclude as function(t as string) as bool = (name as string) as bool => false)
// 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: string
Type: string
exclude: function(t as string) as bool
(optional) Type: function(t as string) as bool
Default Value: (name as string) as bool => false
removeByName(names as string[])
// CropManager.removeByName(names as string[]);<recipetype:botanypots:crop>.removeByName(myString[]);
Parameters:
names: string[]
Type: string[]
removeByRegex(regex as string, exclude as function(t as string) as bool = (name as string) as bool => false)
// 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: string
Type: string
exclude: function(t as string) as bool
(optional) Type: function(t as string) as bool
Default Value: (name as string) as bool => false