Search in sources :

Example 6 with PacketCustom

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

the class ContainerSynchronised method detectAndSendChanges.

@Override
public final void detectAndSendChanges() {
    super.detectAndSendChanges();
    for (int i = 0; i < syncVars.size(); i++) {
        IContainerSyncVar var = syncVars.get(i);
        if (var.changed()) {
            PacketCustom packet = createSyncPacket();
            packet.writeByte(i);
            var.writeChange(packet);
            sendContainerPacket(packet);
            var.reset();
        }
    }
}
Also used : PacketCustom(codechicken.lib.packet.PacketCustom)

Example 7 with PacketCustom

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

the class ContainerPotionCreator method setPotionEffect.

public void setPotionEffect(int effectID, int duration, int amplifier) {
    PacketCustom packet = NEICPH.createContainerPacket();
    packet.writeBoolean(true);
    packet.writeByte(effectID);
    packet.writeInt(duration);
    packet.writeByte(amplifier);
    packet.sendToServer();
}
Also used : PacketCustom(codechicken.lib.packet.PacketCustom)

Example 8 with PacketCustom

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

the class ContainerPotionCreator method removePotionEffect.

public void removePotionEffect(int effectID) {
    PacketCustom packet = NEICPH.createContainerPacket();
    packet.writeBoolean(false);
    packet.writeByte(effectID);
    packet.sendToServer();
}
Also used : PacketCustom(codechicken.lib.packet.PacketCustom)

Example 9 with PacketCustom

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

the class NEISPH method sendAddMagneticItemTo.

public static void sendAddMagneticItemTo(EntityPlayerMP player, EntityItem item) {
    PacketCustom packet = new PacketCustom(channel, 13);
    packet.writeInt(item.getEntityId());
    packet.sendToPlayer(player);
}
Also used : PacketCustom(codechicken.lib.packet.PacketCustom)

Example 10 with PacketCustom

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

the class NEISPH method sendHasServerSideTo.

public static void sendHasServerSideTo(EntityPlayerMP player) {
    NEIServerConfig.logger.debug("Sending serverside check to: " + player.getName());
    PacketCustom packet = new PacketCustom(channel, 1);
    packet.writeByte(NEIActions.protocol);
    packet.writeString(player.worldObj.getWorldInfo().getWorldName());
    packet.sendToPlayer(player);
}
Also used : PacketCustom(codechicken.lib.packet.PacketCustom)

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