Class VariableFacadeHandlerRegistry
java.lang.Object
org.cyclops.integrateddynamics.core.item.VariableFacadeHandlerRegistry
- All Implemented Interfaces:
org.cyclops.cyclopscore.init.IRegistry
,IVariableFacadeHandlerRegistry
The variable facade handler registry.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Variable facade used for items that have no (valid) information on them.Nested classes/interfaces inherited from interface org.cyclops.integrateddynamics.api.item.IVariableFacadeHandlerRegistry
IVariableFacadeHandlerRegistry.IVariableFacadeFactory<F extends IVariableFacade>
-
Field Summary
Modifier and TypeFieldDescription -
Method Summary
Modifier and TypeMethodDescription<F extends IVariableFacade>
net.minecraft.world.item.ItemStackcopy
(boolean generateId, net.minecraft.world.item.ItemStack itemStack) Copy the given itemstack and (possibly) assign a new id.getHandler
(net.minecraft.resources.ResourceLocation type) Find a handler by name.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.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.void
registerHandler
(IVariableFacadeHandler variableFacadeHandler) Register a new handler.<F extends IVariableFacade>
voidwrite
(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.<F extends IVariableFacade>
FwriteVariableFacade
(boolean generateId, net.minecraft.world.item.ItemStack itemStack, IVariableFacadeHandler<F> variableFacadeHandler, IVariableFacadeHandlerRegistry.IVariableFacadeFactory<F> variableFacadeFactory, ValueDeseralizationContext valueDeseralizationContext) Create a new variable facade..<F extends IVariableFacade>
net.minecraft.world.item.ItemStackwriteVariableFacadeItem
(boolean generateId, net.minecraft.world.item.ItemStack itemStack, IVariableFacadeHandler<F> variableFacadeHandler, IVariableFacadeHandlerRegistry.IVariableFacadeFactory<F> variableFacadeFactory, net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState blockState) Write a new variable facade to the given itemstack.<F extends IVariableFacade>
net.minecraft.world.item.ItemStackwriteVariableFacadeItem
(net.minecraft.world.item.ItemStack itemStack, F variableFacade, IVariableFacadeHandler<F> variableFacadeHandler) Write the given variable facade to the given itemstack.
-
Field Details
-
DUMMY_FACADE
-
-
Method Details
-
getInstance
- Returns:
- The unique instance.
-
registerHandler
Description copied from interface:IVariableFacadeHandlerRegistry
Register a new handler.- Specified by:
registerHandler
in interfaceIVariableFacadeHandlerRegistry
- 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 interfaceIVariableFacadeHandlerRegistry
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 interfaceIVariableFacadeHandlerRegistry
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
Description copied from interface:IVariableFacadeHandlerRegistry
Find a handler by name.- Specified by:
getHandler
in interfaceIVariableFacadeHandlerRegistry
- Parameters:
type
- The handler name.- Returns:
- The handler.
-
getHandlerNames
- Specified by:
getHandlerNames
in interfaceIVariableFacadeHandlerRegistry
- Returns:
- All registered handler names.
-
write
public <F extends IVariableFacade> void write(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 interfaceIVariableFacadeHandlerRegistry
- 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
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 interfaceIVariableFacadeHandlerRegistry
- 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 interfaceIVariableFacadeHandlerRegistry
- 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.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 interfaceIVariableFacadeHandlerRegistry
- 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.- 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 interfaceIVariableFacadeHandlerRegistry
- 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.
-