Class System<ECS_TYPE>

java.lang.Object
com.hypixel.hytale.component.system.System<ECS_TYPE>
Type Parameters:
ECS_TYPE - The type of ECS this system belongs to.
All Implemented Interfaces:
ISystem<ECS_TYPE>
Direct Known Subclasses:
ArchetypeChunkSystem, ArchetypeDataSystem, HolderSystem, RefChangeSystem, RefSystem, StoreSystem, TickingSystem

public abstract class System<ECS_TYPE> extends Object implements ISystem<ECS_TYPE>
An abstract implementation of a component system with support for registering its own components and resources.

TODO: At the moment we must still have the ISystem interface so we can correctly identify classes such as with `registerSystemType(QuerySystem.class)` This could be improved by using a special interface for SystemType's or by just allowing any interface/class

  • Constructor Details

    • System

      public System()
  • Method Details

    • registerResource

      @Nonnull public <T extends Resource<ECS_TYPE>> ResourceType<ECS_TYPE,T> registerResource(@Nonnull Class<? super T> tClass, @Nonnull Supplier<T> supplier)
      Registers the given resource under this system.
      Type Parameters:
      T - The store type.
      Parameters:
      tClass - The class type of the resource.
      supplier - The supplier used to build resource instances.
      Returns:
      the resource type of the registered resource.
    • 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)
      Registers the given resource under this system.
      Type Parameters:
      T - The store type.
      Parameters:
      tClass - The class type of the resource.
      id - The unique identifier for the resource.
      codec - The codec builder used to read/write the resource.
      Returns:
      the resource type of the registered resource.
    • getComponentRegistrations

      @Nonnull public List<ComponentRegistration<ECS_TYPE,?>> getComponentRegistrations()
      Returns:
      the list of components registered under this system.
    • getResourceRegistrations

      @Nonnull public List<ResourceRegistration<ECS_TYPE,?>> getResourceRegistrations()
      Returns:
      the list of resources registered under this system.