protocolsupport.protocol.serializer.MiscSerializer Java Examples
The following examples show how to use
protocolsupport.protocol.serializer.MiscSerializer.
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: UseEntity.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void readClientData(ByteBuf clientdata) { entityId = VarNumberSerializer.readVarInt(clientdata); action = MiscSerializer.readVarIntEnum(clientdata, Action.CONSTANT_LOOKUP); switch (action) { case INTERACT: { hand = MiscSerializer.readVarIntEnum(clientdata, UsedHand.CONSTANT_LOOKUP); break; } case INTERACT_AT: { interactedAt = new Vector(clientdata.readFloat(), clientdata.readFloat(), clientdata.readFloat()); hand = MiscSerializer.readVarIntEnum(clientdata, UsedHand.CONSTANT_LOOKUP); break; } case ATTACK: { break; } } sneaking = clientdata.readBoolean(); }
Example #2
Source File: RecipeBookData.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void readClientData(ByteBuf clientdata) { type = MiscSerializer.readVarIntEnum(clientdata, Type.CONSTANT_LOOKUP); switch (type) { case DISPLAYED_RECIPE: { recipeId = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); break; } case RECIPE_BOOK_STATUS: { craftRecipeBookOpen = clientdata.readBoolean(); craftRecipeBookFiltering = clientdata.readBoolean(); smeltingRecipeBookOpen = clientdata.readBoolean(); smeltingRecipeBookFiltering = clientdata.readBoolean(); break; } } }
Example #3
Source File: ResourcePackListener.java From ProtocolSupportPocketStuff with GNU Affero General Public License v3.0 | 6 votes |
@Override public void onRawPacketSending(RawPacketEvent event) { super.onRawPacketSending(event); ByteBuf serverdata = event.getData(); int packetId = PacketSerializer.readPacketId(serverdata); if (packetId == PEPacketIDs.RESOURCE_PACK) { plugin.debug("Replacing resource pack data with real information..."); ResourcePackInfoPacket infoPacket = new ResourcePackInfoPacket(PocketStuffAPI.getResourcePackManager().resourcePacksRequired(), PocketStuffAPI.getResourcePackManager().getBehaviorPacks(), PocketStuffAPI.getResourcePackManager().getResourcePacks()); event.setData(infoPacket.encode(connection)); queuePackets = true; } else if (packetId == PEPacketIDs.RESOURCE_STACK) { if (!connection.hasMetadata(packFinished)) { plugin.debug("Cancelling stack data..."); event.setCancelled(true); } else { plugin.debug("I'm done with resources! Sending queued packets and removing myself..."); queue.forEach(packet -> connection.sendRawPacket(MiscSerializer.readAllBytes(packet))); connection.removePacketListener(this); } } else if (queuePackets) { plugin.debug("Caching packet to resend after resource handling."); queue.add(serverdata.copy()); event.setCancelled(true); } }
Example #4
Source File: MiddleTitle.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void readServerData(ByteBuf serverdata) { action = MiscSerializer.readVarIntEnum(serverdata, Action.CONSTANT_LOOKUP); switch (action) { case SET_TITLE: case SET_SUBTITLE: case SET_ACTION_BAR: { message = ChatAPI.fromJSON(StringSerializer.readVarIntUTF8String(serverdata), true); break; } case SET_TIMES: { fadeIn = serverdata.readInt(); stay = serverdata.readInt(); fadeOut = serverdata.readInt(); break; } case HIDE: case RESET: { break; } } }
Example #5
Source File: UseEntity.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void readClientData(ByteBuf clientdata) { entityId = VarNumberSerializer.readVarInt(clientdata); action = MiscSerializer.readVarIntEnum(clientdata, Action.CONSTANT_LOOKUP); switch (action) { case INTERACT: { hand = MiscSerializer.readVarIntEnum(clientdata, UsedHand.CONSTANT_LOOKUP); break; } case INTERACT_AT: { interactedAt = new Vector(clientdata.readFloat(), clientdata.readFloat(), clientdata.readFloat()); hand = MiscSerializer.readVarIntEnum(clientdata, UsedHand.CONSTANT_LOOKUP); break; } case ATTACK: { break; } } }
Example #6
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); scoreboardteam.writeByte(format.isColor() ? format.ordinal() : -1); } if ((mode == Mode.CREATE) || (mode == Mode.PLAYERS_ADD) || (mode == Mode.PLAYERS_REMOVE)) { ArraySerializer.writeVarIntTArray(scoreboardteam, players, (to, element) -> StringSerializer.writeVarIntUTF8String(to, Utils.clampString(element, 16))); } codec.write(scoreboardteam); }
Example #7
Source File: CombatEvent.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void writeToClient() { ClientBoundPacketData combatevent = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_COMBAT_EVENT); MiscSerializer.writeVarIntEnum(combatevent, type); switch (type) { case ENTER_COMBAT: { break; } case END_COMBAT: { VarNumberSerializer.writeVarInt(combatevent, duration); combatevent.writeInt(entityId); break; } case ENTITY_DEAD: { VarNumberSerializer.writeVarInt(combatevent, playerId); combatevent.writeInt(entityId); StringSerializer.writeVarIntUTF8String(combatevent, message); break; } } }
Example #8
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.writeString(scoreboardteam, version, name); MiscSerializer.writeByteEnum(scoreboardteam, mode); if ((mode == Mode.CREATE) || (mode == Mode.UPDATE)) { StringSerializer.writeString(scoreboardteam, version, LegacyChat.clampLegacyText(displayName.toLegacyText(clientCache.getLocale()), 32)); Any<String, String> nfix = formatPrefixSuffix(); StringSerializer.writeString(scoreboardteam, version, nfix.getObj1()); StringSerializer.writeString(scoreboardteam, version, nfix.getObj2()); scoreboardteam.writeByte(friendlyFire); } if ((mode == Mode.CREATE) || (mode == Mode.PLAYERS_ADD) || (mode == Mode.PLAYERS_REMOVE)) { ArraySerializer.writeShortTArray(scoreboardteam, players, (to, element) -> StringSerializer.writeString(to, version, Utils.clampString(element, 16))); } codec.write(scoreboardteam); }
Example #9
Source File: MiddleRecipeBookData.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void writeToServer() { ServerBoundPacketData recipebookdata = ServerBoundPacketData.create(PacketType.SERVERBOUND_PLAY_RECIPE_BOOK_DATA); MiscSerializer.writeVarIntEnum(recipebookdata, type); switch (type) { case DISPLAYED_RECIPE: { StringSerializer.writeVarIntUTF8String(recipebookdata, recipeId); break; } case RECIPE_BOOK_STATUS: { recipebookdata.writeBoolean(craftRecipeBookOpen); recipebookdata.writeBoolean(craftRecipeBookFiltering); recipebookdata.writeBoolean(smeltingRecipeBookOpen); recipebookdata.writeBoolean(smeltingRecipeBookFiltering); recipebookdata.writeBoolean(blastingRecipeBookOpen); recipebookdata.writeBoolean(blastingRecipeBookFiltering); recipebookdata.writeBoolean(smokingRecipeBookOpen); recipebookdata.writeBoolean(smokingRecipeBookFiltering); break; } } codec.read(recipebookdata); }
Example #10
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)); if (version.isBefore(ProtocolVersion.MINECRAFT_1_9_1)) { startgame.writeByte(LegacyDimension.getId(dimension)); } else { startgame.writeInt(LegacyDimension.getId(dimension)); } MiscSerializer.writeByteEnum(startgame, Difficulty.HARD); startgame.writeByte(maxplayers); StringSerializer.writeVarIntUTF8String(startgame, "default"); startgame.writeBoolean(reducedDebugInfo); codec.write(startgame); }
Example #11
Source File: RecipeBookData.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void readClientData(ByteBuf clientdata) { type = MiscSerializer.readVarIntEnum(clientdata, Type.CONSTANT_LOOKUP); switch (type) { case DISPLAYED_RECIPE: { recipeId = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); break; } case RECIPE_BOOK_STATUS: { craftRecipeBookOpen = clientdata.readBoolean(); craftRecipeBookFiltering = clientdata.readBoolean(); smeltingRecipeBookOpen = clientdata.readBoolean(); smeltingRecipeBookFiltering = clientdata.readBoolean(); blastingRecipeBookOpen = clientdata.readBoolean(); blastingRecipeBookFiltering = clientdata.readBoolean(); smokingRecipeBookOpen = clientdata.readBoolean(); smokingRecipeBookFiltering = clientdata.readBoolean(); break; } } }
Example #12
Source File: UpdateStructureBlock.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void readClientData(ByteBuf clientdata) { PositionSerializer.readLegacyPositionLTo(clientdata, position); action = MiscSerializer.readVarIntEnum(clientdata, Action.CONSTANT_LOOKUP); mode = MiscSerializer.readVarIntEnum(clientdata, Mode.CONSTANT_LOOKUP); name = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); offsetX = clientdata.readByte(); offsetY = clientdata.readByte(); offsetZ = clientdata.readByte(); sizeX = clientdata.readByte(); sizeY = clientdata.readByte(); sizeZ = clientdata.readByte(); mirror = MiscSerializer.readVarIntEnum(clientdata, Mirror.CONSTANT_LOOKUP); rotation = MiscSerializer.readVarIntEnum(clientdata, Rotation.CONSTANT_LOOKUP); metadata = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); integrity = clientdata.readFloat(); seed = VarNumberSerializer.readVarLong(clientdata); flags = clientdata.readByte(); }
Example #13
Source File: StartGame.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData startgame = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_START_GAME); startgame.writeInt(player.getId()); StringSerializer.writeShortUTF16BEString(startgame, "default"); startgame.writeByte(gamemodeCurrent.getId() | (hardcore ? 0x8 : 0)); startgame.writeByte(LegacyDimension.getId(dimension)); MiscSerializer.writeByteEnum(startgame, Difficulty.HARD); startgame.writeByte(0); startgame.writeByte(maxplayers); codec.write(startgame); }
Example #14
Source File: ScoreboardObjective.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData scoreboardobjective = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_SCOREBOARD_OBJECTIVE); StringSerializer.writeString(scoreboardobjective, version, name); StringSerializer.writeString( scoreboardobjective, version, mode == Mode.REMOVE ? "" : LegacyChat.clampLegacyText(value.toLegacyText(cache.getClientCache().getLocale()), 32) ); MiscSerializer.writeByteEnum(scoreboardobjective, mode); codec.write(scoreboardobjective); }
Example #15
Source File: ScoreboardObjective.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData scoreboardobjective = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_SCOREBOARD_OBJECTIVE); StringSerializer.writeVarIntUTF8String(scoreboardobjective, name); MiscSerializer.writeByteEnum(scoreboardobjective, mode); if (mode != Mode.REMOVE) { StringSerializer.writeVarIntUTF8String(scoreboardobjective, LegacyChat.clampLegacyText(value.toLegacyText(cache.getClientCache().getLocale()), 32)); StringSerializer.writeVarIntUTF8String(scoreboardobjective, getTypeString(type)); } codec.write(scoreboardobjective); }
Example #16
Source File: GameStateChange.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData gamestatechange = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_GAME_STATE_CHANGE); MiscSerializer.writeByteEnum(gamestatechange, action); gamestatechange.writeByte((int) value); codec.write(gamestatechange); }
Example #17
Source File: BossBar.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData bossbar = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_BOSS_BAR); UUIDSerializer.writeUUID2L(bossbar, uuid); MiscSerializer.writeVarIntEnum(bossbar, action); switch (action) { case ADD: { StringSerializer.writeVarIntUTF8String(bossbar, ChatAPI.toJSON(LegacyChatJson.convert(version, cache.getClientCache().getLocale(), title))); bossbar.writeFloat(percent); VarNumberSerializer.writeVarInt(bossbar, color); VarNumberSerializer.writeVarInt(bossbar, divider); bossbar.writeByte(flags); break; } case REMOVE: { break; } case UPDATE_PERCENT: { bossbar.writeFloat(percent); break; } case UPDATE_TITLE: { StringSerializer.writeVarIntUTF8String(bossbar, ChatAPI.toJSON(LegacyChatJson.convert(version, cache.getClientCache().getLocale(), title))); break; } case UPDATE_STYLE: { VarNumberSerializer.writeVarInt(bossbar, color); VarNumberSerializer.writeVarInt(bossbar, divider); break; } case UPDATE_FLAGS: { bossbar.writeByte(flags); break; } } codec.write(bossbar); }
Example #18
Source File: WorldCustomSound.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
public static ClientBoundPacketData create( ProtocolVersion version, int x, int y, int z, String sound, SoundCategory category, float volume, float pitch ) { ClientBoundPacketData worldcustomsound = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_WORLD_CUSTOM_SOUND); StringSerializer.writeVarIntUTF8String(worldcustomsound, SoundRemapper.getSoundName(version, sound)); MiscSerializer.writeVarIntEnum(worldcustomsound, category); worldcustomsound.writeInt(x); worldcustomsound.writeInt(y); worldcustomsound.writeInt(z); worldcustomsound.writeFloat(volume); worldcustomsound.writeFloat(pitch); return worldcustomsound; }
Example #19
Source File: MiddleScoreboardObjective.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { name = StringSerializer.readVarIntUTF8String(serverdata); mode = MiscSerializer.readByteEnum(serverdata, Mode.CONSTANT_LOOKUP); if (mode != Mode.REMOVE) { value = ChatAPI.fromJSON(StringSerializer.readVarIntUTF8String(serverdata), true); type = MiscSerializer.readVarIntEnum(serverdata, Type.CONSTANT_LOOKUP); } switch (mode) { case CREATE: { if (!objectives.add(name)) { throw CancelMiddlePacketException.INSTANCE; } break; } case REMOVE: { if (!objectives.remove(name)) { throw CancelMiddlePacketException.INSTANCE; } break; } default: { if (!objectives.contains(name)) { throw CancelMiddlePacketException.INSTANCE; } break; } } }
Example #20
Source File: ServerDifficulty.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData serverdifficulty = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_SERVER_DIFFICULTY); MiscSerializer.writeByteEnum(serverdifficulty, difficulty); serverdifficulty.writeBoolean(locked); codec.write(serverdifficulty); }
Example #21
Source File: StartGame.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 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(LegacyDimension.getId(dimension)); MiscSerializer.writeByteEnum(startgame, Difficulty.HARD); startgame.writeByte(Math.min(maxplayers, 60)); StringSerializer.writeVarIntUTF8String(startgame, "default"); codec.write(startgame); }
Example #22
Source File: ChangeDimension.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData changedimension = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_RESPAWN); changedimension.writeInt(LegacyDimension.getId(dimension)); MiscSerializer.writeByteEnum(changedimension, Difficulty.HARD); changedimension.writeByte(gamemodeCurrent.getId()); changedimension.writeShort(256); StringSerializer.writeShortUTF16BEString(changedimension, "default"); codec.write(changedimension); }
Example #23
Source File: WorldCustomSound.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
public static ClientBoundPacketData create( ProtocolVersion version, int x, int y, int z, String sound, SoundCategory category, float volume, float pitch ) { ClientBoundPacketData worldcustomsound = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_WORLD_CUSTOM_SOUND); StringSerializer.writeVarIntUTF8String(worldcustomsound, SoundRemapper.getSoundName(version, sound)); MiscSerializer.writeVarIntEnum(worldcustomsound, category); worldcustomsound.writeInt(x); worldcustomsound.writeInt(y); worldcustomsound.writeInt(z); worldcustomsound.writeFloat(volume); worldcustomsound.writeByte((int) (pitch * 63.5)); return worldcustomsound; }
Example #24
Source File: MiddleWorldBorder.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { action = MiscSerializer.readVarIntEnum(serverdata, Action.CONSTANT_LOOKUP); switch (action) { case SET_SIZE: { radius = serverdata.readDouble(); break; } case LERP_SIZE: { oldRadius = serverdata.readDouble(); newRadius = serverdata.readDouble(); speed = VarNumberSerializer.readVarLong(serverdata); break; } case SET_CENTER: { x = serverdata.readDouble(); z = serverdata.readDouble(); break; } case INIT: { x = serverdata.readDouble(); z = serverdata.readDouble(); oldRadius = serverdata.readDouble(); newRadius = serverdata.readDouble(); speed = VarNumberSerializer.readVarLong(serverdata); teleportBound = VarNumberSerializer.readVarInt(serverdata); warnTime = VarNumberSerializer.readVarInt(serverdata); warnBlocks = VarNumberSerializer.readVarInt(serverdata); break; } case SET_WARN_TIME: { warnTime = VarNumberSerializer.readVarInt(serverdata); break; } case SET_WARN_BLOCKS: { warnBlocks = VarNumberSerializer.readVarInt(serverdata); break; } } }
Example #25
Source File: MiddleBossBar.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { uuid = UUIDSerializer.readUUID2L(serverdata); action = MiscSerializer.readVarIntEnum(serverdata, Action.CONSTANT_LOOKUP); switch (action) { case ADD: { title = ChatAPI.fromJSON(StringSerializer.readVarIntUTF8String(serverdata), true); percent = serverdata.readFloat(); color = VarNumberSerializer.readVarInt(serverdata); divider = VarNumberSerializer.readVarInt(serverdata); flags = serverdata.readUnsignedByte(); break; } case REMOVE: { break; } case UPDATE_PERCENT: { percent = serverdata.readFloat(); break; } case UPDATE_TITLE: { title = ChatAPI.fromJSON(StringSerializer.readVarIntUTF8String(serverdata), true); break; } case UPDATE_STYLE: { color = VarNumberSerializer.readVarInt(serverdata); divider = VarNumberSerializer.readVarInt(serverdata); break; } case UPDATE_FLAGS: { flags = serverdata.readUnsignedByte(); break; } } }
Example #26
Source File: BlockPlace.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { hand = MiscSerializer.readVarIntEnum(clientdata, UsedHand.CONSTANT_LOOKUP); PositionSerializer.readPositionTo(clientdata, position); face = VarNumberSerializer.readVarInt(clientdata); cX = clientdata.readFloat(); cY = clientdata.readFloat(); cZ = clientdata.readFloat(); insideblock = clientdata.readBoolean(); }
Example #27
Source File: UpdateCommandBlock.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { PositionSerializer.readPositionTo(clientdata, position); command = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); mode = MiscSerializer.readVarIntEnum(clientdata, Mode.CONSTANT_LOOKUP); flags = clientdata.readUnsignedByte(); }
Example #28
Source File: ClientSettings.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { locale = StringSerializer.readVarIntUTF8String(clientdata, 16); viewDist = clientdata.readByte(); chatMode = MiscSerializer.readByteEnum(clientdata, ChatMode.CONSTANT_LOOKUP); chatColors = clientdata.readBoolean(); clientdata.readByte(); clientdata.readBoolean(); skinFlags = 255; mainHand = MainHand.RIGHT; }
Example #29
Source File: ChangeDimension.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void writeToClient() { ClientBoundPacketData changedimension = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_RESPAWN); changedimension.writeInt(LegacyDimension.getId(dimension)); MiscSerializer.writeByteEnum(changedimension, Difficulty.HARD); changedimension.writeByte(gamemodeCurrent.getId()); StringSerializer.writeVarIntUTF8String(changedimension, "default"); codec.write(changedimension); }
Example #30
Source File: AdvancementTab.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { action = MiscSerializer.readVarIntEnum(clientdata, Action.CONSTANT_LOOKUP); if (action == Action.OPEN) { identifier = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); } }