Java Code Examples for protocolsupport.protocol.serializer.MiscSerializer#readVarIntEnum()
The following examples show how to use
protocolsupport.protocol.serializer.MiscSerializer#readVarIntEnum() .
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; } } }
Example 2
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 3
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 4
Source File: UpdateStructureBlock.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void readClientData(ByteBuf clientdata) { PositionSerializer.readPositionTo(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 5
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 6
Source File: MiddleCombatEvent.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void readServerData(ByteBuf serverdata) { type = MiscSerializer.readVarIntEnum(serverdata, Type.CONSTANT_LOOKUP); switch (type) { case ENTER_COMBAT: { break; } case END_COMBAT: { duration = VarNumberSerializer.readVarInt(serverdata); entityId = serverdata.readInt(); break; } case ENTITY_DEAD: { playerId = VarNumberSerializer.readVarInt(serverdata); entityId = serverdata.readInt(); message = StringSerializer.readVarIntUTF8String(serverdata); break; } } }
Example 7
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 8
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 9
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 10
Source File: RecipeBookData.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { MiddleRecipeBookData.Type type = MiscSerializer.readVarIntEnum(clientdata, MiddleRecipeBookData.Type.CONSTANT_LOOKUP); switch (type) { case DISPLAYED_RECIPE: { clientdata.readInt(); break; } case RECIPE_BOOK_STATUS: { clientdata.readBoolean(); clientdata.readBoolean(); break; } } }
Example 11
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 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: BlockPlace.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { PositionSerializer.readLegacyPositionLTo(clientdata, position); face = VarNumberSerializer.readVarInt(clientdata); hand = MiscSerializer.readVarIntEnum(clientdata, UsedHand.CONSTANT_LOOKUP); cX = clientdata.readUnsignedByte() / 16.0F; cY = clientdata.readUnsignedByte() / 16.0F; cZ = clientdata.readUnsignedByte() / 16.0F; }
Example 14
Source File: BlockDig.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { status = MiscSerializer.readVarIntEnum(clientdata, Action.CONSTANT_LOOKUP); PositionSerializer.readLegacyPositionLTo(clientdata, position); face = clientdata.readUnsignedByte(); }
Example 15
Source File: MiddleBookOpen.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readServerData(ByteBuf serverdata) { hand = MiscSerializer.readVarIntEnum(serverdata, UsedHand.CONSTANT_LOOKUP); }
Example 16
Source File: NetworkEntityMetadataObjectEntityPose.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override public void readFromStream(ByteBuf from) { value = MiscSerializer.readVarIntEnum(from, EntityPose.CONSTANT_LOOKUP); }
Example 17
Source File: EditBook.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { book = ItemStackSerializer.readItemStack(clientdata, version); signing = clientdata.readBoolean(); hand = MiscSerializer.readVarIntEnum(clientdata, UsedHand.CONSTANT_LOOKUP); }
Example 18
Source File: UseItem.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { hand = MiscSerializer.readVarIntEnum(clientdata, UsedHand.CONSTANT_LOOKUP); face = -1; }
Example 19
Source File: Animation.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { hand = MiscSerializer.readVarIntEnum(clientdata, UsedHand.CONSTANT_LOOKUP); }
Example 20
Source File: NetworkEntityMetadataObjectDirection.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override public void readFromStream(ByteBuf from) { value = MiscSerializer.readVarIntEnum(from, BlockDirection.CONSTANT_LOOKUP); }