package com.github.steveice10.mc.protocol.packet.ingame.client.window;

import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.packet.Packet;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;

import java.io.IOException;

@Data
@Setter(AccessLevel.NONE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor
public class ClientEditBookPacket implements Packet {
    private @NonNull ItemStack book;
    private boolean signing;

    @Override
    public void read(NetInput in) throws IOException {
        this.book = ItemStack.read(in);
        this.signing = in.readBoolean();
    }

    @Override
    public void write(NetOutput out) throws IOException {
        ItemStack.write(out, this.book);
        out.writeBoolean(this.signing);
    }

    @Override
    public boolean isPriority() {
        return false;
    }
}

@@ -115,38 +115,168 @@
 ata.
-game.entity.metadata.ItemStack
+MagicValues;%0Aimport com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;%0Aimport com.github.steveice10.mc.protocol.data.game.entity.player.Hand
 ;%0Aim
@@ -841,16 +841,48 @@
 signing;
+%0A    private @NonNull Hand hand;
 %0A%0A    @O
@@ -1025,16 +1025,82 @@
 lean();%0A
+        this.hand = MagicValues.key(Hand.class, in.readVarInt());%0A
     %7D%0A%0A 
@@ -1211,16 +1211,16 @@
 .book);%0A
-
         
@@ -1251,16 +1251,81 @@
 gning);%0A
+        out.writeVarInt(MagicValues.value(Integer.class, hand));%0A
     %7D%0A%0A 

add hand to edit book