use of org.terasology.engine.entitySystem.event.ReceiveEvent in project Terasology by MovingBlocks.
the class VoxelWorldSystem method onChunkUnloaded.
/**
* free chunk region from bullet
*
* @param beforeChunkUnload
* @param worldEntity
*/
@ReceiveEvent(components = WorldComponent.class)
public void onChunkUnloaded(BeforeChunkUnload beforeChunkUnload, EntityRef worldEntity) {
Vector3ic chunkPos = beforeChunkUnload.getChunkPos();
colliders.forEach(k -> k.unloadChunk(chunkPos));
}
use of org.terasology.engine.entitySystem.event.ReceiveEvent in project Terasology by MovingBlocks.
the class ThirdPersonRemoteClientSystem method onHeldItemActivated.
@ReceiveEvent
public void onHeldItemActivated(OnActivatedComponent event, EntityRef player, CharacterHeldItemComponent heldItemComponent, CharacterComponent characterComponents) {
if (relatesToLocalPlayer(player)) {
logger.debug("onHeldItemActivated found its given player to relate to the local player, ignoring: {}", player);
return;
}
logger.debug("onHeldItemActivated says the given player is not the local player's character entity: {}", player);
EntityRef newItem = heldItemComponent.selectedItem;
linkHeldItemLocationForRemotePlayer(newItem, player);
}
use of org.terasology.engine.entitySystem.event.ReceiveEvent in project Terasology by MovingBlocks.
the class ThirdPersonRemoteClientSystem method onHeldItemChanged.
@ReceiveEvent
public void onHeldItemChanged(OnChangedComponent event, EntityRef character, CharacterHeldItemComponent heldItemComponent, CharacterComponent characterComponents) {
if (relatesToLocalPlayer(character)) {
logger.debug("onHeldItemChanged found its given character to relate to the local player, ignoring: {}", character);
return;
}
logger.debug("onHeldItemChanged says the given character is not the local player's character entity: {}", character);
EntityRef newItem = heldItemComponent.selectedItem;
linkHeldItemLocationForRemotePlayer(newItem, character);
}
use of org.terasology.engine.entitySystem.event.ReceiveEvent in project Terasology by MovingBlocks.
the class LocalPlayerSystem method onFrobButton.
@ReceiveEvent(components = CharacterComponent.class)
public void onFrobButton(FrobButton event, EntityRef character) {
if (event.getState() != ButtonState.DOWN) {
return;
}
ResourceUrn activeInteractionScreenUri = InteractionUtil.getActiveInteractionScreenUri(character);
if (activeInteractionScreenUri != null) {
InteractionUtil.cancelInteractionAsClient(character);
return;
}
boolean activeRequestSent = localPlayer.activateTargetAsClient();
if (activeRequestSent) {
event.consume();
}
}
use of org.terasology.engine.entitySystem.event.ReceiveEvent in project Terasology by MovingBlocks.
the class LocalPlayerSystem method onMouseMove.
@ReceiveEvent(components = CharacterComponent.class)
public void onMouseMove(MouseAxisEvent event, EntityRef entity) {
MouseAxis axis = event.getMouseAxis();
if (axis == MouseAxis.X) {
lookYawDelta = event.getValue();
} else if (axis == MouseAxis.Y) {
lookPitchDelta = event.getValue();
}
event.consume();
}
Aggregations