Search in sources :

Example 21 with PacketCustom

use of codechicken.lib.packet.PacketCustom in project Galacticraft by micdoodle8.

the class NEICPH method sendOpenEnchantmentWindow.

public static void sendOpenEnchantmentWindow() {
    PacketCustom packet = new PacketCustom(channel, 21);
    packet.sendToServer();
}
Also used : PacketCustom(codechicken.lib.packet.PacketCustom)

Example 22 with PacketCustom

use of codechicken.lib.packet.PacketCustom in project Galacticraft by micdoodle8.

the class NEICPH method sendToggleRain.

public static void sendToggleRain() {
    PacketCustom packet = new PacketCustom(channel, 9);
    packet.sendToServer();
}
Also used : PacketCustom(codechicken.lib.packet.PacketCustom)

Example 23 with PacketCustom

use of codechicken.lib.packet.PacketCustom in project Galacticraft by micdoodle8.

the class NEICPH method sendSetPropertyDisabled.

public static void sendSetPropertyDisabled(String name, boolean enable) {
    PacketCustom packet = new PacketCustom(channel, 12);
    packet.writeString(name);
    packet.writeBoolean(enable);
    packet.sendToServer();
}
Also used : PacketCustom(codechicken.lib.packet.PacketCustom)

Example 24 with PacketCustom

use of codechicken.lib.packet.PacketCustom 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 25 with PacketCustom

use of codechicken.lib.packet.PacketCustom in project Galacticraft by micdoodle8.

the class NEISPH method sendLoginState.

private void sendLoginState(EntityPlayerMP player) {
    LinkedList<String> actions = new LinkedList<String>();
    LinkedList<String> disabled = new LinkedList<String>();
    LinkedList<String> enabled = new LinkedList<String>();
    LinkedList<ItemStack> bannedItems = new LinkedList<ItemStack>();
    PlayerSave playerSave = NEIServerConfig.forPlayer(player.getName());
    for (String name : NEIActions.nameActionMap.keySet()) {
        if (NEIServerConfig.canPlayerPerformAction(player.getName(), name)) {
            actions.add(name);
        }
        if (NEIServerConfig.isActionDisabled(player.dimension, name)) {
            disabled.add(name);
        }
        if (playerSave.isActionEnabled(name)) {
            enabled.add(name);
        }
    }
    for (ItemStackMap.Entry<Set<String>> entry : NEIServerConfig.bannedItems.entries()) {
        if (!NEIServerConfig.isPlayerInList(player.getName(), entry.value, true)) {
            bannedItems.add(entry.key);
        }
    }
    PacketCustom packet = new PacketCustom(channel, 10);
    packet.writeByte(actions.size());
    for (String s : actions) {
        packet.writeString(s);
    }
    packet.writeByte(disabled.size());
    for (String s : disabled) {
        packet.writeString(s);
    }
    packet.writeByte(enabled.size());
    for (String s : enabled) {
        packet.writeString(s);
    }
    packet.writeInt(bannedItems.size());
    for (ItemStack stack : bannedItems) {
        packet.writeItemStack(stack);
    }
    packet.sendToPlayer(player);
}
Also used : Set(java.util.Set) PacketCustom(codechicken.lib.packet.PacketCustom) ItemStack(net.minecraft.item.ItemStack) LinkedList(java.util.LinkedList)

Aggregations

PacketCustom (codechicken.lib.packet.PacketCustom)27 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 ItemStack (net.minecraft.item.ItemStack)3 IGuiPacketSender (codechicken.core.IGuiPacketSender)2 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1 InventoryBasic (net.minecraft.inventory.InventoryBasic)1 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1