Java Code Examples for protocolsupport.protocol.serializer.ArraySerializer#writeVarIntVarIntUTF8StringArray()
The following examples show how to use
protocolsupport.protocol.serializer.ArraySerializer#writeVarIntVarIntUTF8StringArray() .
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: Advancements.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
protected static void writeAdvanvement(ByteBuf to, ProtocolVersion version, String locale, Advancement advancement) { if (advancement.parentId != null) { to.writeBoolean(true); StringSerializer.writeVarIntUTF8String(to, advancement.parentId); } else { to.writeBoolean(false); } if (advancement.display != null) { to.writeBoolean(true); writeAdvancementDisplay(to, version, locale, advancement.display); } else { to.writeBoolean(false); } ArraySerializer.writeVarIntVarIntUTF8StringArray(to, advancement.criteria); ArraySerializer.writeVarIntTArray(to, advancement.requirements, ArraySerializer::writeVarIntVarIntUTF8StringArray); }
Example 2
Source File: StartGame.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void writeToClient() { ClientBoundPacketData startgame = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_START_GAME); startgame.writeInt(player.getId()); startgame.writeByte(gamemodeCurrent.getId() | (hardcore ? 0x8 : 0)); startgame.writeByte(gamemodePrevious.getId()); ArraySerializer.writeVarIntVarIntUTF8StringArray(startgame, worlds); ItemStackSerializer.writeDirectTag(startgame, dimensions); StringSerializer.writeVarIntUTF8String(startgame, dimension); StringSerializer.writeVarIntUTF8String(startgame, world); startgame.writeLong(hashedSeed); startgame.writeByte(maxplayers); VarNumberSerializer.writeVarInt(startgame, renderDistance); startgame.writeBoolean(reducedDebugInfo); startgame.writeBoolean(respawnScreenEnabled); startgame.writeBoolean(worldDebug); startgame.writeBoolean(worldFlat); codec.write(startgame); }
Example 3
Source File: ScoreboardTeam.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void writeToClient() { ClientBoundPacketData scoreboardteam = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_SCOREBOARD_TEAM); StringSerializer.writeVarIntUTF8String(scoreboardteam, name); MiscSerializer.writeByteEnum(scoreboardteam, mode); if ((mode == Mode.CREATE) || (mode == Mode.UPDATE)) { StringSerializer.writeVarIntUTF8String(scoreboardteam, LegacyChat.clampLegacyText(displayName.toLegacyText(clientCache.getLocale()), 32)); Any<String, String> nfix = formatPrefixSuffix(); StringSerializer.writeVarIntUTF8String(scoreboardteam, nfix.getObj1()); StringSerializer.writeVarIntUTF8String(scoreboardteam, nfix.getObj2()); scoreboardteam.writeByte(friendlyFire); StringSerializer.writeVarIntUTF8String(scoreboardteam, nameTagVisibility); StringSerializer.writeVarIntUTF8String(scoreboardteam, collisionRule); scoreboardteam.writeByte(format.isColor() ? format.ordinal() : -1); } if ((mode == Mode.CREATE) || (mode == Mode.PLAYERS_ADD) || (mode == Mode.PLAYERS_REMOVE)) { ArraySerializer.writeVarIntVarIntUTF8StringArray(scoreboardteam, players); } codec.write(scoreboardteam); }
Example 4
Source File: ScoreboardTeam.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void writeToClient() { String locale = clientCache.getLocale(); ClientBoundPacketData scoreboardteam = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_SCOREBOARD_TEAM); StringSerializer.writeVarIntUTF8String(scoreboardteam, name); MiscSerializer.writeByteEnum(scoreboardteam, mode); if ((mode == Mode.CREATE) || (mode == Mode.UPDATE)) { StringSerializer.writeVarIntUTF8String(scoreboardteam, ChatAPI.toJSON(LegacyChatJson.convert(version, locale, displayName))); scoreboardteam.writeByte(friendlyFire); StringSerializer.writeVarIntUTF8String(scoreboardteam, nameTagVisibility); StringSerializer.writeVarIntUTF8String(scoreboardteam, collisionRule); MiscSerializer.writeVarIntEnum(scoreboardteam, format); StringSerializer.writeVarIntUTF8String(scoreboardteam, ChatAPI.toJSON(LegacyChatJson.convert(version, locale, prefix))); StringSerializer.writeVarIntUTF8String(scoreboardteam, ChatAPI.toJSON(LegacyChatJson.convert(version, locale, suffix))); } if ((mode == Mode.CREATE) || (mode == Mode.PLAYERS_ADD) || (mode == Mode.PLAYERS_REMOVE)) { ArraySerializer.writeVarIntVarIntUTF8StringArray(scoreboardteam, players); } codec.write(scoreboardteam); }
Example 5
Source File: Advancements.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData advancements = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_ADVANCEMENTS); advancements.writeBoolean(reset); ArraySerializer.writeVarIntTArray(advancements, advancementsMapping, (to, element) -> { StringSerializer.writeVarIntUTF8String(to, element.getObj1()); writeAdvanvement(to, version, cache.getClientCache().getLocale(), element.getObj2()); }); ArraySerializer.writeVarIntVarIntUTF8StringArray(advancements, removeAdvancements); ArraySerializer.writeVarIntTArray(advancements, advancementsProgress, (to, element) -> { StringSerializer.writeVarIntUTF8String(to, element.getObj1()); wrtieAdvancementProgress(to, element.getObj2()); }); codec.write(advancements); }
Example 6
Source File: UnlockRecipes.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData unlockrecipes = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_UNLOCK_RECIPES); MiscSerializer.writeVarIntEnum(unlockrecipes, action); unlockrecipes.writeBoolean(craftRecipeBookOpen); unlockrecipes.writeBoolean(craftRecipeBookFiltering); unlockrecipes.writeBoolean(smeltingRecipeBookOpen); unlockrecipes.writeBoolean(smeltingRecipeBookFiltering); ArraySerializer.writeVarIntVarIntUTF8StringArray(unlockrecipes, recipes1); if (action == Action.INIT) { ArraySerializer.writeVarIntVarIntUTF8StringArray(unlockrecipes, recipes2); } codec.write(unlockrecipes); }