Class IngredientSerializerItemStack

java.lang.Object
org.cyclops.commoncapabilities.ingredient.IngredientSerializerItemStack
All Implemented Interfaces:
IIngredientSerializer<net.minecraft.world.item.ItemStack,Integer>

public class IngredientSerializerItemStack extends Object implements IIngredientSerializer<net.minecraft.world.item.ItemStack,Integer>
Serializer for ItemStacks.
  • Constructor Details

    • IngredientSerializerItemStack

      public IngredientSerializerItemStack()
  • Method Details

    • serializeInstance

      public net.minecraft.nbt.Tag serializeInstance(net.minecraft.core.HolderLookup.Provider lookupProvider, net.minecraft.world.item.ItemStack instance)
      Description copied from interface: IIngredientSerializer
      Serialize an instance to NBT.
      Specified by:
      serializeInstance in interface IIngredientSerializer<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      lookupProvider - The holder lookup provider.
      instance - An instance.
      Returns:
      An NBT tag.
    • deserializeInstance

      public net.minecraft.world.item.ItemStack deserializeInstance(net.minecraft.core.HolderLookup.Provider lookupProvider, net.minecraft.nbt.Tag tag) throws IllegalArgumentException
      Description copied from interface: IIngredientSerializer
      Deserialize an instance from NBT.
      Specified by:
      deserializeInstance in interface IIngredientSerializer<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      lookupProvider - The holder lookup provider.
      tag - An NBT tag.
      Returns:
      An instance.
      Throws:
      IllegalArgumentException - If the given tag is invalid or does not contain data on the given instance.
    • serializeCondition

      public net.minecraft.nbt.Tag serializeCondition(Integer matchCondition)
      Description copied from interface: IIngredientSerializer
      Serialize a match condition to NBT.
      Specified by:
      serializeCondition in interface IIngredientSerializer<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      matchCondition - A match condition.
      Returns:
      An NBT tag.
    • deserializeCondition

      public Integer deserializeCondition(net.minecraft.nbt.Tag tag) throws IllegalArgumentException
      Description copied from interface: IIngredientSerializer
      Deserialize a match condition from NBT.
      Specified by:
      deserializeCondition in interface IIngredientSerializer<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      tag - An NBT tag.
      Returns:
      A match condition.
      Throws:
      IllegalArgumentException - If the given tag is invalid or does not contain data on the given match condition.