Class AbstractItemBasedAttribute

java.lang.Object
alexiil.mc.lib.attributes.misc.AbstractItemBasedAttribute
Direct Known Subclasses:
ItemBasedSingleFluidInv

public abstract class AbstractItemBasedAttribute extends Object
Skeleton class for use when exposing an attribute (like a fluid inventory) from an item that is contained in a reference.
  • Field Details

    • stackRef

      protected final Reference<net.minecraft.item.ItemStack> stackRef
    • excessStacks

      protected final LimitedConsumer<net.minecraft.item.ItemStack> excessStacks
  • Constructor Details

    • AbstractItemBasedAttribute

      protected AbstractItemBasedAttribute(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)
  • Method Details

    • setStacks

      public boolean setStacks(Simulation simulation, net.minecraft.item.ItemStack oldStack, net.minecraft.item.ItemStack newStack)
      Attempts to place the stacks in the reference and excess.
      Parameters:
      oldStack - A copied stack from stackRef, but decreased by 1.
      newStack - The modified stack that was split off from stackRef.
    • toString

      public String toString()
      Overrides:
      toString in class Object