List of usage examples for io.netty.buffer ByteBuf readBoolean
public abstract boolean readBoolean();
From source file:matteroverdrive.network.packet.bi.PacketStarLoading.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { quadrantID = buf.readInt();//from ww w . j a va 2 s . c o m starID = buf.readInt(); star = new Star(); if (buf.readBoolean()) { star = new Star(); star.readFromBuffer(buf); } }
From source file:matteroverdrive.network.packet.bi.PacketWeaponTick.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { timestamp = buf.readLong();// ww w . j a va 2 s. c om if (buf.readBoolean()) { this.plasmaShot = new PacketFirePlasmaShot(); this.plasmaShot.fromBytes(buf); } }
From source file:matteroverdrive.network.packet.server.PacketManageConversation.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { npcID = buf.readInt(); start = buf.readBoolean(); }
From source file:matteroverdrive.network.packet.server.PacketSendMachineNBT.java
License:Open Source License
@Override public void fromBytes(ByteBuf buf) { super.fromBytes(buf); data = ByteBufUtils.readTag(buf);/*from www . j a v a 2s . c om*/ cattegories = buf.readInt(); forceUpdate = buf.readBoolean(); }
From source file:mca.network.PacketCodec.java
License:Open Source License
public void decode(Packet packet, ChannelHandlerContext context, ByteBuf buffer) { EnumPacketType type = (EnumPacketType) packet.packetType; try {// ww w . ja va2s .c om switch (type) { case AddAI: packet.arguments[0] = buffer.readInt(); break; case AddBaby: packet.arguments[0] = buffer.readBoolean(); break; case ArrangedMarriageParticles: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readInt(); break; case BabyInfo: packet.arguments[0] = readObject(buffer); break; case BroadcastKillEntity: packet.arguments[0] = buffer.readInt(); break; case AddBabyRequest: packet.arguments[0] = readObject(buffer); packet.arguments[1] = readObject(buffer); break; case AddMarriageRequest: packet.arguments[0] = readObject(buffer); packet.arguments[1] = readObject(buffer); break; case RemoveBabyRequest: packet.arguments[0] = readObject(buffer); break; case RemoveMarriageRequest: packet.arguments[0] = readObject(buffer); break; case ClientSideCommand: packet.arguments[0] = readObject(buffer); break; case GiveRelationshipGift: packet.arguments[0] = buffer.readInt(); break; case GiveAid: packet.arguments[0] = buffer.readInt(); break; case Engagement: packet.arguments[0] = buffer.readInt(); break; case ForceRespawn: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readInt(); packet.arguments[2] = buffer.readInt(); packet.arguments[3] = buffer.readInt(); break; case GetTombstoneText: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readInt(); packet.arguments[2] = buffer.readInt(); break; case HaveBaby: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readInt(); break; case KillEntity: packet.arguments[0] = buffer.readInt(); break; case MountHorse: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readInt(); break; case NameBaby: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readBoolean(); break; case NotifyPlayer: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = readObject(buffer); break; case OpenGui: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readByte(); break; case PlayerMarriage: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = readObject(buffer); packet.arguments[2] = buffer.readInt(); break; case RemoveItem: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readInt(); packet.arguments[2] = buffer.readInt(); packet.arguments[3] = buffer.readInt(); break; case ReturnInventory: packet.arguments[0] = buffer.readInt(); break; case SayLocalized: boolean hasPlayer = buffer.readBoolean(); boolean hasEntity = buffer.readBoolean(); boolean hasPrefix = buffer.readBoolean(); boolean hasSuffix = buffer.readBoolean(); final String playerName = hasPlayer ? (String) readObject(buffer) : null; final int entityId = hasEntity ? buffer.readInt() : -1; final String phraseId = (String) readObject(buffer); final boolean useCharacterType = buffer.readBoolean(); final String prefix = hasPrefix ? (String) readObject(buffer) : null; final String suffix = hasSuffix ? (String) readObject(buffer) : null; packet.arguments = new Object[10]; packet.arguments[0] = hasPlayer; packet.arguments[1] = hasEntity; packet.arguments[2] = hasPrefix; packet.arguments[3] = hasSuffix; packet.arguments[4] = playerName; packet.arguments[5] = entityId; packet.arguments[6] = phraseId; packet.arguments[7] = useCharacterType; packet.arguments[8] = prefix; packet.arguments[9] = suffix; break; case SetChore: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = readObject(buffer); break; case SetFamilyTree: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = readObject(buffer); break; case SetFieldValue: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = readObject(buffer); packet.arguments[2] = readObject(buffer); break; case SetInventory: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = readObject(buffer); break; case SetPosition: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readDouble(); packet.arguments[2] = buffer.readDouble(); packet.arguments[3] = buffer.readDouble(); break; case SetTarget: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readInt(); break; case SetTombstoneText: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readInt(); packet.arguments[2] = buffer.readInt(); packet.arguments[3] = readObject(buffer); packet.arguments[4] = readObject(buffer); packet.arguments[5] = readObject(buffer); packet.arguments[6] = readObject(buffer); break; case SetWorldProperties: packet.arguments[0] = readObject(buffer); break; case StartTrade: packet.arguments[0] = buffer.readInt(); break; case StopJumping: packet.arguments[0] = buffer.readInt(); break; case SwingArm: packet.arguments[0] = buffer.readInt(); break; case SyncEditorSettings: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = readObject(buffer); packet.arguments[2] = buffer.readBoolean(); packet.arguments[3] = buffer.readInt(); packet.arguments[4] = buffer.readFloat(); packet.arguments[5] = buffer.readFloat(); packet.arguments[6] = buffer.readFloat(); packet.arguments[7] = buffer.readInt(); packet.arguments[8] = readObject(buffer); packet.arguments[9] = readObject(buffer); break; case SyncRequest: packet.arguments[0] = buffer.readInt(); break; case Sync: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = readObject(buffer); break; case UpdateFurnace: packet.arguments[0] = buffer.readInt(); packet.arguments[1] = buffer.readBoolean(); break; default: break; } } catch (Throwable e) { e.printStackTrace(); } }
From source file:mca.network.packets.PacketAddBaby.java
License:Open Source License
@Override public void fromBytes(ByteBuf byteBuf) { isMale = byteBuf.readBoolean(); }
From source file:mca.network.packets.PacketBabyInfo.java
License:Open Source License
@Override public void fromBytes(ByteBuf byteBuf) { targetSpouseName = (String) ByteBufIO.readObject(byteBuf); babyName = (String) ByteBufIO.readObject(byteBuf); babyExists = byteBuf.readBoolean(); babyIsMale = byteBuf.readBoolean();//from w w w . j av a2s . c o m babyReadyToGrow = byteBuf.readBoolean(); }
From source file:mca.network.packets.PacketOnVillagerProcreate.java
License:Open Source License
@Override public void fromBytes(ByteBuf byteBuf) { entityId = byteBuf.readInt(); babyIsMale = byteBuf.readBoolean(); }
From source file:mca.network.packets.PacketSayLocalized.java
License:Open Source License
@Override public void fromBytes(ByteBuf byteBuf) { hasPlayer = byteBuf.readBoolean(); hasEntity = byteBuf.readBoolean();//from w w w . jav a 2s.co m hasPrefix = byteBuf.readBoolean(); hasSuffix = byteBuf.readBoolean(); playerName = hasPlayer ? (String) ByteBufIO.readObject(byteBuf) : null; entityId = hasEntity ? (Integer) ByteBufIO.readObject(byteBuf) : -1; phraseId = (String) ByteBufIO.readObject(byteBuf); useCharacterType = byteBuf.readBoolean(); prefix = hasPrefix ? (String) ByteBufIO.readObject(byteBuf) : null; suffix = hasSuffix ? (String) ByteBufIO.readObject(byteBuf) : null; }
From source file:mca.network.packets.PacketSyncEditorSettings.java
License:Open Source License
@Override public void fromBytes(ByteBuf byteBuf) { entityId = byteBuf.readInt();/*from w w w . j av a2s. c om*/ name = (String) ByteBufIO.readObject(byteBuf); isMale = byteBuf.readBoolean(); profession = byteBuf.readInt(); moodPointsAnger = byteBuf.readFloat(); moodPointsHappy = byteBuf.readFloat(); moodPointsSad = byteBuf.readFloat(); traitId = byteBuf.readInt(); inventory = (Inventory) ByteBufIO.readObject(byteBuf); texture = (String) ByteBufIO.readObject(byteBuf); }