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

SoilManager

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.SoilManager;

Description

Implements

SoilManager implements the following interfaces:

IRecipeManager<Soil>,CommandStringDisplayable

Undocumented Interfaces

Iterable<Recipe>

Members

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

Parameters:

name Type: string
mapData Type: MapData
addSoil(id as string, ingredient as IIngredient, displayState as DisplayState, categories as List<string>, growthModifier as float = 1.0, lightLevel as int = 0)
Adds a new soil.
script.zs
// SoilManager.addSoil(id as string, ingredient as IIngredient, displayState as DisplayState, categories as List<string>, growthModifier as float = 1.0, lightLevel as int = 0);
<recipetype:botanypots:soil>.addSoil("soil_test", <item:minecraft:dirt>, SimpleDisplayState.of(<blockstate:minecraft:diamond_block>), ["category1", "category2"], 1.5, 7);

Parameters:

id Type: string - The ID of the soil.
ingredient Type: IIngredient - The ingredient that represents the soil.
displayState Type: DisplayState - The display state of the soil.
categories Type: List<string> - The categories that the soil belongs to.
growthModifier (optional) Type: float - The optional growth modifier of the soil. Defaults to 1.

Default Value: 1.0

lightLevel (optional) Type: int - The optional light level that the soil gives. Defaults to 0.

Default Value: 0

Getter
script.zs
// SoilManager.allRecipes as List<Recipe>
<recipetype:botanypots:soil>.allRecipes

Return Type: List<Recipe>

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

Return Type: List<Recipe>

Getter
script.zs
// SoilManager.commandString as string
<recipetype:botanypots:soil>.commandString

Return Type: string

commandString() as string
script.zs
// SoilManager.commandString() as string;
<recipetype:botanypots:soil>.commandString();

Return Type: string

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

Parameters:

name Type: string

Return Type: Recipe

getRecipesByOutput(output as IIngredient) as List<Recipe>
script.zs
// SoilManager.getRecipesByOutput(output as IIngredient) as List<Recipe>;
<recipetype:botanypots:soil>.getRecipesByOutput(myIIngredient);

Parameters:

output Type: IIngredient

Return Type: List<Recipe>

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

Returns: true if the soil was found, and is a BasicSoil, false otherwise.

script.zs
// SoilManager.modify(id as string, modifier as BiFunction<BasicSoil, ResourceLocation, BasicSoil>) as bool;
<recipetype:botanypots:soil>.modify("botanypots:minecraft/soil/dirt", (id, old) => BasicSoil.of(id, old. ingredient, old.displayState, old.categories, old.growthModifier, old.lightLevel));

Parameters:

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

Return Type: bool

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

Return Type: Recipe[ResourceLocation]

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

Return Type: Recipe[ResourceLocation]

removeAll()
script.zs
// SoilManager.removeAll();
<recipetype:botanypots:soil>.removeAll();
removeByModid(modid as string, exclude as function(t as string) as bool = (name as string) as bool => false)
script.zs
// SoilManager.removeByModid(modid as string, exclude as function(t as string) as bool = (name as string) as bool => false);
<recipetype:botanypots:soil>.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
// SoilManager.removeByName(names as string[]);
<recipetype:botanypots:soil>.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
// SoilManager.removeByRegex(regex as string, exclude as function(t as string) as bool = (name as string) as bool => false);
<recipetype:botanypots:soil>.removeByRegex(myString, myPredicate);

Parameters:

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

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