Java Code Examples for io.netty.buffer.ByteBuf#readDouble()
The following examples show how to use
io.netty.buffer.ByteBuf#readDouble() .
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: FetchHealthResponseCodec.java From joyqueue with Apache License 2.0 | 5 votes |
@Override public Object decode(JoyQueueHeader header, ByteBuf buffer) throws Exception { double point = buffer.readDouble(); FetchHealthResponse fetchHealthResponse = new FetchHealthResponse(); fetchHealthResponse.setPoint(point); return fetchHealthResponse; }
Example 3
Source File: EntityTippedArrow.java From Et-Futurum with The Unlicense | 5 votes |
@Override public void readSpawnData(ByteBuf buffer) { rotationYaw = buffer.readFloat(); shootingEntity = worldObj.getEntityByID(buffer.readInt()); motionX = buffer.readDouble(); motionY = buffer.readDouble(); motionZ = buffer.readDouble(); posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; posY -= 0.10000000149011612D; posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; effect = new PotionEffect(buffer.readInt(), buffer.readInt(), buffer.readInt()); }
Example 4
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(); z = clientdata.readDouble(); yaw = clientdata.readFloat(); pitch = clientdata.readFloat(); onGround = clientdata.readBoolean(); }
Example 5
Source File: InvokeWandMessage.java From pycode-minecraft with MIT License | 5 votes |
@Override public void fromBytes(ByteBuf buf) { hitVec = new Vec3d(buf.readDouble(), buf.readDouble(), buf.readDouble()); typeOfHit = RayTraceResult.Type.MISS; switch (buf.readShort()) { case 1: typeOfHit = RayTraceResult.Type.BLOCK; blockPos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt()); sideHit = EnumFacing.values()[buf.readShort()]; break; case 2: typeOfHit = RayTraceResult.Type.ENTITY; entityId = buf.readInt(); } }
Example 6
Source File: MiddleSpawnObject.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { int entityId = VarNumberSerializer.readVarInt(serverdata); UUID uuid = UUIDSerializer.readUUID2L(serverdata); int typeId = serverdata.readUnsignedByte(); NetworkEntityType type = NetworkEntityType.getObjectByNetworkTypeId(typeId); x = serverdata.readDouble(); y = serverdata.readDouble(); z = serverdata.readDouble(); pitch = serverdata.readByte(); yaw = serverdata.readByte(); objectdata = serverdata.readInt(); motX = serverdata.readShort(); motY = serverdata.readShort(); motZ = serverdata.readShort(); if (type == NetworkEntityType.NONE) { if (ServerPlatform.get().getMiscUtils().isDebugging()) { ProtocolSupport.logWarning(MessageFormat.format( "Attempted to spawn unknown object entity type id {0} at {1},{2},{3}", typeId, x, y, z )); } throw CancelMiddlePacketException.INSTANCE; } entity = NetworkEntity.createObject(uuid, entityId, type); }
Example 7
Source File: MiddleSpawnNamed.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { int playerEntityId = VarNumberSerializer.readVarInt(serverdata); UUID uuid = UUIDSerializer.readUUID2L(serverdata); entity = NetworkEntity.createPlayer(uuid, playerEntityId); x = serverdata.readDouble(); y = serverdata.readDouble(); z = serverdata.readDouble(); yaw = serverdata.readByte(); pitch = serverdata.readByte(); }
Example 8
Source File: MiddleWorldParticle.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { particle = ParticleRegistry.fromId(serverdata.readInt()); longdist = serverdata.readBoolean(); x = serverdata.readDouble(); y = serverdata.readDouble(); z = serverdata.readDouble(); particle.read(serverdata); }
Example 9
Source File: MoveVehicle.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(); z = clientdata.readDouble(); yaw = clientdata.readFloat(); pitch = clientdata.readFloat(); }
Example 10
Source File: MiddleSetPosition.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { xOrig = x = serverdata.readDouble(); yOrig = y = serverdata.readDouble(); zOrig = z = serverdata.readDouble(); yawOrig = yaw = serverdata.readFloat(); pitchOrig = pitch = serverdata.readFloat(); flags = serverdata.readByte(); if (flags != 0) { Location location = connection.getPlayer().getLocation(); if ((flags & 0x01) != 0) { x += location.getX(); } if ((flags & 0x02) != 0) { y += location.getY(); } if ((flags & 0x04) != 0) { z += location.getX(); } if ((flags & 0x08) != 0) { pitch += location.getPitch(); } if ((flags & 0x10) != 0) { yaw += location.getYaw(); } } teleportConfirmId = VarNumberSerializer.readVarInt(serverdata); }
Example 11
Source File: PacketSpawnParticle.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void fromBytes(ByteBuf buffer){ super.fromBytes(buffer); particleName = ByteBufUtils.readUTF8String(buffer); dx = buffer.readDouble(); dy = buffer.readDouble(); dz = buffer.readDouble(); }
Example 12
Source File: Move.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(); onGround = clientdata.readBoolean(); }
Example 13
Source File: MiddleSpawnExpOrb.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { entity = new NetworkEntity(null, VarNumberSerializer.readVarInt(serverdata), NetworkEntityType.EXP_ORB); x = serverdata.readDouble(); y = serverdata.readDouble(); z = serverdata.readDouble(); count = serverdata.readShort(); }
Example 14
Source File: LocationDoublePacket.java From IGW-mod with GNU General Public License v2.0 | 5 votes |
@Override public void fromBytes(ByteBuf buf){ x = buf.readDouble(); y = buf.readDouble(); z = buf.readDouble(); }
Example 15
Source File: PlayerPositionCodec.java From Cleanstone with MIT License | 5 votes |
@Override public PlayerPositionPacket decode(ByteBuf byteBuf) { double x = byteBuf.readDouble(); double feetY = byteBuf.readDouble(); double z = byteBuf.readDouble(); boolean onGround = byteBuf.readBoolean(); Preconditions.checkArgument(Double.isFinite(x) && Double.isFinite(feetY) && Double.isFinite(z), "Non-finite position " + x + ":" + feetY + ":" + z); Preconditions.checkArgument(Math.abs(x) <= 3.2e7 && Math.abs(z) <= 3.2e7, "Too big position " + x + ":" + feetY + ":" + z + " (>3.2e7)"); return new PlayerPositionPacket(x, feetY, z, onGround); }
Example 16
Source File: MiddleVehicleMove.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { x = serverdata.readDouble(); y = serverdata.readDouble(); z = serverdata.readDouble(); yaw = serverdata.readFloat(); pitch = serverdata.readFloat(); }
Example 17
Source File: VectorImmutable.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
public static VectorImmutable readFromByteBuf(ByteBuf bufToRead) { return new VectorImmutable(bufToRead.readDouble(), bufToRead.readDouble(), bufToRead.readDouble()); }
Example 18
Source File: DoubleType.java From ViaVersion with MIT License | 4 votes |
@Override public Double read(ByteBuf buffer) { return buffer.readDouble(); }
Example 19
Source File: PointType.java From crate with Apache License 2.0 | 4 votes |
@Override public Point readBinaryValue(ByteBuf buffer, int valueLength) { double x = buffer.readDouble(); double y = buffer.readDouble(); return new PointImpl(x, y, JtsSpatialContext.GEO); }
Example 20
Source File: ByteBufUtils.java From Cleanstone with MIT License | 4 votes |
public static Position readPosition(ByteBuf byteBuf) { double x = byteBuf.readDouble(), y = byteBuf.readDouble(), z = byteBuf.readDouble(); return new Position(x, y, z); }