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
Nested ClassesModifier and TypeClassDescriptionstatic classVariable 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
FieldsModifier 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.voidregisterHandler(IVariableFacadeHandler variableFacadeHandler) Register a new handler.<F extends IVariableFacade>
voidwrite(ValueDeseralizationContext valueDeseralizationContext, 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:IVariableFacadeHandlerRegistryRegister a new handler.- Specified by:
registerHandlerin interfaceIVariableFacadeHandlerRegistry- Parameters:
variableFacadeHandler- The handler.
-
handle
public IVariableFacade handle(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.world.item.ItemStack itemStack) Description copied from interface:IVariableFacadeHandlerRegistryChecks the type of the given tag and uses the corresponding handler to retrieve its variable facade.- Specified by:
handlein interfaceIVariableFacadeHandlerRegistry- 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:IVariableFacadeHandlerRegistryChecks the type of the given tag and uses the corresponding handler to retrieve its variable facade.- Specified by:
handlein interfaceIVariableFacadeHandlerRegistry- 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
Description copied from interface:IVariableFacadeHandlerRegistryFind a handler by name.- Specified by:
getHandlerin interfaceIVariableFacadeHandlerRegistry- Parameters:
type- The handler name.- Returns:
- The handler.
-
getHandlerNames
- Specified by:
getHandlerNamesin interfaceIVariableFacadeHandlerRegistry- 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:IVariableFacadeHandlerRegistrySet the type of the given tag and uses the corresponding handler to write the variable facade.- Specified by:
writein interfaceIVariableFacadeHandlerRegistry- 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:IVariableFacadeHandlerRegistryWrite the given variable facade to the given itemstack.- Specified by:
writeVariableFacadeItemin 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:IVariableFacadeHandlerRegistryWrite a new variable facade to the given itemstack.- Specified by:
writeVariableFacadeItemin 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.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:IVariableFacadeHandlerRegistryCreate a new variable facade..- Specified by:
writeVariableFacadein 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.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:IVariableFacadeHandlerRegistryCopy the given itemstack and (possibly) assign a new id.- Specified by:
copyin 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.
-