Search in sources :

Example 1 with ChangeSelectedInventorySlotRequest

use of org.terasology.logic.inventory.events.ChangeSelectedInventorySlotRequest in project Terasology by MovingBlocks.

the class CharacterInventorySystem method onPrevItem.

@ReceiveEvent(components = { CharacterComponent.class }, netFilter = RegisterMode.CLIENT)
public void onPrevItem(ToolbarPrevButton event, EntityRef entity, SelectedInventorySlotComponent selectedInventorySlotComponent) {
    int prevSlot = (selectedInventorySlotComponent.slot + 9) % 10;
    localPlayer.getCharacterEntity().send(new ChangeSelectedInventorySlotRequest(prevSlot));
    event.consume();
}
Also used : ChangeSelectedInventorySlotRequest(org.terasology.logic.inventory.events.ChangeSelectedInventorySlotRequest) ReceiveEvent(org.terasology.entitySystem.event.ReceiveEvent)

Example 2 with ChangeSelectedInventorySlotRequest

use of org.terasology.logic.inventory.events.ChangeSelectedInventorySlotRequest in project Terasology by MovingBlocks.

the class CharacterInventorySystem method onNextItem.

@ReceiveEvent(components = { CharacterComponent.class }, netFilter = RegisterMode.CLIENT)
public void onNextItem(ToolbarNextButton event, EntityRef entity, SelectedInventorySlotComponent selectedInventorySlotComponent) {
    int nextSlot = (selectedInventorySlotComponent.slot + 1) % 10;
    localPlayer.getCharacterEntity().send(new ChangeSelectedInventorySlotRequest(nextSlot));
    event.consume();
}
Also used : ChangeSelectedInventorySlotRequest(org.terasology.logic.inventory.events.ChangeSelectedInventorySlotRequest) ReceiveEvent(org.terasology.entitySystem.event.ReceiveEvent)

Example 3 with ChangeSelectedInventorySlotRequest

use of org.terasology.logic.inventory.events.ChangeSelectedInventorySlotRequest in project Terasology by MovingBlocks.

the class CharacterInventorySystem method onSlotButton.

@ReceiveEvent(components = { CharacterComponent.class }, netFilter = RegisterMode.CLIENT)
public void onSlotButton(ToolbarSlotButton event, EntityRef entity) {
    localPlayer.getCharacterEntity().send(new ChangeSelectedInventorySlotRequest(event.getSlot()));
    event.consume();
}
Also used : ChangeSelectedInventorySlotRequest(org.terasology.logic.inventory.events.ChangeSelectedInventorySlotRequest) ReceiveEvent(org.terasology.entitySystem.event.ReceiveEvent)

Aggregations

ReceiveEvent (org.terasology.entitySystem.event.ReceiveEvent)3 ChangeSelectedInventorySlotRequest (org.terasology.logic.inventory.events.ChangeSelectedInventorySlotRequest)3