Package vazkii.botania.common.impl.mana
Record Class DefaultManaItemImpl
java.lang.Object
java.lang.Record
vazkii.botania.common.impl.mana.DefaultManaItemImpl
- Record Components:
stack- The mana item's stack.
- All Implemented Interfaces:
ManaItem
public record DefaultManaItemImpl(net.minecraft.world.item.ItemStack stack)
extends Record
implements ManaItem
Default implementation for the
ManaItem interface. This implementation covers all of Botania's own mana
items, from tablets, to mana mirror and terra shatterer.-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultManaItemImpl(net.minecraft.world.item.ItemStack stack) Creates an instance of aDefaultManaItemImplrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMana(int mana) Adds mana to this item.booleancanExportManaToItem(net.minecraft.world.item.ItemStack otherStack) Can this item export mana to another item?booleancanExportManaToPool(net.minecraft.world.level.block.entity.BlockEntity pool) Can this item export mana to a mana Pool?booleancanReceiveManaFromItem(net.minecraft.world.item.ItemStack otherStack) Can this item recieve mana from another item?booleancanReceiveManaFromPool(net.minecraft.world.level.block.entity.BlockEntity pool) Can this item receive mana from a mana Pool?final booleanIndicates whether some other object is "equal to" this one.intgetMana()Gets the amount of mana this item containsintGets the max amount of mana this item can hold.final inthashCode()Returns a hash code value for this object.booleanIf this item simply does not export mana at all, set this to true.net.minecraft.world.item.ItemStackstack()Returns the value of thestackrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
DefaultManaItemImpl
public DefaultManaItemImpl(net.minecraft.world.item.ItemStack stack) Creates an instance of aDefaultManaItemImplrecord class.- Parameters:
stack- the value for thestackrecord component
-
-
Method Details
-
getMana
public int getMana()Description copied from interface:ManaItemGets the amount of mana this item contains -
getMaxMana
public int getMaxMana()Description copied from interface:ManaItemGets the max amount of mana this item can hold.- Specified by:
getMaxManain interfaceManaItem
-
addMana
public void addMana(int mana) Description copied from interface:ManaItemAdds mana to this item. -
canReceiveManaFromPool
public boolean canReceiveManaFromPool(net.minecraft.world.level.block.entity.BlockEntity pool) Description copied from interface:ManaItemCan this item receive mana from a mana Pool?- Specified by:
canReceiveManaFromPoolin interfaceManaItem- Parameters:
pool- The pool it's receiving mana from, can be casted to ManaPool.- See Also:
-
canReceiveManaFromItem
public boolean canReceiveManaFromItem(net.minecraft.world.item.ItemStack otherStack) Description copied from interface:ManaItemCan this item recieve mana from another item?- Specified by:
canReceiveManaFromItemin interfaceManaItem
-
canExportManaToPool
public boolean canExportManaToPool(net.minecraft.world.level.block.entity.BlockEntity pool) Description copied from interface:ManaItemCan this item export mana to a mana Pool?- Specified by:
canExportManaToPoolin interfaceManaItem- Parameters:
pool- The pool it's exporting mana to, can be casted to ManaPool.- See Also:
-
canExportManaToItem
public boolean canExportManaToItem(net.minecraft.world.item.ItemStack otherStack) Description copied from interface:ManaItemCan this item export mana to another item?- Specified by:
canExportManaToItemin interfaceManaItem
-
isNoExport
public boolean isNoExport()Description copied from interface:ManaItemIf this item simply does not export mana at all, set this to true. This is used to skip items that contain mana but can't export it when drawing the mana bar above the XP bar.- Specified by:
isNoExportin interfaceManaItem
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
stack
public net.minecraft.world.item.ItemStack stack()Returns the value of thestackrecord component.- Returns:
- the value of the
stackrecord component
-