Class ItemStackHolder

java.lang.Object
earth.terrarium.botarium.common.item.ItemStackHolder

public class ItemStackHolder extends Object
A wrapper for ItemStack that allows for dirty checking.

On Fabric, the stack is read-only. So we need to wrap it in order to track changes. On all platforms, we need to track changes to the stack since the item may change, with buckets for example.

Create the holder before using transfer functions, and check isDirty() after using them, no matter the platform.

  • Constructor Details

    • ItemStackHolder

      public ItemStackHolder(net.minecraft.world.item.ItemStack stack)
  • Method Details

    • getStack

      public net.minecraft.world.item.ItemStack getStack()
    • setStack

      public void setStack(net.minecraft.world.item.ItemStack stack)
    • isDirty

      public boolean isDirty()
    • copy

      public ItemStackHolder copy()