List of usage examples for io.netty.buffer ByteBuf readFloat
public abstract float readFloat();
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 a va 2 s .c om 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.spout.vanilla.protocol.codec.world.ParticleEffectCodec.java
License:Open Source License
@Override public ParticleEffectMessage decode(ByteBuf buffer) throws IOException { String name = VanillaByteBufUtils.readString(buffer); float x = buffer.readFloat(); float y = buffer.readFloat(); float z = buffer.readFloat(); float xOffset = buffer.readFloat(); float yOffset = buffer.readFloat(); float zOffset = buffer.readFloat(); float velocity = buffer.readFloat(); int amount = buffer.readInt(); return new ParticleEffectMessage(name, x, y, z, xOffset, yOffset, zOffset, velocity, amount, NullRepositionManager.getInstance()); }
From source file:org.spout.vanilla.protocol.codec.world.SoundEffectCodec.java
License:Open Source License
@Override public SoundEffectMessage decode(ByteBuf buffer) throws IOException { String soundName = VanillaByteBufUtils.readString(buffer); float x = (float) buffer.readInt() / 8.0f; float y = (float) buffer.readInt() / 8.0f; float z = (float) buffer.readInt() / 8.0f; float volume = buffer.readFloat(); float pitch = 63f / (float) buffer.readUnsignedByte(); return new SoundEffectMessage(soundName, x, y, z, volume, pitch, NullRepositionManager.getInstance()); }
From source file:org.spout.vanilla.protocol.VanillaByteBufUtils.java
License:Open Source License
/** * Reads a list of parameters from the buffer. * * @param buf The buffer.//from ww w .j a va 2s. c o m * @return The parameters. */ public static List<Parameter<?>> readParameters(ByteBuf buf) throws IOException { List<Parameter<?>> parameters = new ArrayList<Parameter<?>>(); for (int b = buf.readUnsignedByte(); b != 127; b = buf.readUnsignedByte()) { int type = (b & 0xE0) >> 5; int index = b & 0x1F; switch (type) { case Parameter.TYPE_BYTE: parameters.add(new Parameter<Byte>(type, index, buf.readByte())); break; case Parameter.TYPE_SHORT: parameters.add(new Parameter<Short>(type, index, buf.readShort())); break; case Parameter.TYPE_INT: parameters.add(new Parameter<Integer>(type, index, buf.readInt())); break; case Parameter.TYPE_FLOAT: parameters.add(new Parameter<Float>(type, index, buf.readFloat())); break; case Parameter.TYPE_STRING: parameters.add(new Parameter<String>(type, index, readString(buf))); break; case Parameter.TYPE_ITEM: parameters.add(new Parameter<ItemStack>(type, index, readItemStack(buf))); break; } } return parameters; }
From source file:org.spoutcraft.client.network.codec.play.PositionLookCodec.java
License:MIT License
@Override public PositionLookMessage decode(ByteBuf buf) throws IOException { final double x = buf.readInt(); final double y = buf.readInt(); final double z = buf.readInt(); final float yaw = buf.readFloat(); final float pitch = buf.readFloat(); final boolean onGround = buf.readBoolean(); return new PositionLookMessage(x, y, z, yaw, pitch, onGround); }
From source file:org.starmod.net.object.field.type.NetworkFloat.java
License:MIT License
@Override public void decode(ByteBuf buf) { setValue(buf.readFloat()); }
From source file:org.starnub.starbounddata.types.damage.DamageNotification.java
License:Open Source License
@Override public void read(ByteBuf in) { this.sourceEntityId.read(in); this.targetEntityId.read(in); this.position.read(in); this.damage = in.readFloat(); this.damageSourceKind = readVLQString(in); this.targetMaterialKind = readVLQString(in); this.killed = in.readBoolean(); }
From source file:org.starnub.starbounddata.types.damage.DamageRequest.java
License:Open Source License
@Override public void read(ByteBuf in) { this.hitType = HitType.values()[in.readUnsignedByte()]; this.damageType = DamageType.values()[in.readUnsignedByte()]; this.damage = in.readFloat(); this.knockbackMomentum.read(in); this.sourceEntityId.read(in); this.damageSourceKind = readVLQString(in); this.statusEffects.read(in); }
From source file:org.starnub.starbounddata.types.damage.EphemeralStatusEffect.java
License:Open Source License
@Override public void read(ByteBuf in) { this.uniqueStatusEffect = readVLQString(in); boolean hasDuration = in.readBoolean(); if (hasDuration) { this.duration = in.readFloat(); }// w ww .j a v a2s . c om }
From source file:org.starnub.starbounddata.types.tile.TileDamage.java
License:Open Source License
@Override public void read(ByteBuf in) { this.tileDamageType = TileDamageType.values()[in.readUnsignedByte()]; this.amount = in.readFloat(); this.harvestLevel = in.readInt(); }