List of usage examples for io.netty.buffer ByteBuf writeFloat
public abstract ByteBuf writeFloat(float value);
From source file:net.tridentsdk.packets.play.out.PacketPlayOutParticle.java
License:Open Source License
@Override public void encode(ByteBuf buf) { buf.writeInt(this.particleId); buf.writeBoolean(this.distance); buf.writeFloat((float) this.loc.getX()); buf.writeFloat((float) this.loc.getY()); buf.writeFloat((float) this.loc.getZ()); buf.writeFloat((float) this.offset.getX()); buf.writeFloat((float) this.offset.getY()); buf.writeFloat((float) this.offset.getZ()); buf.writeFloat(this.particleData); buf.writeInt(this.data.length); for (int i : this.data) { Codec.writeVarInt32(buf, i); }//from ww w .j a v a 2 s. c o m }
From source file:net.tridentsdk.packets.play.out.PacketPlayOutPlayerAbilities.java
License:Open Source License
@Override public void encode(ByteBuf buf) { buf.writeByte((int) this.flags); buf.writeFloat(this.flyingSpeed); buf.writeFloat(this.walkingSpeed); }
From source file:net.tridentsdk.packets.play.out.PacketPlayOutPlayerCompleteMove.java
License:Open Source License
@Override public void encode(ByteBuf buf) { buf.writeDouble(this.location.getX()); buf.writeDouble(this.location.getY()); buf.writeDouble(this.location.getZ()); buf.writeFloat(this.location.getYaw()); buf.writeFloat(this.location.getPitch()); buf.writeByte((int) this.flags); }
From source file:net.tridentsdk.packets.play.out.PacketPlayOutSetExperience.java
License:Open Source License
@Override public void encode(ByteBuf buf) { buf.writeFloat(this.experienceBar); Codec.writeVarInt32(buf, this.level); Codec.writeVarInt64(buf, this.totalExperience); }
From source file:net.tridentsdk.packets.play.out.PacketPlayOutSoundEffect.java
License:Open Source License
@Override public void encode(ByteBuf buf) { Codec.writeString(buf, this.soundName.toString()); buf.writeInt((int) this.loc.getX()); buf.writeInt((int) this.loc.getY()); buf.writeInt((int) this.loc.getZ()); buf.writeFloat(this.volume); buf.writeByte(this.pitch); }
From source file:net.tridentsdk.packets.play.out.PacketPlayOutUpdateHealth.java
License:Open Source License
@Override public void encode(ByteBuf buf) { buf.writeFloat(this.health); Codec.writeVarInt32(buf, this.food); buf.writeFloat(this.foodSaturation); }
From source file:net.tridentsdk.server.data.ProtocolMetadata.java
License:Apache License
@Override public void write(ByteBuf buf) { List<MetadataValue> localMeta; synchronized (metadata) { localMeta = metadata;//from w w w.j a v a 2 s .com } for (MetadataValue value : localMeta) { if (value == null) { continue; } buf.writeByte((value.type().id() << 5 | value.index & 0x1F) & 0xFF); switch (value.type) { case BYTE: buf.writeByte((byte) value.value); break; case SHORT: buf.writeShort((short) value.value); break; case INT: buf.writeInt((int) value.value); break; case FLOAT: buf.writeFloat((float) value.value); break; case STRING: Codec.writeString(buf, (String) value.value); break; case SLOT: ((Slot) value.value).write(buf); break; case XYZ: Vector vector = (Vector) value.value; buf.writeInt((int) vector.x()); buf.writeInt((int) vector.y()); buf.writeInt((int) vector.z()); break; case PYR: Vector v = (Vector) value.value; buf.writeFloat((float) v.x()); buf.writeFloat((float) v.y()); buf.writeFloat((float) v.z()); break; } } buf.writeByte(0x7F); // terminate array }
From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutExplosion.java
License:Apache License
@Override public void encode(ByteBuf buf) { buf.writeFloat((float) this.loc.x()); buf.writeFloat((float) this.loc.y()); buf.writeFloat((float) this.loc.z()); buf.writeFloat(0.0F); // unused by client buf.writeInt(this.recordCount); for (RecordBuilder builder : this.records) { builder.write(buf);//from w w w. java2s . c o m } buf.writeFloat((float) this.velocity.x()); buf.writeFloat((float) this.velocity.y()); buf.writeFloat((float) this.velocity.z()); }
From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutParticle.java
License:Apache License
@Override public void encode(ByteBuf buf) { buf.writeInt(this.particleId); buf.writeBoolean(this.distance); buf.writeFloat((float) this.loc.x()); buf.writeFloat((float) this.loc.y()); buf.writeFloat((float) this.loc.z()); buf.writeFloat((float) this.offset.x()); buf.writeFloat((float) this.offset.y()); buf.writeFloat((float) this.offset.z()); buf.writeFloat(this.particleData); buf.writeInt(this.data.length); for (int i : this.data) { Codec.writeVarInt32(buf, i); }// w w w . j av a2 s . c o m }
From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutPlayerCompleteMove.java
License:Apache License
@Override public void encode(ByteBuf buf) { buf.writeDouble(this.location.x()); buf.writeDouble(this.location.y()); buf.writeDouble(this.location.z()); buf.writeFloat(this.location.yaw()); buf.writeFloat(this.location.pitch()); buf.writeByte((int) this.flags); }