List of usage examples for io.netty.buffer ByteBuf writeBoolean
public abstract ByteBuf writeBoolean(boolean value);
From source file:matteroverdrive.network.packet.server.PacketSendMachineNBT.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { super.toBytes(buf); ByteBufUtils.writeTag(buf, data);/*www .ja va 2 s . c om*/ buf.writeInt(cattegories); buf.writeBoolean(forceUpdate); }
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 {/* w ww .jav a 2 s .co m*/ 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.PacketAddBaby.java
License:Open Source License
@Override public void toBytes(ByteBuf byteBuf) { byteBuf.writeBoolean(isMale); }
From source file:mca.network.packets.PacketBabyInfo.java
License:Open Source License
@Override public void toBytes(ByteBuf byteBuf) { ByteBufIO.writeObject(byteBuf, targetSpouseName); ByteBufIO.writeObject(byteBuf, babyName); byteBuf.writeBoolean(babyExists); byteBuf.writeBoolean(babyIsMale);//from w ww . j a v a 2 s. c om byteBuf.writeBoolean(babyReadyToGrow); }
From source file:mca.network.packets.PacketOnVillagerProcreate.java
License:Open Source License
@Override public void toBytes(ByteBuf byteBuf) { byteBuf.writeInt(entityId); byteBuf.writeBoolean(babyIsMale); }
From source file:mca.network.packets.PacketSayLocalized.java
License:Open Source License
@Override public void toBytes(ByteBuf byteBuf) { hasPlayer = playerName != null;//from ww w . j a v a 2 s .c o m hasEntity = entityId != null; hasPrefix = prefix != null; hasSuffix = suffix != null; byteBuf.writeBoolean(hasPlayer); byteBuf.writeBoolean(hasEntity); byteBuf.writeBoolean(hasPrefix); byteBuf.writeBoolean(hasSuffix); if (hasPlayer) { ByteBufIO.writeObject(byteBuf, playerName); } if (hasEntity) { ByteBufIO.writeObject(byteBuf, entityId); } ByteBufIO.writeObject(byteBuf, phraseId); byteBuf.writeBoolean(useCharacterType); if (hasPrefix) { ByteBufIO.writeObject(byteBuf, prefix); } if (hasSuffix) { ByteBufIO.writeObject(byteBuf, suffix); } }
From source file:mca.network.packets.PacketSyncEditorSettings.java
License:Open Source License
@Override public void toBytes(ByteBuf byteBuf) { byteBuf.writeInt(entityId);/*from w ww . jav a 2 s. co m*/ 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:mca.network.packets.PacketUpdateFurnace.java
License:Open Source License
@Override public void toBytes(ByteBuf byteBuf) { byteBuf.writeInt(entityId); byteBuf.writeBoolean(state); }
From source file:me.undergroundminer3.uee4.emcAirEnergy.TileAirConsumer.java
License:Minecraft Mod Public
@Override public PacketPayload getPacketPayload() { PacketPayload payload = new PacketPayload(new PacketPayload.StreamWriter() { @Override/* ww w .j ava 2s. c o m*/ public void writeData(ByteBuf buf) { buf.writeBoolean(powered); } }); return payload; }
From source file:me.undergroundminer3.uee4.network2.PacketEmcPipeUpdate.java
License:Minecraft Mod Public
@Override public void writeData(ByteBuf data) { super.writeData(data); data.writeBoolean(overload); for (int i = 0; i < displayPower.length; i++) { data.writeByte(displayPower[i]); }//from www . j a v a2 s . com }