Class ItemStackNBTHandler

java.lang.Object
com.hrznstudio.titanium.nbthandler.data.ItemStackNBTHandler
All Implemented Interfaces:
INBTHandler<net.minecraft.world.item.ItemStack>

public class ItemStackNBTHandler extends Object implements INBTHandler<net.minecraft.world.item.ItemStack>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isClassValid(Class<?> aClass)
    Checks if the NBTHandler can handle a class.
    net.minecraft.world.item.ItemStack
    readFromNBT(net.minecraft.nbt.CompoundTag compound, String name, net.minecraft.world.item.ItemStack currentValue)
    Reads the value from the NBT to be stored in the Field.
    boolean
    storeToNBT(net.minecraft.nbt.CompoundTag compound, String name, net.minecraft.world.item.ItemStack object)
    Stores a value as the given name in the NBT.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ItemStackNBTHandler

      public ItemStackNBTHandler()
  • Method Details

    • isClassValid

      public boolean isClassValid(Class<?> aClass)
      Description copied from interface: INBTHandler
      Checks if the NBTHandler can handle a class.
      Specified by:
      isClassValid in interface INBTHandler<net.minecraft.world.item.ItemStack>
      Parameters:
      aClass - The class that wants to be checked.
      Returns:
      true if the capability can handle the class or false if it can't.
    • storeToNBT

      public boolean storeToNBT(@Nonnull net.minecraft.nbt.CompoundTag compound, @Nonnull String name, @Nonnull net.minecraft.world.item.ItemStack object)
      Description copied from interface: INBTHandler
      Stores a value as the given name in the NBT.
      Specified by:
      storeToNBT in interface INBTHandler<net.minecraft.world.item.ItemStack>
      Parameters:
      compound - The NBT where the object needs to be stored.
      name - The name as it will be stored.
      object - The object value to be stored.
      Returns:
      true if the Object was successfully stored in the NBT
    • readFromNBT

      public net.minecraft.world.item.ItemStack readFromNBT(@Nonnull net.minecraft.nbt.CompoundTag compound, @Nonnull String name, @Nullable net.minecraft.world.item.ItemStack currentValue)
      Description copied from interface: INBTHandler
      Reads the value from the NBT to be stored in the Field.
      Specified by:
      readFromNBT in interface INBTHandler<net.minecraft.world.item.ItemStack>
      Parameters:
      compound - The NBT that stores all the information.
      name - The name of the object stored in the NBT.
      currentValue - The current value of the object
      Returns:
      The object if it was successfully stored or null if it wasn't giving the next handlers a chance to store the value.