Class NBTSimpleInventoryItemStack

java.lang.Object
org.cyclops.cyclopscore.inventory.SimpleInventory
org.cyclops.cyclopscore.inventory.NBTSimpleInventoryItemStack
All Implemented Interfaces:
net.minecraft.world.Clearable, net.minecraft.world.Container, net.minecraft.world.WorldlyContainer, INBTInventory, INBTSerializable

public class NBTSimpleInventoryItemStack extends SimpleInventory
A simple inventory for an ItemStack that can be stored in NBT.
  • Field Details

    • itemStack

      protected final net.minecraft.world.item.ItemStack itemStack
    • tagName

      protected final String tagName
  • Constructor Details

    • NBTSimpleInventoryItemStack

      public NBTSimpleInventoryItemStack(net.minecraft.world.item.ItemStack itemStack, int size, int stackLimit, String tagName)
      Make a new instance.
      Parameters:
      itemStack - The item stack.
      size - The amount of slots in the inventory.
      stackLimit - The stack limit for each slot.
      tagName - The NBT tag name to store this inventory in. This should be the same tag name that is used to call the NBT read/write methods.
  • Method Details

    • setChanged

      public void setChanged()
      Specified by:
      setChanged in interface net.minecraft.world.Container
      Overrides:
      setChanged in class SimpleInventory
    • readFromNBT

      public void readFromNBT(net.minecraft.nbt.CompoundTag data, String tagName)
      Description copied from class: SimpleInventory
      Read inventory data from the given NBT.
      Overrides:
      readFromNBT in class SimpleInventory
      Parameters:
      data - The NBT data containing inventory data.
      tagName - The NBT tag name where the info is located.
    • writeToNBT

      public void writeToNBT(net.minecraft.nbt.CompoundTag data, String tagName)
      Description copied from class: SimpleInventory
      Write inventory data to the given NBT.
      Overrides:
      writeToNBT in class SimpleInventory
      Parameters:
      data - The NBT tag that will receive inventory data.
      tagName - The NBT tag name where the info must be located.