// Path: src/main/java/me/dmillerw/remoteio/client/gui/GuiFrequency.java
// public class GuiFrequency extends GuiBase {
// 
//     private static final ResourceLocation GUI_TEXTURE = new ResourceLocation(ModInfo.MOD_ID + ":textures/gui/frequency.png");
// 
//     private static final int GUI_WIDTH = 256;
//     private static final int GUI_HEIGHT = 166;
// 
//     private static final int LIST_WIDTH = 240;
//     private static final int LIST_HEIGHT = 128;
// 
//     private static final int FREQUENCY_X = 9;
//     private static final int FREQUENCY_Y = 9;
//     private static final int FREQUENCY_WIDTH = 36;
//     private static final int FREQUENCY_HEIGHT = 14;
// 
//     private static final int NAME_X = 53;
//     private static final int NAME_Y = 9;
//     private static final int NAME_WIDTH = 150;
//     private static final int NAME_HEIGHT = 14;
// 
//     public static Map<Integer, String> frequencies = Maps.newHashMap();
// 
//     private ElementTextBox frequencyField;
//     private ElementTextBox nameField;
// 
//     public GuiFrequency() {
//         this.xSize = GUI_WIDTH;
//         this.ySize = GUI_HEIGHT;
//         this.zLevel = 0.0F;
//     }
// 
//     public void initGui() {
//         super.initGui();
// 
//         frequencyField = registerElement(new ElementTextBox(this, "frequency", guiLeft + FREQUENCY_X, guiTop + FREQUENCY_Y, FREQUENCY_WIDTH, FREQUENCY_HEIGHT));
//         frequencyField.setPlaceholder("0");
//         frequencyField.setTextAlignment(ElementTextBox.Alignment.CENTER);
//         frequencyField.setFocusedBackgroundColor(0x0d0d39);
//         frequencyField.setTextOffset(0, 4);
//         frequencyField.setValidator(new Predicate<Character>() {
//             @Override
//             public boolean apply(@Nullable Character input) {
//                 return Character.isDigit(input);
//             }
//         });
// 
//         nameField = registerElement(new ElementTextBox(this, "name", guiLeft + NAME_X, guiTop + NAME_Y, NAME_WIDTH, NAME_HEIGHT));
//         nameField.setPlaceholder("Name...");
//         nameField.setFocusedBackgroundColor(0x0d0d39);
//         nameField.setTextOffset(2, 4);
//     }
// 
//     @Override
//     public void drawScreen(int mouseX, int mouseY, float partialTicks) {
//         mc.renderEngine.bindTexture(GUI_TEXTURE);
//         drawTexturedModalRect(guiLeft, guiTop, 0, 0, GUI_WIDTH, GUI_HEIGHT);
// 
//         int i = 0;
//         for (Map.Entry<Integer, String> entry : frequencies.entrySet()) {
//             fontRendererObj.drawString(entry.getValue(), guiLeft + 9, guiTop + 31 + ((fontRendererObj.FONT_HEIGHT * i) + 2), 0xFFFFFF);
//             i++;
//         }
// 
//         super.drawScreen(mouseX, mouseY, partialTicks);
//     }
// 
//     @Override
//     public boolean doesGuiPauseGame() {
//         return false;
//     }
// }
// 
// Path: src/main/java/me/dmillerw/remoteio/network/PacketHandler.java
// public class PacketHandler {
// 
//     public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(ModInfo.MOD_ID);
// 
//     public static void addScheduledTask(INetHandler netHandler, Runnable runnable) {
//         FMLCommonHandler.instance().getWorldThread(netHandler).addScheduledTask(runnable);
//     }
// 
//     public static void initialize() {
//         INSTANCE.registerMessage(CActivateBlock.Handler.class, CActivateBlock.class, -1, Side.CLIENT);
//         INSTANCE.registerMessage(CBulkFrequencyUpdate.Handler.class, CBulkFrequencyUpdate.class, -2, Side.CLIENT);
//         INSTANCE.registerMessage(CFrequencyUpdate.Handler.class, CFrequencyUpdate.class, -3, Side.CLIENT);
// 
//         INSTANCE.registerMessage(SFrequencyUpdate.Handler.class, SFrequencyUpdate.class, 1, Side.SERVER);
//         INSTANCE.registerMessage(SSetFrequency.Handler.class, SSetFrequency.class, 2, Side.SERVER);
//     }
// }


import com.google.common.collect.Maps;
import io.netty.buffer.ByteBuf;
import me.dmillerw.remoteio.client.gui.GuiFrequency;
import me.dmillerw.remoteio.network.PacketHandler;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import java.util.Map;
package me.dmillerw.remoteio.network.packet.client;



/**
 * Created by dmillerw
 */
public class CBulkFrequencyUpdate implements IMessage {

    protected Map<Integer, String> map;

    public CBulkFrequencyUpdate() {

    }

    public CBulkFrequencyUpdate(Map<Integer, String> map) {
        this.map = map;
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeInt(map.size());
        for(Map.Entry<Integer, String> entry : map.entrySet()) {
            buf.writeInt(entry.getKey());
            ByteBufUtils.writeUTF8String(buf, entry.getValue());
        }
    }

// Path: src/main/java/me/dmillerw/remoteio/client/gui/GuiFrequency.java
// public class GuiFrequency extends GuiBase {
// 
//     private static final ResourceLocation GUI_TEXTURE = new ResourceLocation(ModInfo.MOD_ID + ":textures/gui/frequency.png");
// 
//     private static final int GUI_WIDTH = 256;
//     private static final int GUI_HEIGHT = 166;
// 
//     private static final int LIST_WIDTH = 240;
//     private static final int LIST_HEIGHT = 128;
// 
//     private static final int FREQUENCY_X = 9;
//     private static final int FREQUENCY_Y = 9;
//     private static final int FREQUENCY_WIDTH = 36;
//     private static final int FREQUENCY_HEIGHT = 14;
// 
//     private static final int NAME_X = 53;
//     private static final int NAME_Y = 9;
//     private static final int NAME_WIDTH = 150;
//     private static final int NAME_HEIGHT = 14;
// 
//     public static Map<Integer, String> frequencies = Maps.newHashMap();
// 
//     private ElementTextBox frequencyField;
//     private ElementTextBox nameField;
// 
//     public GuiFrequency() {
//         this.xSize = GUI_WIDTH;
//         this.ySize = GUI_HEIGHT;
//         this.zLevel = 0.0F;
//     }
// 
//     public void initGui() {
//         super.initGui();
// 
//         frequencyField = registerElement(new ElementTextBox(this, "frequency", guiLeft + FREQUENCY_X, guiTop + FREQUENCY_Y, FREQUENCY_WIDTH, FREQUENCY_HEIGHT));
//         frequencyField.setPlaceholder("0");
//         frequencyField.setTextAlignment(ElementTextBox.Alignment.CENTER);
//         frequencyField.setFocusedBackgroundColor(0x0d0d39);
//         frequencyField.setTextOffset(0, 4);
//         frequencyField.setValidator(new Predicate<Character>() {
//             @Override
//             public boolean apply(@Nullable Character input) {
//                 return Character.isDigit(input);
//             }
//         });
// 
//         nameField = registerElement(new ElementTextBox(this, "name", guiLeft + NAME_X, guiTop + NAME_Y, NAME_WIDTH, NAME_HEIGHT));
//         nameField.setPlaceholder("Name...");
//         nameField.setFocusedBackgroundColor(0x0d0d39);
//         nameField.setTextOffset(2, 4);
//     }
// 
//     @Override
//     public void drawScreen(int mouseX, int mouseY, float partialTicks) {
//         mc.renderEngine.bindTexture(GUI_TEXTURE);
//         drawTexturedModalRect(guiLeft, guiTop, 0, 0, GUI_WIDTH, GUI_HEIGHT);
// 
//         int i = 0;
//         for (Map.Entry<Integer, String> entry : frequencies.entrySet()) {
//             fontRendererObj.drawString(entry.getValue(), guiLeft + 9, guiTop + 31 + ((fontRendererObj.FONT_HEIGHT * i) + 2), 0xFFFFFF);
//             i++;
//         }
// 
//         super.drawScreen(mouseX, mouseY, partialTicks);
//     }
// 
//     @Override
//     public boolean doesGuiPauseGame() {
//         return false;
//     }
// }
// 
// Path: src/main/java/me/dmillerw/remoteio/network/PacketHandler.java
// public class PacketHandler {
// 
//     public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(ModInfo.MOD_ID);
// 
//     public static void addScheduledTask(INetHandler netHandler, Runnable runnable) {
//         FMLCommonHandler.instance().getWorldThread(netHandler).addScheduledTask(runnable);
//     }
// 
//     public static void initialize() {
//         INSTANCE.registerMessage(CActivateBlock.Handler.class, CActivateBlock.class, -1, Side.CLIENT);
//         INSTANCE.registerMessage(CBulkFrequencyUpdate.Handler.class, CBulkFrequencyUpdate.class, -2, Side.CLIENT);
//         INSTANCE.registerMessage(CFrequencyUpdate.Handler.class, CFrequencyUpdate.class, -3, Side.CLIENT);
// 
//         INSTANCE.registerMessage(SFrequencyUpdate.Handler.class, SFrequencyUpdate.class, 1, Side.SERVER);
//         INSTANCE.registerMessage(SSetFrequency.Handler.class, SSetFrequency.class, 2, Side.SERVER);
//     }
// }


// Path: src/main/java/me/dmillerw/remoteio/network/packet/client/CBulkFrequencyUpdate.java
import com.google.common.collect.Maps;
import io.netty.buffer.ByteBuf;
import me.dmillerw.remoteio.client.gui.GuiFrequency;
import me.dmillerw.remoteio.network.PacketHandler;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import java.util.Map;

package me.dmillerw.remoteio.network.packet.client;



/**
 * Created by dmillerw
 */
public class CBulkFrequencyUpdate implements IMessage {

    protected Map<Integer, String> map;

    public CBulkFrequencyUpdate() {

    }

    public CBulkFrequencyUpdate(Map<Integer, String> map) {
        this.map = map;
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeInt(map.size());
        for(Map.Entry<Integer, String> entry : map.entrySet()) {
            buf.writeInt(entry.getKey());
            ByteBufUtils.writeUTF8String(buf, entry.getValue());
        }
    }

    @Override