Contents
- Description
- Method Summary
- Method Details
- empty()
- getMinIndex()
- count()
- length()
- get(int)
- isEmpty()
- contains(ComponentType)
- contains(Archetype)
- validateComponentType(ComponentType)
- validateComponents(Component[], ComponentType)
- hasSerializableComponents(ComponentRegistry.Data)
- getSerializableArchetype(ComponentRegistry.Data, Predicate)
- asExactQuery()
- of(ComponentType)
- of(ComponentType...)
- add(Archetype, ComponentType)
- remove(Archetype, ComponentType)
- test(Archetype)
- requiresComponentType(ComponentType)
- validateRegistry(ComponentRegistry)
- validate()
- equals(Object)
- hashCode()
- toString()
Class Archetype<ECS_TYPE>
java.lang.Object
com.hypixel.hytale.component.Archetype<ECS_TYPE>
- Type Parameters:
ECS_TYPE- The ECS entity data type.
- All Implemented Interfaces:
Query<ECS_TYPE>
-
Method Summary
Modifier and TypeMethodDescriptionadd(Archetype<ECS_TYPE> archetype, ComponentType<ECS_TYPE, T> componentType) booleanbooleancontains(ComponentType<ECS_TYPE, ?> componentType) intcount()static <ECS_TYPE> Archetype<ECS_TYPE> empty()booleanget(int index) intgetSerializableArchetype(ComponentRegistry.Data<ECS_TYPE> data, Predicate<ComponentType<ECS_TYPE, ?>> filter) Gets a new archetype containing only the serializable components from this archetype.inthashCode()booleanDetermines whether this archetype has any serializable components.booleanisEmpty()intlength()static <ECS_TYPE> Archetype<ECS_TYPE> of(ComponentType<ECS_TYPE, ?> componentTypes) Creates a newArchetypeinstance from a singleComponentType.static <ECS_TYPE> Archetype<ECS_TYPE> of(ComponentType<ECS_TYPE, ?>... componentTypes) Creates a newArchetypeinstance from multipleComponentType's.remove(Archetype<ECS_TYPE> archetype, ComponentType<ECS_TYPE, T> componentType) booleanrequiresComponentType(ComponentType<ECS_TYPE, ?> componentType) 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.booleanControls if this query should process the providedArchetype.toString()voidvalidate()Validates the internal state of this query.voidvalidateComponents(Component<ECS_TYPE>[] components, ComponentType<ECS_TYPE, UnknownComponents<ECS_TYPE>> ignore) Called to validate that the provided array ofComponent's matches this Archetype.voidvalidateComponentType(ComponentType<ECS_TYPE, ?> componentType) Called to validate that the providedComponentTypeexists within this Archetype.voidvalidateRegistry(ComponentRegistry<ECS_TYPE> registry) Validates that the providedComponentRegistryis compatible with this query.
-
Method Details
-
empty
- Type Parameters:
ECS_TYPE- The ECS entity data type.- Returns:
- the reusable empty archetype.
-
getMinIndex
public int getMinIndex()- Returns:
- The minimum
ComponentType.getIndex()contained within this Archetype. - See Also:
-
count
public int count()- Returns:
- The number of component types in this
Archetype
-
length
public int length()- Returns:
- The length of the internal array. To be used with
getMinIndex()andget(int) - See Also:
-
get
- Parameters:
index- TheComponentType.getIndex()of the component type.- Returns:
- The component type with the specified index if it exists within the Archetype.
-
isEmpty
public boolean isEmpty()- Returns:
trueif this Archetype contains no component types,falseotherwise.
-
contains
- Parameters:
componentType- TheComponentTypeto test for.- Returns:
trueif this Archetype contains the providedComponentType
-
contains
- Parameters:
archetype- The Archetype of component types to check for.- Returns:
trueif this Archetype contains allComponentType's from the provided Archetype.
-
validateComponentType
Called to validate that the providedComponentTypeexists within this Archetype.Throws an
IllegalArgumentExceptionif theComponentTypedoes not exist within this Archetype.- Parameters:
componentType- TheComponentTypeto validate.
-
validateComponents
public void validateComponents(@Nonnull Component<ECS_TYPE>[] components, @Nullable ComponentType<ECS_TYPE, UnknownComponents<ECS_TYPE>> ignore) Called to validate that the provided array ofComponent's matches this Archetype.Throws an
IllegalStateExceptionif anyComponentdoes not match the expectedComponentType.- Parameters:
components- The array of components to validate.ignore- An optionalComponentTypeto ignore during validation.
-
hasSerializableComponents
Determines whether this archetype has any serializable components.- Parameters:
data- The component registry data.- Returns:
trueif this archetype has any serializable components,falseotherwise.
-
getSerializableArchetype
@Nonnull public Archetype<ECS_TYPE> getSerializableArchetype(@Nonnull ComponentRegistry.Data<ECS_TYPE> data, @Nullable Predicate<ComponentType<ECS_TYPE, ?>> filter) Gets a new archetype containing only the serializable components from this archetype.- Parameters:
data- The component registry data.filter- Optional additional predicate; components failing the test are excluded. null means no additional filtering.- Returns:
- a new archetype containing only the serializable components from this archetype.
-
asExactQuery
- Returns:
- the exact archetype query for this archetype.
-
of
@Nonnull public static <ECS_TYPE> Archetype<ECS_TYPE> of(@Nonnull ComponentType<ECS_TYPE, ?> componentTypes) Creates a newArchetypeinstance from a singleComponentType.- Type Parameters:
ECS_TYPE- The ECS entity data type.- Parameters:
componentTypes- The component type.- Returns:
- the new archetype, containing only the provided component type.
-
of
@SafeVarargs public static <ECS_TYPE> Archetype<ECS_TYPE> of(@Nonnull ComponentType<ECS_TYPE, ?>... componentTypes) Creates a newArchetypeinstance from multipleComponentType's.- Type Parameters:
ECS_TYPE- The ECS entity data type.- Parameters:
componentTypes- The component types.- Returns:
- the new archetype, containing the provided component types.
-
add
@Nonnull public static <ECS_TYPE, T extends Component<ECS_TYPE>> Archetype<ECS_TYPE> add(@Nonnull Archetype<ECS_TYPE> archetype, @Nonnull ComponentType<ECS_TYPE, T> componentType) - Type Parameters:
ECS_TYPE- The ECS entity data type.T- The component type.- Parameters:
archetype- The existing archetype.componentType- The component type to add.- Returns:
- the new archetype with the added component type.
-
remove
public static <ECS_TYPE, T extends Component<ECS_TYPE>> Archetype<ECS_TYPE> remove(@Nonnull Archetype<ECS_TYPE> archetype, @Nonnull ComponentType<ECS_TYPE, T> componentType) - Type Parameters:
ECS_TYPE- The ECS entity data type.T- The component type.- Parameters:
archetype- The existing archetype.componentType- The component type to remove.- Returns:
- the new archetype with the removed component type.
-
test
-
requiresComponentType
Description copied from interface:QueryControls 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:
requiresComponentTypein interfaceQuery<ECS_TYPE>- Returns:
trueif thecomponentTypeis required.
-
validateRegistry
Description copied from interface:QueryValidates that the providedComponentRegistryis compatible with this query.- Specified by:
validateRegistryin interfaceQuery<ECS_TYPE>- Parameters:
registry- The component registry to validate against.
-
validate
-
equals
-
hashCode
-
toString
-