Soils
Class path: mods.botanypots.Soil
Use
To use, import the class with import mods.botanypots.Soil;
at the beginning of your script.
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.tickRate
<int> The tick rate for the soil.categories
<string[]> An array of categories associated with the new soil.
Creates a new soil entry that players can use in the botany pot.
Soil.create("examplepack:rock", <item:minecraft:stone>, <blockstate:minecraft:stone>, 100, ["rocky"]);
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.
Soil.remove("botanypots:soil/podzol");
Changing Soil Tick Rate
Soil.setTicks(id, tickRate);
id
<string> The id of the soil. This is a namespaced id an must be in the validnamespace:path
format.tickRate
<int> The new tick rate for the soil.
Changes the tick rate of a given soil.
Soil.setTicks("botanypots:soil/grass", 1300);
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.
Soil.setIngredient("botanypots:soil/soul_sand", <item:minecraft:sand>);
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.
Soil.setDisplayState("botanypots:soil/dirt", <blockstate:minecraft:snow>);
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
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.
Soil.addCategory("botanypots:soil/soul_sand", ["nether"]);
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.
Soil.removeCategory("botanypots:soil/soul_sand", ["soul_sand"]);
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.
Soil.clearCategories("botanypots:soil/farmland");
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.
// Log all ids to the crafttweaker.log filefor soilId in Soil.getAllIds() { println(soilId);}
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.
Soil.removeAll();