Java Code Examples for protocolsupport.protocol.serializer.StringSerializer#readVarIntUTF8String()
The following examples show how to use
protocolsupport.protocol.serializer.StringSerializer#readVarIntUTF8String() .
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: MiddleEntityAttributes.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void readServerData(ByteBuf serverdata) { super.readServerData(serverdata); int attributesCount = serverdata.readInt(); for (int i = 0; i < attributesCount; i++) { Attribute attribute = new Attribute(); attribute.key = StringSerializer.readVarIntUTF8String(serverdata); attribute.value = serverdata.readDouble(); if (attribute.value == 0.0D) { attribute.value = 0.00000001; } attribute.modifiers = new Modifier[VarNumberSerializer.readVarInt(serverdata)]; for (int j = 0; j < attribute.modifiers.length; j++) { Modifier modifier = new Modifier(); modifier.uuid = UUIDSerializer.readUUID2L(serverdata); modifier.amount = serverdata.readDouble(); modifier.operation = serverdata.readByte(); attribute.modifiers[j] = modifier; } attributes.put(attribute.key, attribute); } }
Example 2
Source File: LegacyCustomPayloadData.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
public static void transformAndWriteAutoCommandBlockEdit(PacketDataCodec codec, ByteBuf data) { Position position = PositionSerializer.readLegacyPositionI(data); String command = StringSerializer.readVarIntUTF8String(data, Short.MAX_VALUE); int trackOutput = data.readByte(); MiddleUpdateCommandBlock.Mode mode = null; switch (StringSerializer.readVarIntUTF8String(data, 16)) { case "SEQUENCE": { mode = MiddleUpdateCommandBlock.Mode.SEQUENCE; break; } case "AUTO": { mode = MiddleUpdateCommandBlock.Mode.AUTO; break; } case "REDSTONE": { mode = MiddleUpdateCommandBlock.Mode.REDSTONE; break; } } int conditional = data.readByte(); int auto = data.readByte(); codec.read(MiddleUpdateCommandBlock.create( position, command, mode, BitUtils.createIBitMaskFromBits(auto_command_block_bits, new int[] {trackOutput, conditional, auto}) )); }
Example 3
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 4
Source File: MiddleChangeDimension.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { dimension = StringSerializer.readVarIntUTF8String(serverdata); world = StringSerializer.readVarIntUTF8String(serverdata); hashedSeed = serverdata.readLong(); gamemodeCurrent = GameMode.getById(serverdata.readByte()); gamemodePrevious = GameMode.getById(serverdata.readByte()); worldDebug = serverdata.readBoolean(); worldFlat = serverdata.readBoolean(); keepEntityMetadata = serverdata.readBoolean(); }
Example 5
Source File: MiddleAdvancementsTab.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { if (serverdata.readBoolean()) { identifier = StringSerializer.readVarIntUTF8String(serverdata); } else { identifier = null; } }
Example 6
Source File: UpdateCommandBlock.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { PositionSerializer.readLegacyPositionLTo(clientdata, position); command = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); mode = MiscSerializer.readVarIntEnum(clientdata, Mode.CONSTANT_LOOKUP); flags = clientdata.readUnsignedByte(); }
Example 7
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 8
Source File: MiddleAdvancements.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
protected static AdvancementDisplay read(ByteBuf from) { BaseComponent title = ChatAPI.fromJSON(StringSerializer.readVarIntUTF8String(from), true); BaseComponent description = ChatAPI.fromJSON(StringSerializer.readVarIntUTF8String(from), true); NetworkItemStack icon = ItemStackSerializer.readItemStack(from); FrameType type = MiscSerializer.readVarIntEnum(from, FrameType.CONSTANT_LOOKUP); int flags = from.readInt(); String background = (flags & flagHasBackgroundOffset) != 0 ? StringSerializer.readVarIntUTF8String(from) : null; float x = from.readFloat(); float y = from.readFloat(); return new AdvancementDisplay(title, description, icon, type, flags, background, x, y); }
Example 9
Source File: MiddleAdvancements.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
protected static Advancement read(ByteBuf from) { String parentId = from.readBoolean() ? StringSerializer.readVarIntUTF8String(from) : null; AdvancementDisplay display = from.readBoolean() ? AdvancementDisplay.read(from) : null; String[] criterias = ArraySerializer.readVarIntVarIntUTF8StringArray(from); String[][] requirments = ArraySerializer.readVarIntTArray(from, String[].class, ArraySerializer::readVarIntVarIntUTF8StringArray); return new Advancement(parentId, display, criterias, requirments); }
Example 10
Source File: MiddleWorldCustomSound.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { id = StringSerializer.readVarIntUTF8String(serverdata); category = MiscSerializer.readVarIntEnum(serverdata, SoundCategory.CONSTANT_LOOKUP); x = serverdata.readInt(); y = serverdata.readInt(); z = serverdata.readInt(); volume = serverdata.readFloat(); pitch = serverdata.readFloat(); }
Example 11
Source File: UpdateSign.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { PositionSerializer.readPositionTo(clientdata, position); for (int i = 0; i < lines.length; i++) { String rawline = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); lines[i] = version.isAfter(ProtocolVersion.MINECRAFT_1_8) ? rawline : ChatAPI.fromJSON(rawline).toLegacyText(cache.getClientCache().getLocale()); } }
Example 12
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); } }
Example 13
Source File: NameItem.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { name = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); }
Example 14
Source File: MiddleLoginCustomPayload.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readServerData(ByteBuf serverdata) { id = VarNumberSerializer.readVarInt(serverdata); tag = StringSerializer.readVarIntUTF8String(serverdata); data = MiscSerializer.readAllBytesSlice(serverdata); }
Example 15
Source File: MiddleLoginSuccess.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readServerData(ByteBuf serverdata) { uuid = UUIDSerializer.readUUID4I(serverdata); name = StringSerializer.readVarIntUTF8String(serverdata); }
Example 16
Source File: CustomPayload.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { tag = StringSerializer.readVarIntUTF8String(clientdata, 20); data = ArraySerializer.readShortByteArraySlice(clientdata, Short.MAX_VALUE); }
Example 17
Source File: NetworkEntityMetadataObjectString.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override public void readFromStream(ByteBuf from) { value = StringSerializer.readVarIntUTF8String(from); }
Example 18
Source File: MiddleCustomPayload.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readServerData(ByteBuf serverdata) { tag = StringSerializer.readVarIntUTF8String(serverdata); data = serverdata.readSlice(serverdata.readableBytes()); }
Example 19
Source File: ResourcePackStatus.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { StringSerializer.readVarIntUTF8String(clientdata, 40); result = VarNumberSerializer.readVarInt(clientdata); }
Example 20
Source File: TabComplete.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { id = VarNumberSerializer.readVarInt(clientdata); string = StringSerializer.readVarIntUTF8String(clientdata, Short.MAX_VALUE); }