Treasure Chest (Actually Additions)
Description
A weighted item, with a weight to obtain and a minimum and maximum amount. Obtained via right-clicking a Treasure Chest spawning randomly on the sea floor.
Identifier
Refer to this via any of the following:
mods.aa.treasure_chest
mods.aa.treasurechest
mods.aa.treasureChest
mods.aa.TreasureChest
mods.actuallyadditions.treasure_chest/* Used as page default */
mods.actuallyadditions.treasurechest
mods.actuallyadditions.treasureChest
mods.actuallyadditions.TreasureChest
Adding Recipes
Add the given recipe to the recipe list:
groovymods.actuallyadditions.treasure_chest.add(TreasureChestLoot)
Recipe Builder
Just like other recipe types, the Treasure Chest also uses a recipe builder.
Don't know what a builder is? Check the builder info page out.
mods.actuallyadditions.treasure_chest.recipeBuilder()
ItemStackList
. Sets the item outputs of the recipe. Requires exactly 1.groovyoutput(ItemStack) output(ItemStack...) output(Collection<ItemStack>)
int
. Sets the maximum stack size given when rolled. Requires greater than or equal to 0 and greater than or equal to the size of min. (Default0
).groovymax(int)
int
. Sets the minimum stack size given when rolled. Requires greater than or equal to 0 and less than or equal to the size of max. (Default0
).groovymin(int)
int
. Sets how likely this loot is to be rolled. Requires greater than or equal to 0. (Default0
).groovyweight(int)
First validates the builder, returning
null
and outputting errors to the log file if the validation failed, then registers the builder and returns the registered object. (returnsnull
orde.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot
).groovyregister()
Example
mods.actuallyadditions.treasure_chest.recipeBuilder()
.output(item('minecraft:clay'))
.weight(50)
.min(16)
.max(32)
.register()
Removing Recipes
Removes the given recipe from the recipe list:
groovymods.actuallyadditions.treasure_chest.remove(TreasureChestLoot)
Removes all recipes that match the given output:
groovymods.actuallyadditions.treasure_chest.removeByOutput(ItemStack)
Removes all registered recipes:
groovymods.actuallyadditions.treasure_chest.removeAll()
Example
mods.actuallyadditions.treasure_chest.removeByOutput(item('minecraft:iron_ingot'))
mods.actuallyadditions.treasure_chest.removeAll()
Getting the value of recipes
Iterates through every entry in the registry, with the ability to call remove on any element to remove it:
groovymods.actuallyadditions.treasure_chest.streamRecipes()