package com.github.lunatrius.schematica.network.message;

import com.github.lunatrius.schematica.world.SchematicWorld;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;

public class MessageSchematicBegin implements IMessage, IMessageHandler<MessageSchematicBegin, IMessage> {
    public int width;
    public int height;
    public int length;

    public MessageSchematicBegin() {
    }

    public MessageSchematicBegin(SchematicWorld schematic) {
        this.width = schematic.getWidth();
        this.height = schematic.getHeight();
        this.length = schematic.getLength();
    }

    @Override
    public void fromBytes(ByteBuf buf) {
        this.width = buf.readShort();
        this.height = buf.readShort();
        this.length = buf.readShort();
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeShort(this.width);
        buf.writeShort(this.height);
        buf.writeShort(this.length);
    }

    @Override
    public IMessage onMessage(MessageSchematicBegin message, MessageContext ctx) {
        // TODO: implement
        return null;
    }
}

@@ -112,16 +112,65 @@
 cWorld;%0A
+import cpw.mods.fml.common.network.ByteBufUtils;%0A
 import c
@@ -217,16 +217,16 @@
 essage;%0A
-
 import c
@@ -373,16 +373,53 @@
 ByteBuf;
+%0Aimport net.minecraft.item.ItemStack;
 %0A%0Apublic
@@ -519,16 +519,43 @@
 sage%3E %7B%0A
+    public ItemStack icon;%0A
     publ
@@ -716,24 +716,65 @@
 chematic) %7B%0A
+        this.icon = schematic.getIcon();%0A
         this
@@ -948,32 +948,85 @@
 (ByteBuf buf) %7B%0A
+        this.icon = ByteBufUtils.readItemStack(buf);%0A
         this.wid
@@ -1138,32 +1138,32 @@
 %0A%0A    @Override%0A
-
     public void 
@@ -1177,32 +1177,85 @@
 (ByteBuf buf) %7B%0A
+        ByteBufUtils.writeItemStack(buf, this.icon);%0A
         buf.writ

Add the schematic icon to the starting message.