Search in sources :

Example 1 with IGuiPacketSender

use of codechicken.core.IGuiPacketSender in project Galacticraft by micdoodle8.

the class NEISPH method openPotionGui.

private void openPotionGui(EntityPlayerMP player, PacketCustom packet) {
    InventoryBasic b = new InventoryBasic("potionStore", true, 9);
    for (int i = 0; i < b.getSizeInventory(); i++) {
        b.setInventorySlotContents(i, packet.readItemStack());
    }
    ServerUtils.openSMPContainer(player, new ContainerPotionCreator(player.inventory, b), new IGuiPacketSender() {

        @Override
        public void sendPacket(EntityPlayerMP player, int windowId) {
            PacketCustom packet = new PacketCustom(channel, 24);
            packet.writeByte(windowId);
            packet.sendToPlayer(player);
        }
    });
}
Also used : IGuiPacketSender(codechicken.core.IGuiPacketSender) PacketCustom(codechicken.lib.packet.PacketCustom) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) InventoryBasic(net.minecraft.inventory.InventoryBasic)

Example 2 with IGuiPacketSender

use of codechicken.core.IGuiPacketSender in project Galacticraft by micdoodle8.

the class NEISPH method processCreativeInv.

public static void processCreativeInv(EntityPlayerMP sender, boolean open) {
    if (open) {
        ServerUtils.openSMPContainer(sender, new ContainerCreativeInv(sender, new ExtendedCreativeInv(NEIServerConfig.forPlayer(sender.getName()), Side.SERVER)), new IGuiPacketSender() {

            @Override
            public void sendPacket(EntityPlayerMP player, int windowId) {
                PacketCustom packet = new PacketCustom(channel, 23);
                packet.writeBoolean(true);
                packet.writeByte(windowId);
                packet.sendToPlayer(player);
            }
        });
    } else {
        sender.closeContainer();
        PacketCustom packet = new PacketCustom(channel, 23);
        packet.writeBoolean(false);
        packet.sendToPlayer(sender);
    }
}
Also used : IGuiPacketSender(codechicken.core.IGuiPacketSender) PacketCustom(codechicken.lib.packet.PacketCustom) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Aggregations

IGuiPacketSender (codechicken.core.IGuiPacketSender)2 PacketCustom (codechicken.lib.packet.PacketCustom)2 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)2 InventoryBasic (net.minecraft.inventory.InventoryBasic)1