Package ml.pluto7073.chemicals.item
Interface ChemicalContaining
public interface ChemicalContaining
An interface for items that can contain a variable amount of any chemical
in a stack. When an item that inherits
ChemicalContaining is
finished using by a player and the UseAnim of the item is UseAnim.DRINK
or UseAnim.EAT, any chemicals in the item will be added to the player
Note: This interface is intended for items that have a variable amount of chemicals.
For Items that will always have the same amount of chemicals, use ChemicalMap.COMPONENT_TYPE
-
Method Summary
Modifier and TypeMethodDescriptionfloatgetChemicalContent(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.ItemStack stack) Obtains the amount of a specific chemical stored in a stackdefault floatgetConsumedChemicalContent(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.ItemStack stack) Gets the amount of a specific chemical to actually be consumed upon item use.
-
Method Details
-
getChemicalContent
float getChemicalContent(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.ItemStack stack) Obtains the amount of a specific chemical stored in a stack- Parameters:
id- The ID representing the chemicalstack- The itemStack- Returns:
- Amount of the desired chemical stored in the stack
-
getConsumedChemicalContent
default float getConsumedChemicalContent(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.ItemStack stack) Gets the amount of a specific chemical to actually be consumed upon item use. Use this if the item is consumed in portions.- Parameters:
id- The ID representing the chemicalstack- the item- Returns:
- Amount of the desired chemical that should be consumed.
-