Class ResourceType<ECS_TYPE, T extends Resource<ECS_TYPE>>

java.lang.Object
com.hypixel.hytale.component.ResourceType<ECS_TYPE,T>
Type Parameters:
ECS_TYPE - The store type.
T - The resource type class.
All Implemented Interfaces:
Comparable<ResourceType<ECS_TYPE,?>>

public class ResourceType<ECS_TYPE, T extends Resource<ECS_TYPE>> extends Object implements Comparable<ResourceType<ECS_TYPE,?>>
Describes a Resource type registered with a ComponentRegistry
  • Field Details

    • EMPTY_ARRAY

      @Nonnull public static final ResourceType[] EMPTY_ARRAY
      An empty resource type array to reduce allocation.
  • Constructor Details

    • ResourceType

      public ResourceType()
      Default Constructor for a ResourceType instance.
  • Method Details

    • getRegistry

      @Nonnull public ComponentRegistry<ECS_TYPE> getRegistry()
      Returns:
      the associated component registry for this resource type.
    • getTypeClass

      @Nonnull public Class<? super T> getTypeClass()
      Returns:
      the type class of the registered resource
    • getIndex

      public int getIndex()
      Get the index for this registered resource type.
      Returns:
      The index for this resource
    • validateRegistry

      public void validateRegistry(@Nonnull ComponentRegistry<ECS_TYPE> registry)
      Called to validate that this resource type belongs to the given registry.

      Parameters:
      registry - The registry to validate against.
      Throws:
      IllegalArgumentException - if the registries do not match.
    • validate

      public void validate()
      Called to validate that this resource type is valid.
      Throws:
      IllegalStateException - if the resource type is invalid.
    • compareTo

      public int compareTo(@Nonnull ResourceType<ECS_TYPE,?> o)
      Specified by:
      compareTo in interface Comparable<ECS_TYPE>
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object