use of org.terasology.logic.inventory.events.InventorySlotChangedEvent in project Terasology by MovingBlocks.
the class InventoryUtils method putItemIntoSlot.
static void putItemIntoSlot(EntityRef entity, EntityRef item, int slot) {
InventoryComponent inventory = entity.getComponent(InventoryComponent.class);
EntityRef oldItem = inventory.itemSlots.get(slot);
inventory.itemSlots.set(slot, item);
entity.saveComponent(inventory);
entity.send(new InventorySlotChangedEvent(slot, oldItem, item));
}
Aggregations