Class Decoder<T>

java.lang.Object
dev.wyck.wrapper.decode.Decoder<T>
Type Parameters:
T - the type produced by the decoder

@NullMarked @AsOf("3.3.0") @Internal public final class Decoder<T> extends Object
Lazily resolves a decoder implementation while exposing only the Wyck type it produces.
Since:
3.3.0
  • Method Details

    • create

      @AsOf("3.3.0") public static <T> Decoder<T> create(String className)
      Creates a lazily resolved decoder provider.
      Type Parameters:
      T - the type produced by the decoder
      Parameters:
      className - the decoder implementation class name
      Returns:
      a provider for the decoder
      Since:
      3.3.0
    • decode

      @AsOf("3.3.0") public T decode(Object minecraftObject)
      Decodes a Minecraft object with the lazily resolved decoder.
      Parameters:
      minecraftObject - the Minecraft object to read
      Returns:
      the decoded Wyck value
      Since:
      3.3.0
    • handles

      @AsOf("3.3.0") public boolean handles(ResourceKey type)
      Gets whether the resolved registry has a decoder for a type key.
      Parameters:
      type - the decoder type key
      Returns:
      whether the type is handled
      Since:
      3.3.0
    • handled

      @AsOf("3.3.0") public Set<ResourceKey> handled()
      Gets every type key handled by the resolved decoder registry.
      Returns:
      the handled type keys
      Since:
      3.3.0
    • typeOf

      @AsOf("3.3.0") public ResourceKey typeOf(Object minecraftObject)
      Gets the decoder type key for a Minecraft object.
      Parameters:
      minecraftObject - the Minecraft object to inspect
      Returns:
      the object's decoder type key
      Since:
      3.3.0