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

    Fields inherited from interface vazkii.botania.api.mana.ManaItem

    ID
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultManaItemImpl(net.minecraft.world.item.ItemStack stack)
    Creates an instance of a DefaultManaItemImpl record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addMana(int mana)
    Adds mana to this item.
    boolean
    canExportManaToItem(net.minecraft.world.item.ItemStack otherStack)
    Can this item export mana to another item?
    boolean
    canExportManaToPool(net.minecraft.world.level.block.entity.BlockEntity pool)
    Can this item export mana to a mana Pool?
    boolean
    canReceiveManaFromItem(net.minecraft.world.item.ItemStack otherStack)
    Can this item recieve mana from another item?
    boolean
    canReceiveManaFromPool(net.minecraft.world.level.block.entity.BlockEntity pool)
    Can this item receive mana from a mana Pool?
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Gets the amount of mana this item contains
    int
    Gets the max amount of mana this item can hold.
    final int
    Returns a hash code value for this object.
    boolean
    If this item simply does not export mana at all, set this to true.
    net.minecraft.world.item.ItemStack
    Returns the value of the stack record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DefaultManaItemImpl

      public DefaultManaItemImpl(net.minecraft.world.item.ItemStack stack)
      Creates an instance of a DefaultManaItemImpl record class.
      Parameters:
      stack - the value for the stack record component
  • Method Details

    • getMana

      public int getMana()
      Description copied from interface: ManaItem
      Gets the amount of mana this item contains
      Specified by:
      getMana in interface ManaItem
    • getMaxMana

      public int getMaxMana()
      Description copied from interface: ManaItem
      Gets the max amount of mana this item can hold.
      Specified by:
      getMaxMana in interface ManaItem
    • addMana

      public void addMana(int mana)
      Description copied from interface: ManaItem
      Adds mana to this item.
      Specified by:
      addMana in interface ManaItem
    • canReceiveManaFromPool

      public boolean canReceiveManaFromPool(net.minecraft.world.level.block.entity.BlockEntity pool)
      Description copied from interface: ManaItem
      Can this item receive mana from a mana Pool?
      Specified by:
      canReceiveManaFromPool in interface ManaItem
      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: ManaItem
      Can this item recieve mana from another item?
      Specified by:
      canReceiveManaFromItem in interface ManaItem
    • canExportManaToPool

      public boolean canExportManaToPool(net.minecraft.world.level.block.entity.BlockEntity pool)
      Description copied from interface: ManaItem
      Can this item export mana to a mana Pool?
      Specified by:
      canExportManaToPool in interface ManaItem
      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: ManaItem
      Can this item export mana to another item?
      Specified by:
      canExportManaToItem in interface ManaItem
    • isNoExport

      public boolean isNoExport()
      Description copied from interface: ManaItem
      If 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:
      isNoExport in interface ManaItem
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • stack

      public net.minecraft.world.item.ItemStack stack()
      Returns the value of the stack record component.
      Returns:
      the value of the stack record component