Search in sources :

Example 1 with InventoryManager

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

the class InventoryCell method takeAmount.

private void takeAmount(int amount) {
    EntityRef characterEntity = CoreRegistry.get(LocalPlayer.class).getCharacterEntity();
    InventoryManager inventoryManager = CoreRegistry.get(InventoryManager.class);
    inventoryManager.moveItem(getTransferEntity(), characterEntity, 0, getTargetInventory(), getTargetSlot(), amount);
}
Also used : InventoryManager(org.terasology.logic.inventory.InventoryManager) LocalPlayer(org.terasology.logic.players.LocalPlayer) EntityRef(org.terasology.entitySystem.entity.EntityRef)

Example 2 with InventoryManager

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

the class InventoryCell method giveAmount.

private void giveAmount(int amount) {
    EntityRef characterEntity = CoreRegistry.get(LocalPlayer.class).getCharacterEntity();
    InventoryManager inventoryManager = CoreRegistry.get(InventoryManager.class);
    inventoryManager.moveItem(getTargetInventory(), characterEntity, getTargetSlot(), getTransferEntity(), 0, amount);
}
Also used : InventoryManager(org.terasology.logic.inventory.InventoryManager) LocalPlayer(org.terasology.logic.players.LocalPlayer) EntityRef(org.terasology.entitySystem.entity.EntityRef)

Example 3 with InventoryManager

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

the class InventoryCell method swapItem.

private void swapItem() {
    EntityRef characterEntity = CoreRegistry.get(LocalPlayer.class).getCharacterEntity();
    InventoryManager inventoryManager = CoreRegistry.get(InventoryManager.class);
    inventoryManager.switchItem(getTransferEntity(), characterEntity, 0, getTargetInventory(), getTargetSlot());
}
Also used : InventoryManager(org.terasology.logic.inventory.InventoryManager) LocalPlayer(org.terasology.logic.players.LocalPlayer) EntityRef(org.terasology.entitySystem.entity.EntityRef)

Aggregations

EntityRef (org.terasology.entitySystem.entity.EntityRef)3 InventoryManager (org.terasology.logic.inventory.InventoryManager)3 LocalPlayer (org.terasology.logic.players.LocalPlayer)3