Search in sources :

Example 6 with PendingEvent

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

the class EventSystemReplayImpl method originalSend.

// send method of EventSystemImpl
private void originalSend(EntityRef entity, Event event) {
    if (Thread.currentThread() != mainThread) {
        pendingEvents.offer(new PendingEvent(entity, event));
    } else {
        networkReplicate(entity, event);
        Set<EventHandlerInfo> selectedHandlersSet = selectEventHandlers(event.getClass(), entity);
        List<EventHandlerInfo> selectedHandlers = Lists.newArrayList(selectedHandlersSet);
        selectedHandlers.sort(priorityComparator);
        if (event instanceof ConsumableEvent) {
            sendConsumableEvent(entity, event, selectedHandlers);
        } else {
            sendStandardEvent(entity, event, selectedHandlers);
        }
    }
}
Also used : PendingEvent(org.terasology.engine.entitySystem.event.PendingEvent) AbstractConsumableEvent(org.terasology.engine.entitySystem.event.AbstractConsumableEvent) ConsumableEvent(org.terasology.engine.entitySystem.event.ConsumableEvent)

Aggregations

PendingEvent (org.terasology.engine.entitySystem.event.PendingEvent)6 AbstractConsumableEvent (org.terasology.engine.entitySystem.event.AbstractConsumableEvent)2 ConsumableEvent (org.terasology.engine.entitySystem.event.ConsumableEvent)2 Component (org.terasology.gestalt.entitysystem.component.Component)2 Event (org.terasology.engine.entitySystem.event.Event)1 NetworkComponent (org.terasology.engine.network.NetworkComponent)1 BlockComponent (org.terasology.engine.world.block.BlockComponent)1