Interface IVariableFacadeHandlerRegistry

All Superinterfaces:
org.cyclops.cyclopscore.init.IRegistry
All Known Implementing Classes:
VariableFacadeHandlerRegistry

public interface IVariableFacadeHandlerRegistry extends org.cyclops.cyclopscore.init.IRegistry
Registry for retrieving variable facade handlers.
  • Method Details

    • registerHandler

      void registerHandler(IVariableFacadeHandler variableFacadeHandler)
      Register a new handler.
      Parameters:
      variableFacadeHandler - The handler.
    • handle

      IVariableFacade handle(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.world.item.ItemStack itemStack)
      Checks the type of the given tag and uses the corresponding handler to retrieve its variable facade.
      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

      IVariableFacade handle(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.CompoundTag tagCompound)
      Checks the type of the given tag and uses the corresponding handler to retrieve its variable facade.
      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 IVariableFacadeHandler getHandler(net.minecraft.resources.ResourceLocation type)
      Find a handler by name.
      Parameters:
      type - The handler name.
      Returns:
      The handler.
    • getHandlerNames

      Collection<String> getHandlerNames()
      Returns:
      All registered handler names.
    • write

      <F extends IVariableFacade> void write(net.minecraft.nbt.CompoundTag tagCompound, F variableFacade, IVariableFacadeHandler<F> handler)
      Set the type of the given tag and uses the corresponding handler to write the variable facade.
      Type Parameters:
      F - The type of variable facade.
      Parameters:
      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

      <F extends IVariableFacade> net.minecraft.world.item.ItemStack writeVariableFacadeItem(net.minecraft.world.item.ItemStack itemStack, F variableFacade, IVariableFacadeHandler<F> variableFacadeHandler)
      Write the given variable facade to the given itemstack.
      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

      <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)
      Write a new variable facade to the given itemstack.
      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

      <F extends IVariableFacade> F writeVariableFacade(boolean generateId, net.minecraft.world.item.ItemStack itemStack, IVariableFacadeHandler<F> variableFacadeHandler, IVariableFacadeHandlerRegistry.IVariableFacadeFactory<F> variableFacadeFactory, ValueDeseralizationContext valueDeseralizationContext)
      Create a new variable facade..
      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

      <F extends IVariableFacade> net.minecraft.world.item.ItemStack copy(boolean generateId, net.minecraft.world.item.ItemStack itemStack)
      Copy the given itemstack and (possibly) assign a new id.
      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.