Java Code Examples for com.nukkitx.protocol.bedrock.packet.PlayerListPacket#Action
The following examples show how to use
com.nukkitx.protocol.bedrock.packet.PlayerListPacket#Action .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerListSerializer_v340.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, PlayerListPacket packet) { PlayerListPacket.Action action = Action.values()[buffer.readUnsignedByte()]; packet.setAction(action); int length = VarInts.readUnsignedInt(buffer); for (int i = 0; i < length; i++) { Entry entry = new Entry(BedrockUtils.readUuid(buffer)); if (action == PlayerListPacket.Action.ADD) { entry.setEntityId(VarInts.readLong(buffer)); entry.setName(BedrockUtils.readString(buffer)); String skinId = BedrockUtils.readString(buffer); ImageData skinData = ImageData.of(BedrockUtils.readByteArray(buffer)); ImageData capeData = ImageData.of(64, 32, BedrockUtils.readByteArray(buffer)); String geometryName = BedrockUtils.readString(buffer); String geometryData = BedrockUtils.readString(buffer); entry.setSkin(SerializedSkin.of(skinId, skinData, capeData, geometryName, geometryData, false)); entry.setXuid(BedrockUtils.readString(buffer)); entry.setPlatformChatId(BedrockUtils.readString(buffer)); } packet.getEntries().add(entry); } }
Example 2
Source File: PlayerListSerializer_v313.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, PlayerListPacket packet) { PlayerListPacket.Action action = PlayerListPacket.Action.values()[buffer.readUnsignedByte()]; packet.setAction(action); int length = VarInts.readUnsignedInt(buffer); for (int i = 0; i < length; i++) { Entry entry = new Entry(BedrockUtils.readUuid(buffer)); if (action == PlayerListPacket.Action.ADD) { entry.setEntityId(VarInts.readLong(buffer)); entry.setName(BedrockUtils.readString(buffer)); String skinId = BedrockUtils.readString(buffer); ImageData skinData = ImageData.of(BedrockUtils.readByteArray(buffer)); ImageData capeData = ImageData.of(64, 32, BedrockUtils.readByteArray(buffer)); String geometryName = BedrockUtils.readString(buffer); String geometryData = BedrockUtils.readString(buffer); entry.setSkin(SerializedSkin.of(skinId, skinData, capeData, geometryName, geometryData, false)); entry.setXuid(BedrockUtils.readString(buffer)); entry.setPlatformChatId(BedrockUtils.readString(buffer)); } packet.getEntries().add(entry); } }
Example 3
Source File: PlayerListSerializer_v291.java From Protocol with Apache License 2.0 | 6 votes |
@Override public void deserialize(ByteBuf buffer, PlayerListPacket packet) { PlayerListPacket.Action action = PlayerListPacket.Action.values()[buffer.readUnsignedByte()]; packet.setAction(action); int length = VarInts.readUnsignedInt(buffer); for (int i = 0; i < length; i++) { Entry entry = new Entry(BedrockUtils.readUuid(buffer)); if (action == Action.ADD) { entry.setEntityId(VarInts.readLong(buffer)); entry.setName(BedrockUtils.readString(buffer)); String skinId = BedrockUtils.readString(buffer); ImageData skinData = ImageData.of(BedrockUtils.readByteArray(buffer)); ImageData capeData = ImageData.of(64, 32, BedrockUtils.readByteArray(buffer)); String geometryName = BedrockUtils.readString(buffer); String geometryData = BedrockUtils.readString(buffer); entry.setSkin(SerializedSkin.of(skinId, skinData, capeData, geometryName, geometryData, false)); entry.setXuid(BedrockUtils.readString(buffer)); entry.setPlatformChatId(BedrockUtils.readString(buffer)); } packet.getEntries().add(entry); } }