use of org.terasology.logic.characters.events.ActivationRequestDenied in project Terasology by MovingBlocks.
the class CharacterSystem method onActivationRequest.
@ReceiveEvent(components = { CharacterComponent.class, LocationComponent.class }, netFilter = RegisterMode.AUTHORITY)
public void onActivationRequest(ActivationRequest event, EntityRef character) {
if (isPredictionOfEventCorrect(character, event)) {
OnItemUseEvent onItemUseEvent = new OnItemUseEvent();
event.getInstigator().send(onItemUseEvent);
if (!onItemUseEvent.isConsumed()) {
if (event.getUsedOwnedEntity().exists()) {
event.getUsedOwnedEntity().send(new ActivateEvent(event));
} else {
event.getTarget().send(new ActivateEvent(event));
}
}
} else {
character.send(new ActivationRequestDenied(event.getActivationId()));
}
}
Aggregations