Search in sources :

Example 1 with BlockPickRequestPacket

use of org.dragonet.protocol.packets.BlockPickRequestPacket in project DragonProxy by DragonetMC.

the class PEBlockPickRequestPacketTranslator method translate.

@Override
public Packet[] translate(UpstreamSession session, BlockPickRequestPacket packet) {
    ItemStack item = session.getChunkCache().getBlock(new Position(packet.x, packet.y, packet.z));
    int selectedSlot = (int) session.getDataCache().getOrDefault(CacheKey.PLAYER_SELECTED_SLOT, 36);
    ClientCreativeInventoryActionPacket backPacket = new ClientCreativeInventoryActionPacket(selectedSlot + 36, item);
    // System.out.println("BlockPickRequestPacket " + DebugTools.getAllFields(packet));
    // System.out.println("ItemStack " + DebugTools.getAllFields(item));
    session.getChunkCache().getDebugGrid();
    return new Packet[] { backPacket };
}
Also used : Packet(com.github.steveice10.packetlib.packet.Packet) PlayerSkinPacket(org.dragonet.protocol.packets.PlayerSkinPacket) ClientCreativeInventoryActionPacket(com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket) BlockPickRequestPacket(org.dragonet.protocol.packets.BlockPickRequestPacket) Position(com.github.steveice10.mc.protocol.data.game.entity.metadata.Position) ClientCreativeInventoryActionPacket(com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket) ItemStack(com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack)

Aggregations

ItemStack (com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack)1 Position (com.github.steveice10.mc.protocol.data.game.entity.metadata.Position)1 ClientCreativeInventoryActionPacket (com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket)1 Packet (com.github.steveice10.packetlib.packet.Packet)1 BlockPickRequestPacket (org.dragonet.protocol.packets.BlockPickRequestPacket)1 PlayerSkinPacket (org.dragonet.protocol.packets.PlayerSkinPacket)1