Class ComponentType<ECS_TYPE, T extends Component<ECS_TYPE>>

java.lang.Object
com.hypixel.hytale.component.ComponentType<ECS_TYPE,T>
Type Parameters:
ECS_TYPE - The store type associated with this component type.
T - The component type class.
All Implemented Interfaces:
Query<ECS_TYPE>, Comparable<ComponentType<ECS_TYPE,?>>

public class ComponentType<ECS_TYPE, T extends Component<ECS_TYPE>> extends Object implements Comparable<ComponentType<ECS_TYPE,?>>, Query<ECS_TYPE>
Represents a type of Component class, registered via a ComponentRegistry and used as a key to fetch components.
  • Field Details

    • EMPTY_ARRAY

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

    • ComponentType

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

    • getRegistry

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

      @Nonnull public Class<? super T> getTypeClass()
      Returns:
      the type class associated with this component type.
    • getIndex

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

      public boolean test(@Nonnull Archetype<ECS_TYPE> archetype)
      Description copied from interface: Query
      Controls if this query should process the provided Archetype.
      Specified by:
      test in interface Query<ECS_TYPE>
      Returns:
      true if the archetype should be processed by this query.
    • requiresComponentType

      public boolean requiresComponentType(ComponentType<ECS_TYPE,?> componentType)
      Description copied from interface: Query
      Controls if a query requires a component and so if used by a system it should be automatically unregistered if a component type is removed.
      Specified by:
      requiresComponentType in interface Query<ECS_TYPE>
      Returns:
      true if the componentType is required.
    • validateRegistry

      public void validateRegistry(@Nonnull ComponentRegistry<ECS_TYPE> registry)
      Description copied from interface: Query
      Validates that the provided ComponentRegistry is compatible with this query.
      Specified by:
      validateRegistry in interface Query<ECS_TYPE>
      Parameters:
      registry - The component registry to validate against.
    • validate

      public void validate()
      Description copied from interface: Query
      Validates the internal state of this query.
      Specified by:
      validate in interface Query<ECS_TYPE>
    • compareTo

      public int compareTo(@Nonnull ComponentType<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