Search in sources :

Example 1 with EventSystemImpl

use of org.terasology.engine.entitySystem.event.internal.EventSystemImpl in project Terasology by MovingBlocks.

the class PojoEventSystemTests method setup.

@BeforeEach
public void setup() {
    ContextImpl context = new ContextImpl();
    CoreRegistry.setContext(context);
    Reflections reflections = new Reflections(getClass().getClassLoader());
    TypeHandlerLibrary serializationLibrary = new TypeHandlerLibraryImpl(reflections);
    EntitySystemLibrary entitySystemLibrary = new EntitySystemLibrary(context, serializationLibrary);
    compLibrary = entitySystemLibrary.getComponentLibrary();
    entityManager = new PojoEntityManager();
    entityManager.setComponentLibrary(entitySystemLibrary.getComponentLibrary());
    entityManager.setPrefabManager(new PojoPrefabManager(context));
    eventSystem = new EventSystemImpl(true);
    entityManager.setEventSystem(eventSystem);
    entity = entityManager.create();
}
Also used : PojoPrefabManager(org.terasology.engine.entitySystem.prefab.internal.PojoPrefabManager) TypeHandlerLibrary(org.terasology.persistence.typeHandling.TypeHandlerLibrary) EntitySystemLibrary(org.terasology.engine.entitySystem.metadata.EntitySystemLibrary) PojoEntityManager(org.terasology.engine.entitySystem.entity.internal.PojoEntityManager) ContextImpl(org.terasology.engine.context.internal.ContextImpl) TypeHandlerLibraryImpl(org.terasology.engine.persistence.typeHandling.TypeHandlerLibraryImpl) EventSystemImpl(org.terasology.engine.entitySystem.event.internal.EventSystemImpl) Reflections(org.reflections.Reflections) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with EventSystemImpl

use of org.terasology.engine.entitySystem.event.internal.EventSystemImpl in project Terasology by MovingBlocks.

the class EntitySystemSetupUtil method createEventSystem.

private static EventSystem createEventSystem(NetworkSystem networkSystem, PojoEntityManager entityManager, EntitySystemLibrary library, RecordedEventStore recordedEventStore, RecordAndReplaySerializer recordAndReplaySerializer, RecordAndReplayUtils recordAndReplayUtils, RecordAndReplayCurrentStatus recordAndReplayCurrentStatus) {
    EventSystem eventSystem;
    List<Class<?>> selectedClassesToRecord = createSelectedClassesToRecordList();
    if (recordAndReplayCurrentStatus.getStatus() == RecordAndReplayStatus.PREPARING_REPLAY) {
        eventSystem = new EventSystemReplayImpl(library.getEventLibrary(), networkSystem, entityManager, recordedEventStore, recordAndReplaySerializer, recordAndReplayUtils, selectedClassesToRecord, recordAndReplayCurrentStatus);
    } else {
        EventCatcher eventCatcher = new EventCatcher(selectedClassesToRecord, recordedEventStore);
        eventSystem = new EventSystemImpl(networkSystem.getMode().isAuthority());
        eventSystem = new NetworkEventSystemDecorator(eventSystem, networkSystem, library.getEventLibrary());
        eventSystem = new RecordingEventSystemDecorator(eventSystem, eventCatcher, recordAndReplayCurrentStatus);
    }
    return eventSystem;
}
Also used : EventCatcher(org.terasology.engine.recording.EventCatcher) NetworkEventSystemDecorator(org.terasology.engine.network.NetworkEventSystemDecorator) EventSystemReplayImpl(org.terasology.engine.recording.EventSystemReplayImpl) RecordingEventSystemDecorator(org.terasology.engine.recording.RecordingEventSystemDecorator) EventSystem(org.terasology.engine.entitySystem.event.internal.EventSystem) EventSystemImpl(org.terasology.engine.entitySystem.event.internal.EventSystemImpl)

Aggregations

EventSystemImpl (org.terasology.engine.entitySystem.event.internal.EventSystemImpl)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Reflections (org.reflections.Reflections)1 ContextImpl (org.terasology.engine.context.internal.ContextImpl)1 PojoEntityManager (org.terasology.engine.entitySystem.entity.internal.PojoEntityManager)1 EventSystem (org.terasology.engine.entitySystem.event.internal.EventSystem)1 EntitySystemLibrary (org.terasology.engine.entitySystem.metadata.EntitySystemLibrary)1 PojoPrefabManager (org.terasology.engine.entitySystem.prefab.internal.PojoPrefabManager)1 NetworkEventSystemDecorator (org.terasology.engine.network.NetworkEventSystemDecorator)1 TypeHandlerLibraryImpl (org.terasology.engine.persistence.typeHandling.TypeHandlerLibraryImpl)1 EventCatcher (org.terasology.engine.recording.EventCatcher)1 EventSystemReplayImpl (org.terasology.engine.recording.EventSystemReplayImpl)1 RecordingEventSystemDecorator (org.terasology.engine.recording.RecordingEventSystemDecorator)1 TypeHandlerLibrary (org.terasology.persistence.typeHandling.TypeHandlerLibrary)1