Java Code Examples for io.netty.buffer.ByteBuf#readFloat()
The following examples show how to use
io.netty.buffer.ByteBuf#readFloat() .
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: LegacyCustomPayloadData.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
public static void transformAndWriteStructureBlock(PacketDataCodec codec, ByteBuf data) { Position position = PositionSerializer.readLegacyPositionI(data); MiddleUpdateStructureBlock.Action action = MiddleUpdateStructureBlock.Action.CONSTANT_LOOKUP.getByOrdinal(data.readByte() - 1); MiddleUpdateStructureBlock.Mode mode = MiddleUpdateStructureBlock.Mode.valueOf(StringSerializer.readVarIntUTF8String(data, Short.MAX_VALUE)); String name = StringSerializer.readVarIntUTF8String(data, Short.MAX_VALUE); byte offsetX = (byte) data.readInt(); byte offsetY = (byte) data.readInt(); byte offsetZ = (byte) data.readInt(); byte sizeX = (byte) data.readInt(); byte sizeY = (byte) data.readInt(); byte sizeZ = (byte) data.readInt(); MiddleUpdateStructureBlock.Mirror mirror = MiddleUpdateStructureBlock.Mirror.valueOf(StringSerializer.readVarIntUTF8String(data, Short.MAX_VALUE)); MiddleUpdateStructureBlock.Rotation rotation = MiddleUpdateStructureBlock.Rotation.valueOf(StringSerializer.readVarIntUTF8String(data, Short.MAX_VALUE)); String metadata = StringSerializer.readVarIntUTF8String(data, Short.MAX_VALUE); int ignoreEntities = data.readBoolean() ? 0x01 : 0; int showAir = data.readBoolean() ? 0x02 : 0; int showBoundingBox = data.readBoolean() ? 0x04 : 0; float integrity = data.readFloat(); long seed = VarNumberSerializer.readVarLong(data); byte flags = (byte) (ignoreEntities | showAir | showBoundingBox); codec.read(MiddleUpdateStructureBlock.create( position, action, mode, name, offsetX, offsetY, offsetZ, sizeX, sizeY, sizeZ, mirror, rotation, metadata, integrity, seed, flags )); }
Example 2
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 3
Source File: MessageAddEffects.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void fromBytes(ByteBuf buf) { this.effectType = buf.readByte(); this.flags = buf.readByte(); this.x = buf.readFloat(); this.y = buf.readFloat(); this.z = buf.readFloat(); if (this.effectType == EFFECT_SOUND_EVENT) { this.soundEventId = buf.readShort(); this.pitch = buf.readFloat(); this.volume = buf.readFloat(); this.repeat = buf.readBoolean(); } else { this.particleCount = buf.readShort(); this.offset = buf.readFloat(); this.velocity = buf.readFloat(); } }
Example 4
Source File: PacketTCNodeBolt.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void fromBytes(ByteBuf buf) { this.x = buf.readFloat(); this.y = buf.readFloat(); this.z = buf.readFloat(); this.targetX = buf.readFloat(); this.targetY = buf.readFloat(); this.targetZ = buf.readFloat(); this.type = buf.readInt(); this.mightGetLong = buf.readBoolean(); }
Example 5
Source File: UseEntity.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { entityId = VarNumberSerializer.readVarInt(clientdata); action = MiscSerializer.readVarIntEnum(clientdata, Action.CONSTANT_LOOKUP); if (action == Action.INTERACT_AT) { interactedAt = new Vector(clientdata.readFloat(), clientdata.readFloat(), clientdata.readFloat()); } }
Example 6
Source File: MiddleWorldSound.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { id = VarNumberSerializer.readVarInt(serverdata); category = MiscSerializer.readVarIntEnum(serverdata, SoundCategory.CONSTANT_LOOKUP); x = serverdata.readInt(); y = serverdata.readInt(); z = serverdata.readInt(); volume = serverdata.readFloat(); pitch = serverdata.readFloat(); }
Example 7
Source File: InPlayerAbilitiesCodec.java From Cleanstone with MIT License | 5 votes |
@Override public InPlayerAbilitiesPacket decode(ByteBuf byteBuf) { PlayerAbility[] playerAbilities = PlayerAbility.fromBitMask(byteBuf.readByte()); float flyingSpeed = byteBuf.readFloat(), walkingSpeed = byteBuf.readFloat(); return new InPlayerAbilitiesPacket(playerAbilities, flyingSpeed, walkingSpeed); }
Example 8
Source File: AssembleResult.java From archimedes-ships with MIT License | 5 votes |
public AssembleResult(ByteBuf buf) { resultCode = buf.readByte(); if (resultCode == RESULT_NONE) return; blockCount = buf.readInt(); balloonCount = buf.readInt(); tileEntityCount = buf.readInt(); mass = buf.readFloat(); }
Example 9
Source File: SmeltingRecipe.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
public SmeltingRecipe(String id, RecipeType type, ByteBuf data) { super(id, type); group = StringSerializer.readVarIntUTF8String(data); ingredient = new RecipeIngredient(data); result = ItemStackSerializer.readItemStack(data); exp = data.readFloat(); time = VarNumberSerializer.readVarInt(data); }
Example 10
Source File: PacketFamiliarBolt.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void fromBytes(ByteBuf buf) { this.targetX = buf.readFloat(); this.targetY = buf.readFloat(); this.targetZ = buf.readFloat(); this.type = buf.readInt(); this.mightGetLong = buf.readBoolean(); owner = StringHelper.readFromBuffer(buf); }
Example 11
Source File: MoveLook.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readClientData(ByteBuf clientdata) { x = clientdata.readDouble(); y = clientdata.readDouble(); clientdata.readDouble(); z = clientdata.readDouble(); yaw = clientdata.readFloat(); pitch = clientdata.readFloat(); onGround = clientdata.readBoolean(); }
Example 12
Source File: AbsoluteMovementCommandsImplementation.java From malmo with MIT License | 5 votes |
@Override public void fromBytes(ByteBuf buf) { this.x = buf.readDouble(); this.y = buf.readDouble(); this.z = buf.readDouble(); this.yaw = buf.readFloat(); this.pitch = buf.readFloat(); this.setX = buf.readBoolean(); this.setY = buf.readBoolean(); this.setZ = buf.readBoolean(); this.setYaw = buf.readBoolean(); this.setPitch = buf.readBoolean(); }
Example 13
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 14
Source File: ParticlePacket.java From Cyberware with MIT License | 5 votes |
@Override public void fromBytes(ByteBuf buf) { effectId = buf.readInt(); x = buf.readFloat(); y = buf.readFloat(); z = buf.readFloat(); }
Example 15
Source File: SteerVehicle.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { sideForce = clientdata.readFloat(); forwardForce = clientdata.readFloat(); flags = BitUtils.createIBitMaskFromBits(flags_mask, new int[] {clientdata.readByte(), clientdata.readByte()}); }
Example 16
Source File: Look.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readClientData(ByteBuf clientdata) { yaw = clientdata.readFloat(); pitch = clientdata.readFloat(); onGround = clientdata.readBoolean(); }
Example 17
Source File: FloatType.java From ViaVersion with MIT License | 4 votes |
/** * @deprecated use {@link #readPrimitive(ByteBuf)} for manual reading to avoid wrapping */ @Override @Deprecated public Float read(ByteBuf buffer) { return buffer.readFloat(); }
Example 18
Source File: NetworkEntityMetadataObjectFloat.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override public void readFromStream(ByteBuf from) { value = from.readFloat(); }
Example 19
Source File: MiddlePlayerAbilities.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void readServerData(ByteBuf serverdata) { flags = serverdata.readUnsignedByte(); flyspeed = serverdata.readFloat(); walkspeed = serverdata.readFloat(); }
Example 20
Source File: ByteBufUtils.java From Cleanstone with MIT License | 4 votes |
public static HeadRotatablePosition readHeadRotatablePosition(ByteBuf byteBuf) { float yaw = byteBuf.readFloat(), pitch = byteBuf.readFloat(); return new HeadRotatablePosition(readRotatablePosition(byteBuf), new Rotation(yaw, pitch)); }