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();
}
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;
}
Aggregations