Interface ComponentRegistry
- Type Parameters:
V- The visual object type used by theComponentPreviewHandler(e.g.,org.bukkit.inventory.ItemStackfor Spigot).
- All Known Implementing Classes:
ComponentRegistryImpl
public interface ComponentRegistry
Project Tachyon
Interface ComponentRegistry
The central hub for managing and resolving all Protobuf components within the Tachyon ecosystem.
This registry acts as the dictionary that bridges raw Protobuf data
with concrete Java objects and their associated graphical user interfaces (Preview Handlers).
It handles the dynamic unpacking of byte arrays into typed
instances.
invalid reference
Message
- Since:
- 1.0.0-SNAPSHOT
- Version:
- 2.0
- Author:
- Jimmy (vSKAH) - 18/04/2026
-
Method Summary
Modifier and TypeMethodDescriptionCollection<ComponentCodec<? extends Record>> <R extends Record>
@Nullable ComponentCodec<R> Retrieves a codec by its component Record class.<R extends Record>
@Nullable ComponentCodec<R> getCodec(@NotNull ComponentNamespace componentNamespace) <V, R extends Record>
@Nullable ComponentPreviewHandler<V, R> getPreviewHandler(@NotNull Class<R> recordClass) <R extends Record>
voidregisterCodec(@NotNull ComponentCodec<R> codec) Registers a new ComponentCodec.int<V, R extends Record>
voidregisterPreviewHandler(@NotNull Class<R> recordComponentClass, @NotNull ComponentPreviewHandler<V, R> previewHandler) Registers a new visual preview handler for a specific component.
-
Method Details
-
registerCodec
Registers a new ComponentCodec.- Type Parameters:
R- The specific record component type.- Parameters:
codec- The codec instance to register
-
registerPreviewHandler
<V, R extends Record> void registerPreviewHandler(@NotNull @NotNull Class<R> recordComponentClass, @NotNull @NotNull ComponentPreviewHandler<V, R> previewHandler) Registers a new visual preview handler for a specific component.- Type Parameters:
V- The visual element type (ex ItemStack)R- The record component type.- Parameters:
recordComponentClass- The component record classpreviewHandler- The preview handler instance
-
getCodec
Retrieves a codec by its component Record class.- Type Parameters:
R- The Record component type.- Parameters:
recordComponentClass- The Record class.- Returns:
- The registered codec or null if not found
-
getCodec
@Nullable <R extends Record> @Nullable ComponentCodec<R> getCodec(@NotNull @NotNull ComponentNamespace componentNamespace) -
getPreviewHandler
@Nullable <V, R extends Record> @Nullable ComponentPreviewHandler<V,R> getPreviewHandler(@NotNull @NotNull Class<R> recordClass) -
registeredCount
int registeredCount() -
getAllCodecs
Collection<ComponentCodec<? extends Record>> getAllCodecs()
-