List of usage examples for io.netty.buffer ByteBuf writeFloat
public abstract ByteBuf writeFloat(float value);
From source file:matteroverdrive.network.packet.bi.PacketFirePlasmaShot.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { shot.writeTo(buf);//from w ww . ja v a2s .c o m buf.writeInt(sender); buf.writeDouble(position.xCoord); buf.writeDouble(position.yCoord); buf.writeDouble(position.zCoord); buf.writeFloat((float) direction.xCoord); buf.writeFloat((float) direction.yCoord); buf.writeFloat((float) direction.zCoord); }
From source file:matteroverdrive.starmap.data.Quadrant.java
License:Open Source License
public void writeToBuffer(ByteBuf buf) { super.writeToBuffer(buf); buf.writeFloat(x); buf.writeFloat(y);//from w ww .j av a2s . c o m buf.writeFloat(z); buf.writeFloat(size); buf.writeInt(getStars().size()); for (Star star : getStars()) { star.writeToBuffer(buf); } }
From source file:matteroverdrive.starmap.data.Star.java
License:Open Source License
@Override public void writeToBuffer(ByteBuf byteBuf) { super.writeToBuffer(byteBuf); byteBuf.writeFloat(x); byteBuf.writeFloat(y);/* w w w .jav a 2 s .c o m*/ byteBuf.writeFloat(z); byteBuf.writeFloat(size); byteBuf.writeFloat(mass); byteBuf.writeByte(type); byteBuf.writeInt(temperature); byteBuf.writeInt(color); /*int planetCount = getPlanets().size(); byteBuf.writeInt(planetCount); for (Planet planet : getPlanets()) { planet.writeToBuffer(byteBuf); }*/ }
From source file:mca.network.PacketCodec.java
License:Open Source License
public void encode(Packet packet, ChannelHandlerContext context, ByteBuf buffer) { EnumPacketType type = (EnumPacketType) packet.packetType; try {/*from w ww . j a v a 2 s .c om*/ switch (type) { case AddAI: buffer.writeInt((Integer) packet.arguments[0]); break; case AddBaby: buffer.writeBoolean((Boolean) packet.arguments[0]); break; case ArrangedMarriageParticles: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeInt((Integer) packet.arguments[1]); break; case BabyInfo: writeObject(buffer, packet.arguments[0]); break; case BroadcastKillEntity: buffer.writeInt((Integer) packet.arguments[0]); break; case AddBabyRequest: writeObject(buffer, packet.arguments[0]); writeObject(buffer, packet.arguments[1]); break; case AddMarriageRequest: writeObject(buffer, packet.arguments[0]); writeObject(buffer, packet.arguments[1]); break; case RemoveBabyRequest: writeObject(buffer, packet.arguments[0]); break; case RemoveMarriageRequest: writeObject(buffer, packet.arguments[0]); break; case ClientSideCommand: writeObject(buffer, packet.arguments[0]); break; case GiveRelationshipGift: buffer.writeInt((Integer) packet.arguments[0]); break; case GiveAid: buffer.writeInt((Integer) packet.arguments[0]); break; case Engagement: buffer.writeInt((Integer) packet.arguments[0]); break; case ForceRespawn: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeInt((Integer) packet.arguments[1]); buffer.writeInt((Integer) packet.arguments[2]); buffer.writeInt((Integer) packet.arguments[3]); break; case GetTombstoneText: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeInt((Integer) packet.arguments[1]); buffer.writeInt((Integer) packet.arguments[2]); break; case HaveBaby: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeInt((Integer) packet.arguments[1]); break; case KillEntity: buffer.writeInt((Integer) packet.arguments[0]); break; case MountHorse: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeInt((Integer) packet.arguments[1]); break; case NameBaby: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeBoolean((Boolean) packet.arguments[1]); break; case NotifyPlayer: buffer.writeInt((Integer) packet.arguments[0]); writeObject(buffer, packet.arguments[1]); break; case OpenGui: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeByte((Byte) packet.arguments[1]); break; case PlayerMarriage: buffer.writeInt((Integer) packet.arguments[0]); writeObject(buffer, packet.arguments[1]); buffer.writeInt((Integer) packet.arguments[2]); break; case RemoveItem: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeInt((Integer) packet.arguments[1]); buffer.writeInt((Integer) packet.arguments[2]); buffer.writeInt((Integer) packet.arguments[3]); break; case ReturnInventory: buffer.writeInt((Integer) packet.arguments[0]); break; case SayLocalized: boolean hasPlayer = packet.arguments[0] != null; boolean hasEntity = packet.arguments[1] != null; boolean hasPrefix = packet.arguments[4] != null; boolean hasSuffix = packet.arguments[5] != null; buffer.writeBoolean(hasPlayer); buffer.writeBoolean(hasEntity); buffer.writeBoolean(hasPrefix); buffer.writeBoolean(hasSuffix); if (hasPlayer) { writeObject(buffer, ((EntityPlayer) packet.arguments[0]).getCommandSenderName()); } if (hasEntity) { buffer.writeInt(((AbstractEntity) packet.arguments[1]).getEntityId()); } writeObject(buffer, packet.arguments[2]); buffer.writeBoolean((Boolean) packet.arguments[3]); if (hasPrefix) { writeObject(buffer, packet.arguments[4]); } if (hasSuffix) { writeObject(buffer, packet.arguments[5]); } break; case SetChore: buffer.writeInt((Integer) packet.arguments[0]); writeObject(buffer, packet.arguments[1]); break; case SetFamilyTree: buffer.writeInt((Integer) packet.arguments[0]); writeObject(buffer, packet.arguments[1]); break; case SetFieldValue: buffer.writeInt((Integer) packet.arguments[0]); writeObject(buffer, packet.arguments[1]); writeObject(buffer, packet.arguments[2]); break; case SetInventory: buffer.writeInt((Integer) packet.arguments[0]); writeObject(buffer, packet.arguments[1]); break; case SetPosition: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeDouble((Double) packet.arguments[1]); buffer.writeDouble((Double) packet.arguments[2]); buffer.writeDouble((Double) packet.arguments[3]); break; case SetTarget: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeInt((Integer) packet.arguments[1]); break; case SetTombstoneText: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeInt((Integer) packet.arguments[1]); buffer.writeInt((Integer) packet.arguments[2]); writeObject(buffer, packet.arguments[3]); writeObject(buffer, packet.arguments[4]); writeObject(buffer, packet.arguments[5]); writeObject(buffer, packet.arguments[6]); break; case SetWorldProperties: writeObject(buffer, packet.arguments[0]); break; case StartTrade: buffer.writeInt((Integer) packet.arguments[0]); break; case StopJumping: buffer.writeInt((Integer) packet.arguments[0]); break; case SwingArm: buffer.writeInt((Integer) packet.arguments[0]); break; case SyncEditorSettings: buffer.writeInt((Integer) packet.arguments[0]); writeObject(buffer, packet.arguments[1]); buffer.writeBoolean((Boolean) packet.arguments[2]); buffer.writeInt((Integer) packet.arguments[3]); buffer.writeFloat((Float) packet.arguments[4]); buffer.writeFloat((Float) packet.arguments[5]); buffer.writeFloat((Float) packet.arguments[6]); buffer.writeInt((Integer) packet.arguments[7]); writeObject(buffer, packet.arguments[8]); writeObject(buffer, packet.arguments[9]); break; case SyncRequest: buffer.writeInt((Integer) packet.arguments[0]); break; case Sync: buffer.writeInt((Integer) packet.arguments[0]); writeObject(buffer, packet.arguments[1]); break; case UpdateFurnace: buffer.writeInt((Integer) packet.arguments[0]); buffer.writeBoolean((Boolean) packet.arguments[1]); break; default: break; } } catch (Throwable e) { MCA.getInstance().getLogger().log(e); } }
From source file:mca.network.packets.PacketSyncEditorSettings.java
License:Open Source License
@Override public void toBytes(ByteBuf byteBuf) { byteBuf.writeInt(entityId);/* w w w .ja v a 2 s .com*/ ByteBufIO.writeObject(byteBuf, name); byteBuf.writeBoolean(isMale); byteBuf.writeInt(profession); byteBuf.writeFloat(moodPointsAnger); byteBuf.writeFloat(moodPointsHappy); byteBuf.writeFloat(moodPointsSad); byteBuf.writeInt(traitId); ByteBufIO.writeObject(byteBuf, inventory); ByteBufIO.writeObject(byteBuf, texture); }
From source file:minechess.common.network.PacketPlaySound.java
License:LGPL
@Override public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) { super.encodeInto(ctx, buffer); ByteBufUtils.writeUTF8String(buffer, sound); buffer.writeFloat(volume); buffer.writeFloat(pitch);//from w ww.jav a 2 s.co m buffer.writeBoolean(bool); }
From source file:net.malisis.advert.advert.AdvertSelection.java
License:Open Source License
public void toBytes(ByteBuf buf) { if (getAdvert() == null) return;/*from ww w . j a va 2s .co m*/ buf.writeInt(id); buf.writeFloat(u); buf.writeFloat(v); buf.writeFloat(U); buf.writeFloat(V); }
From source file:net.shadowmage.ancientwarfare.structure.entity.EntityGate.java
License:Open Source License
@Override public void writeSpawnData(ByteBuf data) { data.writeInt(pos1.x);// w w w .j a v a 2s. c o m data.writeInt(pos1.y); data.writeInt(pos1.z); data.writeInt(pos2.x); data.writeInt(pos2.y); data.writeInt(pos2.z); data.writeInt(this.gateType.getGlobalID()); data.writeFloat(this.edgePosition); data.writeFloat(this.edgeMax); data.writeByte(this.gateStatus); data.writeByte(this.gateOrientation); data.writeInt(health); }
From source file:net.tridentsdk.packets.play.out.PacketPlayOutExplosion.java
License:Open Source License
@Override public void encode(ByteBuf buf) { buf.writeFloat((float) this.loc.getX()); buf.writeFloat((float) this.loc.getY()); buf.writeFloat((float) this.loc.getZ()); buf.writeFloat(0.0F); // unused by client buf.writeInt(this.recordCount); for (RecordBuilder builder : this.records) { builder.write(buf);// w w w. j a v a2 s .co m } buf.writeFloat((float) this.velocity.getX()); buf.writeFloat((float) this.velocity.getY()); buf.writeFloat((float) this.velocity.getZ()); }
From source file:net.tridentsdk.packets.play.out.PacketPlayOutGameStateChange.java
License:Open Source License
@Override public void encode(ByteBuf buf) { buf.writeByte(this.reason); buf.writeFloat(this.value); }