Skip to content

Post 1.4

Mrbysco edited this page Mar 27, 2024 · 4 revisions

Importing the package

To start adding/removing Spoiling you should import:
import mods.spoiled.SpoilingManager;

Adding Spoiling

The syntax for adding spoiling would is the following:
spoiling.addSpoiling(String name, IIngredient originalFood, IItemStack resultStack, int spoilTime
An example would be:
spoiling.addSpoiling("dirt_to_diamond", <item:minecraft:dirt>, <item:minecraft:diamond_block>, 120) (Which would register the example variable above)

The syntax for adding spoiling to every food item from a mod is the following:
spoiling.addModSpoiling(String mod_id, IItemStack spoilStack, int spoilTime); (Syntax)
An example would be:
spoiling.addModSpoiling("simplefarming", <item:minecraft:rotten_flesh>, 120); (An example that will add spoiling to all food items from simplefarming) (turning them into rotten flesh when spoiled)

There are multiple syntaxes for removing spoiling:
spoiling.removeByName(String recipeName); (Which would remove the spoiling known by the recipeName)
spoiling.removeByInput(IItemStack input); (Which would remove the spoiling if the input contains the given IItemStack)
spoiling.remove(IIngredient output); (Which would remove the spoiling based on the output matching the IIngredient. If wanted)
spoiling.removeAll(); (Which would remove all spoiling)

Remove item after spoilage

If you want the item to disappear after spoiling you need to set the result stack to <item:minecraft:air>

Example script

An example script that makes dirt spoil into diamond blocks after 12 tries can be found Here

Clone this wiki locally