Soils
Link to soils
Class path: mods.botanypots.Soil
Use
Link to use
To use, import the class with import mods.botanypots.Soil;
at the beginning of your script.
Creating New Soils
Link to creating-new-soils
Soil.create(id, ingredient, displayState, tickRate, categories);
id
<string> The id of the new soil. This is a namespaced id an must be in the validnamespace:path
format.ingredient
<IIngredient> The ingredient used to determine which items/blocks are used to put the soil in a pot.displayState
<MCBlockState> The block state to display for the soil in the pot.growthModifier
<float> Modifies the time a crop takes to grow. 1f = instant growth. 0 = normal growth. -1f = never grows. 0.15 = 15% faster, -0.15 = 15% slower.categories
<string[]> An array of categories associated with the new soil.
Creates a new soil entry that players can use in the botany pot.
ZenScript CopySoil.create("examplepack:rock", <item:minecraft:stone>, <blockstate:minecraft:stone>, 0, ["rocky"]);
Removing A Soil
Link to removing-a-soil
Soil.remove(id);
id
<string> The id of the soil to remove. This is a namespaced id an must be in the validnamespace:path
format.
Removes a soil from the game's data.
ZenScript CopySoil.remove("botanypots:soil/podzol");
Changing Soil Growth Modifier
Link to changing-soil-growth-modifier
Soil.setGrowthModifier(id, tickRate);
id
<string> The id of the soil. This is a namespaced id an must be in the validnamespace:path
format.growthModifier
<float> Modifies the time a crop takes to grow. 1f = instant growth. 0 = normal growth. -1f = never grows. 0.15 = 15% faster, -0.15 = 15% slower.
Changes the growth modifier of a given soil.
ZenScript CopySoil.setGrowthModifier("botanypots:soil/grass", 0.15);
Changing Soil Ingredient
Link to changing-soil-ingredient
Soil.setIngredient(id, ingredient);
id
<string> The id of the soil. This is a namespaced id an must be in the validnamespace:path
format.ingredient
<IIngredient> The ingredient used to determine which items/blocks are used to put the soil in a pot.
Changes the items used to put the soil into the botany pot.
ZenScript CopySoil.setIngredient("botanypots:soil/soul_sand", <item:minecraft:sand>);
Changing Soil Display
Link to changing-soil-display
Soil.setDisplayState(id, displayState);
id
<string> The id of the soil. This is a namespaced id an must be in the validnamespace:path
format.displayState
<MCBlockState> The block state to display for the soil in the pot.
Changes the block displayed for the soil.
ZenScript CopySoil.setDisplayState("botanypots:soil/dirt", <blockstate:minecraft:snow>);
Changing Soil Categories
Link to changing-soil-categories
Changes the categories associated with the soil. These are used to match crops to valid soils.
Add a Category to a Soil
Link to add-a-category-to-a-soil
Soil.addCategory(id, categoriesToAdd);
id
<string> The id of the soil. This is a namespaced id an must be in the validnamespace:path
format.categoriesToAdd
<string[]> An array of categories to associate with the soil.
ZenScript CopySoil.addCategory("botanypots:soil/soul_sand", ["nether"]);
Remove a Category From a Soil
Link to remove-a-category-from-a-soil
Soil.removeCategory(id, categoriesToRemove);
id
<string> The id of the soil. This is a namespaced id an must be in the validnamespace:path
format.categoriesToRemove
<string[]> An array of categories to dissociate with the soil.
ZenScript CopySoil.removeCategory("botanypots:soil/soul_sand", ["soul_sand"]);
Clear All Categories From a Soil
Link to clear-all-categories-from-a-soil
Soil.clearCategories(id);
id
<string> The id of the soil. This is a namespaced id an must be in the validnamespace:path
format.
ZenScript CopySoil.clearCategories("botanypots:soil/farmland");
Getting All Ids
Link to getting-all-ids
Soil.getAllIds();
- Returns: <string[]> An array of all known soil ids at the time this is ran.
This will give you an array of all the known soil ids at the time.
ZenScript Copy// Log all ids to the crafttweaker.log file
for soilId in Soil.getAllIds() {
println(soilId);
}
Removing All Soil
Link to removing-all-soil
This will completely remove all the soils currently registered. This is useful for if you want to recreate all the data from scratch through scripts.
ZenScript CopySoil.removeAll();