Add ClientEditBookPacket

This commit is contained in:
Jonas Herzig 2018-07-19 13:34:45 +02:00
parent bfc511cb49
commit cace45970a
2 changed files with 45 additions and 1 deletions

View file

@ -29,6 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientClose
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientConfirmTransactionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCraftingBookDataPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientEditBookPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientEnchantItemPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientPrepareCraftingGridPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket;
@ -445,7 +446,7 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerOutgoing(0x08, ClientWindowActionPacket.class);
this.registerOutgoing(0x09, ClientCloseWindowPacket.class);
this.registerOutgoing(0x0A, ClientPluginMessagePacket.class);
// FIXME: 0B
this.registerOutgoing(0x0B, ClientEditBookPacket.class);
// FIXME: 0C
this.registerOutgoing(0x0D, ClientPlayerInteractEntityPacket.class);
this.registerOutgoing(0x0E, ClientKeepAlivePacket.class);

View file

@ -0,0 +1,43 @@
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.mc.protocol.packet.MinecraftPacket;
import com.github.steveice10.mc.protocol.util.NetUtil;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;
import java.io.IOException;
public class ClientEditBookPacket extends MinecraftPacket {
private ItemStack book;
private boolean isSigning;
@SuppressWarnings("unused")
private ClientEditBookPacket() {
}
public ClientEditBookPacket(ItemStack book, boolean isSigning) {
this.book = book;
this.isSigning = isSigning;
}
public ItemStack getBook() {
return this.book;
}
public boolean getIsSigning() {
return this.isSigning;
}
@Override
public void read(NetInput in) throws IOException {
this.book = NetUtil.readItem(in);
this.isSigning = in.readBoolean();
}
@Override
public void write(NetOutput out) throws IOException {
NetUtil.writeItem(out, this.book);
out.writeBoolean(this.isSigning);
}
}