Class VariableFacadeHandlerRegistry

java.lang.Object
org.cyclops.integrateddynamics.core.item.VariableFacadeHandlerRegistry
All Implemented Interfaces:
org.cyclops.cyclopscore.init.IRegistry, IVariableFacadeHandlerRegistry

public class VariableFacadeHandlerRegistry extends Object implements IVariableFacadeHandlerRegistry
The variable facade handler registry.
  • Field Details

  • Method Details

    • getInstance

      public static VariableFacadeHandlerRegistry getInstance()
      Returns:
      The unique instance.
    • registerHandler

      public void registerHandler(IVariableFacadeHandler variableFacadeHandler)
      Description copied from interface: IVariableFacadeHandlerRegistry
      Register a new handler.
      Specified by:
      registerHandler in interface IVariableFacadeHandlerRegistry
      Parameters:
      variableFacadeHandler - The handler.
    • handle

      public IVariableFacade handle(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.world.item.ItemStack itemStack)
      Description copied from interface: IVariableFacadeHandlerRegistry
      Checks the type of the given tag and uses the corresponding handler to retrieve its variable facade.
      Specified by:
      handle in interface IVariableFacadeHandlerRegistry
      Parameters:
      valueDeseralizationContext -
      itemStack - The item containing information that can be read and used to form a variable facade.
      Returns:
      The variable facade handled by the appropriate handler.
    • handle

      public IVariableFacade handle(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.CompoundTag tagCompound)
      Description copied from interface: IVariableFacadeHandlerRegistry
      Checks the type of the given tag and uses the corresponding handler to retrieve its variable facade.
      Specified by:
      handle in interface IVariableFacadeHandlerRegistry
      Parameters:
      valueDeseralizationContext -
      tagCompound - The tag containing information that can be read and used to form a variable facade.
      Returns:
      The variable facade handled by the appropriate handler.
    • getHandler

      @Nullable public IVariableFacadeHandler getHandler(net.minecraft.resources.ResourceLocation type)
      Description copied from interface: IVariableFacadeHandlerRegistry
      Find a handler by name.
      Specified by:
      getHandler in interface IVariableFacadeHandlerRegistry
      Parameters:
      type - The handler name.
      Returns:
      The handler.
    • getHandlerNames

      public Collection<String> getHandlerNames()
      Specified by:
      getHandlerNames in interface IVariableFacadeHandlerRegistry
      Returns:
      All registered handler names.
    • write

      public <F extends IVariableFacade> void write(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.CompoundTag tagCompound, F variableFacade, IVariableFacadeHandler<F> handler)
      Description copied from interface: IVariableFacadeHandlerRegistry
      Set the type of the given tag and uses the corresponding handler to write the variable facade.
      Specified by:
      write in interface IVariableFacadeHandlerRegistry
      Type Parameters:
      F - The type of variable facade.
      Parameters:
      valueDeseralizationContext -
      tagCompound - The tag that is used to write variable facade information to.
      variableFacade - The facade to write.
      handler - The handler for writing the facade.
    • writeVariableFacadeItem

      public <F extends IVariableFacade> net.minecraft.world.item.ItemStack writeVariableFacadeItem(net.minecraft.world.item.ItemStack itemStack, F variableFacade, IVariableFacadeHandler<F> variableFacadeHandler)
      Description copied from interface: IVariableFacadeHandlerRegistry
      Write the given variable facade to the given itemstack.
      Specified by:
      writeVariableFacadeItem in interface IVariableFacadeHandlerRegistry
      Type Parameters:
      F - The variable facade type.
      Parameters:
      itemStack - The itemstack to write to.
      variableFacade - The variable facade.
      variableFacadeHandler - The variable facade handler.
      Returns:
      A copy of the given itemstack with the written variable facade.
    • writeVariableFacadeItem

      public <F extends IVariableFacade> net.minecraft.world.item.ItemStack writeVariableFacadeItem(boolean generateId, net.minecraft.world.item.ItemStack itemStack, IVariableFacadeHandler<F> variableFacadeHandler, IVariableFacadeHandlerRegistry.IVariableFacadeFactory<F> variableFacadeFactory, net.minecraft.world.level.Level level, @Nullable net.minecraft.world.entity.player.Player player, @Nullable net.minecraft.world.level.block.state.BlockState blockState)
      Description copied from interface: IVariableFacadeHandlerRegistry
      Write a new variable facade to the given itemstack.
      Specified by:
      writeVariableFacadeItem in interface IVariableFacadeHandlerRegistry
      Type Parameters:
      F - The variable facade type.
      Parameters:
      generateId - If a new id should be generated. Otherwise the previous facade id will be used or -1 if non existing.
      itemStack - The itemstack to write to.
      variableFacadeHandler - The variable facade handler.
      variableFacadeFactory - A factory for creating a variable facade.
      level -
      player - The player crafting the item.
      blockState - The block state in which the facade was created.
      Returns:
      A copy of the given itemstack with the written variable facade.
    • writeVariableFacade

      public <F extends IVariableFacade> F writeVariableFacade(boolean generateId, net.minecraft.world.item.ItemStack itemStack, IVariableFacadeHandler<F> variableFacadeHandler, IVariableFacadeHandlerRegistry.IVariableFacadeFactory<F> variableFacadeFactory, ValueDeseralizationContext valueDeseralizationContext)
      Description copied from interface: IVariableFacadeHandlerRegistry
      Create a new variable facade..
      Specified by:
      writeVariableFacade in interface IVariableFacadeHandlerRegistry
      Type Parameters:
      F - The variable facade type.
      Parameters:
      generateId - If a new id should be generated. Otherwise the previous facade id will be used or -1 if non existing.
      itemStack - The itemstack to write to.
      variableFacadeHandler - The variable facade handler.
      variableFacadeFactory - A factory for creating a variable facade.
      valueDeseralizationContext -
      Returns:
      The resulting variable facade.
    • copy

      public <F extends IVariableFacade> net.minecraft.world.item.ItemStack copy(boolean generateId, net.minecraft.world.item.ItemStack itemStack)
      Description copied from interface: IVariableFacadeHandlerRegistry
      Copy the given itemstack and (possibly) assign a new id.
      Specified by:
      copy in interface IVariableFacadeHandlerRegistry
      Type Parameters:
      F - The variable facade type.
      Parameters:
      generateId - If a new id should be generated. Otherwise -1 will be used.
      itemStack - The itemstack to copy, it is assumed to refer to a valid variable facade.
      Returns:
      A copy of the given itemstack with the written variable facade.