Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- isShutdown()
- shutdown()
- getDataUpdateLock()
- getUnknownComponentType()
- getNonTickingComponentType()
- getNonSerializedComponentType()
- getHolderSystemType()
- getRefSystemType()
- getRefChangeSystemType()
- getQuerySystemType()
- getTickingSystemType()
- getTickableSystemType()
- getRunWhenPausedSystemType()
- getArchetypeTickingSystemType()
- registerComponent(Class, Supplier)
- registerComponent(Class, String, BuilderCodec)
- registerComponent(Class, String, BuilderCodec, boolean)
- unregisterComponent(ComponentType)
- registerResource(Class, Supplier)
- registerResource(Class, String, BuilderCodec)
- unregisterResource(ResourceType)
- registerSystemType(Class)
- unregisterSystemType(SystemType)
- registerEntityEventType(Class)
- registerWorldEventType(Class)
- unregisterEntityEventType(EntityEventType)
- unregisterEntityHolderEventType(EntityHolderEventType)
- unregisterWorldEventType(WorldEventType)
- registerSystemGroup()
- registerSystemGroup(Set)
- unregisterSystemGroup(SystemGroup)
- registerSystem(ISystem)
- registerSystem(ISystem, boolean)
- unregisterSystem(Class)
- registerSpatialResource(Supplier)
- addStore(ECS_TYPE, IResourceStorage)
- addStore(ECS_TYPE, IResourceStorage, Consumer)
- removeStore(Store)
- newHolder()
- newHolder(Archetype, Component[])
- _internal_getData()
- getData()
- getEntityCodec()
- assertInStoreThread()
- deserialize(BsonDocument)
- deserialize(BsonDocument, int)
- serialize(Holder)
- hasSystem(ISystem)
- hasSystemClass(Class)
- hasSystemType(SystemType)
- hasSystemGroup(SystemGroup)
- getEntityEventTypeForClass(Class)
- getEntityHolderEventTypeForClass(Class)
- getWorldEventTypeForClass(Class)
- toString()
- createComponent(ComponentType)
Class ComponentRegistry<ECS_TYPE>
java.lang.Object
com.hypixel.hytale.component.ComponentRegistry<ECS_TYPE>
- Type Parameters:
ECS_TYPE- The type of ECS instance the registry is associated with.
- All Implemented Interfaces:
IComponentRegistry<ECS_TYPE>
Contains registered components and systems, and stores for this registry
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA versioned immutable copy of registry data needed byStore's. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAllows for direct access to data from internal system when we already have validated the thread we are on.addStore(ECS_TYPE externalData, IResourceStorage resourceStorage) addStore(ECS_TYPE externalData, IResourceStorage resourceStorage, Consumer<Store<ECS_TYPE>> consumer) voidcreateComponent(ComponentType<ECS_TYPE, T> componentType) deserialize(org.bson.BsonDocument entityDocument) deserialize(org.bson.BsonDocument entityDocument, int version) Deprecated.getData()<T extends EcsEvent>
EntityEventType<ECS_TYPE, T> getEntityEventTypeForClass(Class<T> eClass) <T extends EcsEvent>
EntityHolderEventType<ECS_TYPE, T> getEntityHolderEventTypeForClass(Class<T> eClass) <T extends EcsEvent>
WorldEventType<ECS_TYPE, T> getWorldEventTypeForClass(Class<T> eClass) booleanhasSystemClass(Class<T> systemClass) booleanhasSystemGroup(SystemGroup<ECS_TYPE> group) hasSystemType(SystemType<ECS_TYPE, T> systemType) boolean<T extends Component<ECS_TYPE>>
ComponentType<ECS_TYPE, T> registerComponent(Class<? super T> tClass, String id, BuilderCodec<T> codec) Called to register a new component, providing the given class, id and codec.<T extends Component<ECS_TYPE>>
ComponentType<ECS_TYPE, T> registerComponent(Class<? super T> tClass, String id, BuilderCodec<T> codec, boolean skipValidation) Deprecated.Used to bypass validation for legacy components<T extends Component<ECS_TYPE>>
ComponentType<ECS_TYPE, T> registerComponent(Class<? super T> tClass, Supplier<T> supplier) Called to register a new component, providing the given class and constructor supplier.<T extends EcsEvent>
EntityEventType<ECS_TYPE, T> registerEntityEventType(Class<? super T> eventTypeClass) Called to register a new entity event type, providing the given class.<T extends Resource<ECS_TYPE>>
ResourceType<ECS_TYPE, T> registerResource(Class<? super T> tClass, String id, BuilderCodec<T> codec) Called to register a new resource, providing the given class, id and codec.<T extends Resource<ECS_TYPE>>
ResourceType<ECS_TYPE, T> registerResource(Class<? super T> tClass, Supplier<T> supplier) Called to register a new resource, providing the given class and constructor supplier.registerSpatialResource(Supplier<SpatialStructure<Ref<ECS_TYPE>>> supplier) Registers a spatial resource with the given supplier for creating spatial structures.voidregisterSystem(ISystem<ECS_TYPE> system) Called to register a new system, providing the given system instance.voidregisterSystem(ISystem<ECS_TYPE> system, boolean bypassClassCheck) Deprecated, for removal: This API element is subject to removal in a future version.registerSystemGroup(Set<Dependency<ECS_TYPE>> dependencies) <T extends ISystem<ECS_TYPE>>
SystemType<ECS_TYPE, T> registerSystemType(Class<? super T> systemTypeClass) Called to register a new system type, providing the given class.<T extends EcsEvent>
WorldEventType<ECS_TYPE, T> registerWorldEventType(Class<? super T> eventTypeClass) Called to register a new world event type, providing the given class.voidremoveStore(Store<ECS_TYPE> store) org.bson.BsonDocumentvoidshutdown()toString()unregisterComponent(ComponentType<ECS_TYPE, T> componentType) <T extends EcsEvent>
voidunregisterEntityEventType(EntityEventType<ECS_TYPE, T> eventType) <T extends EcsEvent>
voidunregisterEntityHolderEventType(EntityHolderEventType<ECS_TYPE, T> eventType) unregisterResource(ResourceType<ECS_TYPE, T> resourceType) voidunregisterSystem(Class<? extends ISystem<ECS_TYPE>> systemClass) voidunregisterSystemGroup(SystemGroup<ECS_TYPE> systemGroup) unregisterSystemType(SystemType<ECS_TYPE, T> systemType) <T extends EcsEvent>
voidunregisterWorldEventType(WorldEventType<ECS_TYPE, T> eventType)
-
Field Details
-
UNASSIGNED_INDEX
public static final int UNASSIGNED_INDEX- See Also:
-
DEFAULT_INITIAL_SIZE
public static final int DEFAULT_INITIAL_SIZE- See Also:
-
-
Constructor Details
-
ComponentRegistry
public ComponentRegistry()Default Constructor for aComponentRegistryinstance.
-
-
Method Details
-
isShutdown
public boolean isShutdown() -
shutdown
public void shutdown() -
getDataUpdateLock
-
getUnknownComponentType
-
getNonTickingComponentType
-
getNonSerializedComponentType
-
getHolderSystemType
-
getRefSystemType
-
getRefChangeSystemType
-
getQuerySystemType
-
getTickingSystemType
-
getTickableSystemType
-
getRunWhenPausedSystemType
-
getArchetypeTickingSystemType
@Nonnull public SystemType<ECS_TYPE, ArchetypeTickingSystem<ECS_TYPE>> getArchetypeTickingSystemType() -
registerComponent
@Nonnull public <T extends Component<ECS_TYPE>> ComponentType<ECS_TYPE,T> registerComponent(@Nonnull Class<? super T> tClass, @Nonnull Supplier<T> supplier) Description copied from interface:IComponentRegistryCalled to register a new component, providing the given class and constructor supplier.- Specified by:
registerComponentin interfaceIComponentRegistry<ECS_TYPE>- Type Parameters:
T- The type of the component.- Parameters:
tClass- The class of the component to register.supplier- The supplier to use to create new instances of the component.- Returns:
- The registered component type.
-
registerComponent
@Nonnull public <T extends Component<ECS_TYPE>> ComponentType<ECS_TYPE,T> registerComponent(@Nonnull Class<? super T> tClass, @Nonnull String id, @Nonnull BuilderCodec<T> codec) Description copied from interface:IComponentRegistryCalled to register a new component, providing the given class, id and codec.The codec allows for serialization and deserialization of the component, enabling it to be saved and loaded as needed.
- Specified by:
registerComponentin interfaceIComponentRegistry<ECS_TYPE>- Type Parameters:
T- The type of the component.- Parameters:
tClass- The class of the component to register.id- The unique identifier for the component.codec- The codec used for serialization and deserialization of the component.- Returns:
- The registered component type.
-
registerComponent
@Deprecated @Nonnull public <T extends Component<ECS_TYPE>> ComponentType<ECS_TYPE,T> registerComponent(@Nonnull Class<? super T> tClass, @Nonnull String id, @Nonnull BuilderCodec<T> codec, boolean skipValidation) Deprecated.Used to bypass validation for legacy components- Type Parameters:
T-- Returns:
-
unregisterComponent
public <T extends Component<ECS_TYPE>> void unregisterComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType) -
registerResource
@Nonnull public <T extends Resource<ECS_TYPE>> ResourceType<ECS_TYPE,T> registerResource(@Nonnull Class<? super T> tClass, @Nonnull Supplier<T> supplier) Description copied from interface:IComponentRegistryCalled to register a new resource, providing the given class and constructor supplier.- Specified by:
registerResourcein interfaceIComponentRegistry<ECS_TYPE>- Type Parameters:
T- The type of the resource.- Parameters:
tClass- The class of the resource to register.supplier- The supplier to use to create new instances of the resource.- Returns:
- The registered resource type.
-
registerResource
@Nonnull public <T extends Resource<ECS_TYPE>> ResourceType<ECS_TYPE,T> registerResource(@Nonnull Class<? super T> tClass, @Nonnull String id, @Nonnull BuilderCodec<T> codec) Description copied from interface:IComponentRegistryCalled to register a new resource, providing the given class, id and codec.- Specified by:
registerResourcein interfaceIComponentRegistry<ECS_TYPE>- Type Parameters:
T- The type of the resource.- Parameters:
tClass- The class of the resource to register.id- The unique identifier for the resource.codec- The codec used for serialization and deserialization of the resource.- Returns:
- The registered resource type.
-
unregisterResource
public <T extends Resource<ECS_TYPE>> void unregisterResource(@Nonnull ResourceType<ECS_TYPE, T> resourceType) -
registerSystemType
@Nonnull public <T extends ISystem<ECS_TYPE>> SystemType<ECS_TYPE,T> registerSystemType(@Nonnull Class<? super T> systemTypeClass) Description copied from interface:IComponentRegistryCalled to register a new system type, providing the given class.- Specified by:
registerSystemTypein interfaceIComponentRegistry<ECS_TYPE>- Type Parameters:
T- The type of the system.- Parameters:
systemTypeClass- The class of the system type to register.- Returns:
- The registered system type.
-
unregisterSystemType
public <T extends ISystem<ECS_TYPE>> void unregisterSystemType(@Nonnull SystemType<ECS_TYPE, T> systemType) -
registerEntityEventType
@Nonnull public <T extends EcsEvent> EntityEventType<ECS_TYPE,T> registerEntityEventType(@Nonnull Class<? super T> eventTypeClass) Description copied from interface:IComponentRegistryCalled to register a new entity event type, providing the given class.- Specified by:
registerEntityEventTypein interfaceIComponentRegistry<ECS_TYPE>- Type Parameters:
T- The type of the event.- Parameters:
eventTypeClass- The class of the event type to register.- Returns:
- The registered entity event type.
-
registerWorldEventType
@Nonnull public <T extends EcsEvent> WorldEventType<ECS_TYPE,T> registerWorldEventType(@Nonnull Class<? super T> eventTypeClass) Description copied from interface:IComponentRegistryCalled to register a new world event type, providing the given class.- Specified by:
registerWorldEventTypein interfaceIComponentRegistry<ECS_TYPE>- Type Parameters:
T- The type of the event.- Parameters:
eventTypeClass- The class of the event type to register.- Returns:
- The registered world event type.
-
unregisterEntityEventType
public <T extends EcsEvent> void unregisterEntityEventType(@Nonnull EntityEventType<ECS_TYPE, T> eventType) -
unregisterEntityHolderEventType
public <T extends EcsEvent> void unregisterEntityHolderEventType(@Nonnull EntityHolderEventType<ECS_TYPE, T> eventType) -
unregisterWorldEventType
public <T extends EcsEvent> void unregisterWorldEventType(@Nonnull WorldEventType<ECS_TYPE, T> eventType) -
registerSystemGroup
- Specified by:
registerSystemGroupin interfaceIComponentRegistry<ECS_TYPE>- Returns:
- A newly created system group instance.
-
registerSystemGroup
-
unregisterSystemGroup
-
registerSystem
Description copied from interface:IComponentRegistryCalled to register a new system, providing the given system instance.- Specified by:
registerSystemin interfaceIComponentRegistry<ECS_TYPE>- Parameters:
system- The system instance to register.
-
registerSystem
@Deprecated(forRemoval=true) public void registerSystem(@Nonnull ISystem<ECS_TYPE> system, boolean bypassClassCheck) Deprecated, for removal: This API element is subject to removal in a future version. -
unregisterSystem
-
registerSpatialResource
@Nonnull public ResourceType<ECS_TYPE, SpatialResource<Ref<ECS_TYPE>, ECS_TYPE>> registerSpatialResource(@Nonnull Supplier<SpatialStructure<Ref<ECS_TYPE>>> supplier) Description copied from interface:IComponentRegistryRegisters a spatial resource with the given supplier for creating spatial structures.- Specified by:
registerSpatialResourcein interfaceIComponentRegistry<ECS_TYPE>- Parameters:
supplier- The supplier that provides instances of SpatialStructure.- Returns:
- The registered spatial resource type.
-
addStore
@Nonnull public Store<ECS_TYPE> addStore(@Nonnull ECS_TYPE externalData, @Nonnull IResourceStorage resourceStorage) -
addStore
-
removeStore
-
newHolder
-
newHolder
-
_internal_getData
Allows for direct access to data from internal system when we already have validated the thread we are on. -
getData
- Returns:
-
getEntityCodec
-
assertInStoreThread
public void assertInStoreThread()- Throws:
AssertionError- if the current thread isn't one of the registered store threads.
-
deserialize
-
deserialize
@Nullable @Deprecated public Holder<ECS_TYPE> deserialize(@Nonnull org.bson.BsonDocument entityDocument, int version) Deprecated. -
serialize
-
hasSystem
-
hasSystemClass
-
hasSystemType
public <T extends ISystem<ECS_TYPE>> boolean hasSystemType(@Nonnull SystemType<ECS_TYPE, T> systemType) -
hasSystemGroup
-
getEntityEventTypeForClass
@Nullable public <T extends EcsEvent> EntityEventType<ECS_TYPE,T> getEntityEventTypeForClass(Class<T> eClass) -
getEntityHolderEventTypeForClass
@Nullable public <T extends EcsEvent> EntityHolderEventType<ECS_TYPE,T> getEntityHolderEventTypeForClass(Class<T> eClass) -
getWorldEventTypeForClass
@Nullable public <T extends EcsEvent> WorldEventType<ECS_TYPE,T> getWorldEventTypeForClass(Class<T> eClass) -
toString
-
createComponent
public <T extends Component<ECS_TYPE>> T createComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType)
-