List of usage examples for io.netty.buffer ByteBuf readDouble
public abstract double readDouble();
From source file:org.spongepowered.clean.network.packet.play.serverbound.PlayerPositionPacket.java
License:MIT License
@Override public void read(ByteBuf buffer) { this.x = buffer.readDouble(); this.y = buffer.readDouble(); this.z = buffer.readDouble(); this.onGround = buffer.readBoolean(); }
From source file:org.spongepowered.clean.network.packet.play.serverbound.VehicleMovePacket.java
License:MIT License
@Override public void read(ByteBuf buffer) { this.x = buffer.readDouble(); this.y = buffer.readDouble(); this.z = buffer.readDouble(); this.yaw = buffer.readFloat(); this.pitch = buffer.readFloat(); }
From source file:org.spout.vanilla.protocol.codec.entity.EntityPropertiesCodec.java
License:Open Source License
@Override public EntityPropertiesMessage decode(ByteBuf buffer) throws IOException { int entityID = buffer.readInt(); int amount = buffer.readInt(); System.out.println(amount);/* w w w. j a v a2 s. c o m*/ EntityPropertiesMessage msg = new EntityPropertiesMessage(entityID); Map<EntityPropertiesCodec, Double> map = new HashMap<EntityPropertiesCodec, Double>(); for (int i = 1; i <= amount; i++) { msg.addProperty(EntityPropertiesMessage.EntityProperties.getByName(ByteBufUtils.readString(buffer)), buffer.readDouble()); } return msg; }
From source file:org.spout.vanilla.protocol.codec.player.pos.PlayerPositionCodec.java
License:Open Source License
@Override public PlayerPositionMessage decode(ByteBuf buffer) throws IOException { double x = buffer.readDouble(); double y = buffer.readDouble(); double stance = buffer.readDouble(); double z = buffer.readDouble(); boolean flying = buffer.readByte() == 1; return new PlayerPositionMessage(x, y, z, stance, flying, NullRepositionManager.getInstance()); }
From source file:org.spout.vanilla.protocol.codec.player.pos.PlayerPositionLookCodec.java
License:Open Source License
@Override public PlayerPositionLookMessage decode(ByteBuf buffer) throws IOException { double x = buffer.readDouble(); double y = buffer.readDouble(); double stance = buffer.readDouble(); double z = buffer.readDouble(); float yaw = -buffer.readFloat(); float pitch = buffer.readFloat(); boolean onGround = buffer.readByte() == 1; return new PlayerPositionLookMessage(x, y, z, stance, yaw, pitch, onGround, NullRepositionManager.getInstance()); }
From source file:org.spout.vanilla.protocol.codec.world.ExplosionCodec.java
License:Open Source License
@Override public ExplosionMessage decode(ByteBuf buffer) throws IOException { double x = buffer.readDouble(); double y = buffer.readDouble(); double z = buffer.readDouble(); float radius = buffer.readFloat(); int records = buffer.readInt(); byte[] coordinates = new byte[records * 3]; buffer.readBytes(coordinates);/*from w w w . j av a2 s. c o m*/ buffer.readFloat(); // unknown (x?) buffer.readFloat(); // unknown (y?) buffer.readFloat(); // unknown (z?) return new ExplosionMessage(x, y, z, radius, coordinates, NullRepositionManager.getInstance()); }
From source file:org.starmod.net.object.field.type.NetworkDouble.java
License:MIT License
@Override public void decode(ByteBuf buf) { setValue(buf.readDouble()); }
From source file:org.starnub.starbounddata.packets.server.UniverseTimeUpdatePacket.java
License:Open Source License
/** * Recommended: For internal use with StarNub Player Sessions * <p>/* w w w. j a va 2 s . c om*/ * Uses: This method will read in a {@link io.netty.buffer.ByteBuf} into this packets fields * <p> * * @param in ByteBuf representing the reason to be read into the packet */ @Override public void read(ByteBuf in) { this.universeTime = in.readDouble(); }
From source file:org.starnub.starbounddata.types.variants.Variant.java
License:Open Source License
@Override public void read(ByteBuf in) { this.variantType = VariantType.values()[in.readUnsignedByte()]; switch (variantType) { case NIL: {/*from w w w .ja va 2 s. c o m*/ value = null; break; } case DOUBLE: { value = in.readDouble(); break; } case BOOLEAN: { value = in.readBoolean(); break; } case INTEGER: { value = VLQ.readUnsignedFromBufferNoObject(in); break; } case STRING: { value = readVLQString(in); break; } case LIST: { value = new VariantList(in); break; } case MAP: value = new VariantMap(in); break; default: System.err.println("Unknown Variant Type, Variant Byte: " + variantType); } }
From source file:org.wso2.carbon.tcp.transport.util.SiddhiEventConverter.java
License:Open Source License
public Object[] toObjectArray(ByteBuf byteBuffer, Attribute.Type[] attributeTypeOrder) { if (attributeTypeOrder != null) { if (byteBuffer == null) { throw new MalformedEventException("Received byte stream in null. Hence cannot convert to event"); }/*from ww w . ja v a2 s . com*/ Object[] objects = new Object[attributeTypeOrder.length]; for (int i = 0; i < attributeTypeOrder.length; i++) { switch (attributeTypeOrder[i]) { case INT: objects[i] = byteBuffer.readInt(); break; case LONG: objects[i] = byteBuffer.readLong(); break; case STRING: int stringSize = byteBuffer.readInt(); if (stringSize == 0) { objects[i] = null; } else { objects[i] = BinaryMessageConverterUtil.getString(byteBuffer, stringSize); } break; case DOUBLE: objects[i] = byteBuffer.readDouble(); break; case FLOAT: objects[i] = byteBuffer.readFloat(); break; case BOOL: objects[i] = byteBuffer.readByte() == 1; break; } } return objects; } else { return null; } }