Home Getting Started With Scripts Commands Examples

Fertilizers

Class path: mods.botanypots.Fertilizer

Use

To use, import the class with import mods.botanypots.Fertilizer; at the beginning of your script.

Creating Fertilizers

Fertilizer.create(id, ingredient, minTick, maxTick);

  • id <string> The id of the new fertilizer. This is a namespaced id an must be in the valid namespace:path format.
  • ingredient <IIngredient> The item used for the fertilizer.
  • minTick <int> The minimum amount of ticks added by the fertilizer.
  • maxTick <int> The maximum amount of ticks added by the fertilizer.

Creates a new fertilizer. These can be used to grow crops faster.

script.zs
Fertilizer.create("examplepack:stick", <item:minecraft:stick>, 250, 550);

Removing Fertilizers

Fertilizer.remove(id);

  • id <string> The id of the fertilizer. This is a namespaced id an must be in the valid namespace:path format.

This can be used to remove a fertilizer.

script.zs
Fertilizer.remove("botanypots:fertilizers/bone_meal");

Changing Fertilizer Ticks

Fertilizer.setTicks(String id, int minTick, int maxTick);

  • id <string> The id of the fertilizer. This is a namespaced id an must be in the valid namespace:path format.
  • minTick <int> The new minimum amount of ticks added by the fertilizer.
  • maxTick <int> The new maximum amount of ticks added by the fertilizer.

This will change the growth tick range added by the fertilizer.

script.zs
Fertilizer.setTicks("botanypots:fertilizers/bone_meal", 800, 900);

Changing Fertilizer Ingredients

Fertilizer.setIngredient(id, ingredient);

  • id <string> The id of the fertilizer. This is a namespaced id an must be in the valid namespace:path format.
  • ingredient <IIngredient> The new item to be used for the fertilizer.

Sets the ingredient item that is the fertilizer.

script.zs
Fertilizer.setIngredient("botanypots:fertilizers/bone_meal", <item:minecraft:sugar>);

Getting All Ids

Fertilizer.getAllIds();

  • Returns: <string[]> An array of all known fertilizer ids at the time this is ran.

This will give you an array of all the known fertilizer ids at the time.

script.zs
// Log all ids to the crafttweaker.log file
for fertilizerId in Fertilizer.getAllIds() {
println(fertilizerId);
}

Removing All Fertilizers

This will completely remove all the fertilizers currently registered. This is useful for if you want to recreate all the data from scratch through scripts.

script.zs
Fertilizer.removeAll();