@Override public CollectItemMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); int collector = ByteBufUtils.readVarInt(buf); int count = ByteBufUtils.readVarInt(buf); return new CollectItemMessage(id, collector, count); }
@Override public EncryptionKeyResponseMessage decode(ByteBuf buffer) throws IOException { byte[] sharedSecret = new byte[ByteBufUtils.readVarInt(buffer)]; buffer.readBytes(sharedSecret); byte[] verifyToken = new byte[ByteBufUtils.readVarInt(buffer)]; buffer.readBytes(verifyToken); return new EncryptionKeyResponseMessage(sharedSecret, verifyToken); }
@Override public EntityRemoveEffectMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); byte effect = buf.readByte(); return new EntityRemoveEffectMessage(id, effect); }
@Override public EncryptionKeyRequestMessage decode(ByteBuf buffer) throws IOException { String sessionId = ByteBufUtils.readUTF8(buffer); byte[] publicKey = new byte[ByteBufUtils.readVarInt(buffer)]; buffer.readBytes(publicKey); byte[] verifyToken = new byte[ByteBufUtils.readVarInt(buffer)]; buffer.readBytes(verifyToken); return new EncryptionKeyRequestMessage(sessionId, publicKey, verifyToken); }
@Override public EntityHeadRotationMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); int rotation = buf.readByte(); return new EntityHeadRotationMessage(id, rotation); }
@Override public PlayerSwingArmMessage decode(ByteBuf buf) throws IOException { int hand = ByteBufUtils.readVarInt(buf); return new PlayerSwingArmMessage(hand); }
@Override public ExperienceMessage decode(ByteBuf buffer) throws IOException { float barValue = buffer.readFloat(); int level = ByteBufUtils.readVarInt(buffer); int totalExp = ByteBufUtils.readVarInt(buffer); return new ExperienceMessage(barValue, level, totalExp); }
@Override public HandshakeMessage decode(ByteBuf buffer) throws IOException { int version = ByteBufUtils.readVarInt(buffer); String address = ByteBufUtils.readUTF8(buffer); int port = buffer.readUnsignedShort(); int state = ByteBufUtils.readVarInt(buffer); return new HandshakeMessage(version, address, port, state); }
@Override public EntityMetadataMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); List<Entry> metadata = GlowBufUtils.readMetadata(buf); return new EntityMetadataMessage(id, metadata); }
@Override public EntityTeleportMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); double x = buf.readDouble(); double y = buf.readDouble(); double z = buf.readDouble(); int rotation = buf.readByte(); int pitch = buf.readByte(); boolean ground = buf.readBoolean(); return new EntityTeleportMessage(id, x, y, z, rotation, pitch, ground); }
@Override public BlockActionMessage decode(ByteBuf buf) throws IOException { BlockVector vector = GlowBufUtils.readBlockPosition(buf); int data1 = buf.readByte(); int data2 = buf.readByte(); int blockType = ByteBufUtils.readVarInt(buf); return new BlockActionMessage(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), data1, data2, blockType); }
@Override public SpawnLightningStrikeMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); int mode = buf.readByte(); double x = buf.readDouble(); double y = buf.readDouble(); double z = buf.readDouble(); return new SpawnLightningStrikeMessage(id, mode, x, y, z); }
@Override public RelativeEntityPositionRotationMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); short x = buf.readShort(); short y = buf.readShort(); short z = buf.readShort(); int rotation = buf.readByte(); int pitch = buf.readByte(); boolean ground = buf.readBoolean(); return new RelativeEntityPositionRotationMessage(id, x, y, z, rotation, pitch, ground); }
@Override public SpawnPlayerMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); UUID uuid = GlowBufUtils.readUuid(buf); double x = buf.readDouble(); double y = buf.readDouble(); double z = buf.readDouble(); int rotation = buf.readByte(); int pitch = buf.readByte(); List<Entry> list = GlowBufUtils.readMetadata(buf); return new SpawnPlayerMessage(id, uuid, x, y, z, rotation, pitch, list); }
@Override public BlockBreakAnimationMessage decode(ByteBuf buf) throws IOException { int entityId = ByteBufUtils.readVarInt(buf); BlockVector vector = GlowBufUtils.readBlockPosition(buf); int destroyStage = buf.readByte(); return new BlockBreakAnimationMessage(entityId, vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), destroyStage); }
@Override public RelativeEntityPositionMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); short deltaX = buf.readShort(); short deltaY = buf.readShort(); short deltaZ = buf.readShort(); boolean onGround = buf.readBoolean(); return new RelativeEntityPositionMessage(id, deltaX, deltaY, deltaZ, onGround); }
@Override public BlockChangeMessage decode(ByteBuf buffer) throws IOException { BlockVector pos = GlowBufUtils.readBlockPosition(buffer); int type = ByteBufUtils.readVarInt(buffer); return new BlockChangeMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), type); }
@Override public SpawnPaintingMessage decode(ByteBuf buf) throws IOException { int id = ByteBufUtils.readVarInt(buf); UUID uuid = GlowBufUtils.readUuid(buf); String title = ByteBufUtils.readUTF8(buf); BlockVector vector = GlowBufUtils.readBlockPosition(buf); int facing = buf.readByte(); return new SpawnPaintingMessage(id, uuid, title, vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), facing); }
@Override public BlockPlacementMessage decode(ByteBuf buf) throws IOException { BlockVector pos = GlowBufUtils.readBlockPosition(buf); int direction = buf.readByte(); int hand = ByteBufUtils.readVarInt(buf); float cursorX = buf.readFloat(); float cursorY = buf.readFloat(); float cursorZ = buf.readFloat(); return new BlockPlacementMessage(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), direction, hand, cursorX, cursorY, cursorZ); }
@Override public PositionRotationMessage decode(ByteBuf buffer) throws IOException { double x = buffer.readDouble(); double y = buffer.readDouble(); double z = buffer.readDouble(); float rotation = buffer.readFloat(); float pitch = buffer.readFloat(); int flags = buffer.readUnsignedByte(); int teleportId = ByteBufUtils.readVarInt(buffer); return new PositionRotationMessage(x, y, z, rotation, pitch, flags, teleportId); }