Search in sources :

Example 1 with PacketOpenInventory

use of io.xol.chunkstories.api.net.packets.PacketOpenInventory in project chunkstories by Hugobros3.

the class ServerPlayer method openInventory.

@Override
public void openInventory(Inventory inventory) {
    Entity entity = this.getControlledEntity();
    if (inventory.isAccessibleTo(entity)) {
        if (inventory instanceof EntityComponentInventory.EntityInventory) {
            // this.sendMessage("Notice: Pushing this inventory to you so you can see the
            // contents");
            EntityComponentInventory.EntityInventory i = (EntityComponentInventory.EntityInventory) inventory;
            i.asComponent().pushComponent(this);
        }
        // this.sendMessage("Sending you the open inventory request.");
        PacketOpenInventory open = new PacketOpenInventory(getWorld(), inventory);
        this.pushPacket(open);
    }
// else
// this.sendMessage("Notice: You don't have access to this inventory.");
}
Also used : Entity(io.xol.chunkstories.api.entity.Entity) PacketOpenInventory(io.xol.chunkstories.api.net.packets.PacketOpenInventory) EntityComponentInventory(io.xol.chunkstories.api.entity.components.EntityComponentInventory)

Aggregations

Entity (io.xol.chunkstories.api.entity.Entity)1 EntityComponentInventory (io.xol.chunkstories.api.entity.components.EntityComponentInventory)1 PacketOpenInventory (io.xol.chunkstories.api.net.packets.PacketOpenInventory)1