List of usage examples for io.netty.buffer ByteBuf writeBoolean
public abstract ByteBuf writeBoolean(boolean value);
From source file:com.teamdman_9201.flow.TileFloodGate.java
License:Minecraft Mod Public
public void writeData(ByteBuf stream) { for (int i = 0; i < 6; i++) { stream.writeBoolean(blockedSides[i]); }/*from w w w.j av a2s. c o m*/ }
From source file:com.theoriginalbit.moarperipherals.common.network.message.MessageGeneric.java
License:Apache License
@Override public void toBytes(ByteBuf buf) { // Write any string data if (stringData != null) { buf.writeInt(stringData.length); for (String str : stringData) { ByteBufUtils.writeUTF8String(buf, str); }/*from w w w . j a v a 2s . c om*/ } else { buf.writeInt(0); } // Write any integer data if (intData != null) { buf.writeInt(intData.length); for (int i : intData) { buf.writeInt(i); } } else { buf.writeInt(0); } // Write any byte data if (byteData != null) { buf.writeInt(byteData.length); buf.writeBytes(byteData); } else { buf.writeInt(0); } // Write any char data if (charData != null) { buf.writeInt(charData.length); for (char c : charData) { buf.writeChar(c); } } else { buf.writeInt(0); } // Write any float data if (floatData != null) { buf.writeInt(floatData.length); for (float f : floatData) { buf.writeFloat(f); } } else { buf.writeInt(0); } // Write any double data if (doubleData != null) { buf.writeInt(doubleData.length); for (double d : doubleData) { buf.writeDouble(d); } } else { buf.writeInt(0); } // Write any NBT data if (nbtData != null) { buf.writeBoolean(true); ByteBufUtils.writeTag(buf, nbtData); } else { buf.writeBoolean(false); } }
From source file:com.vethrfolnir.game.network.login.send.ServerRegistration.java
License:Open Source License
@Override public void write(NetworkClient context, ByteBuf buff, Object... params) { CorvusConfig config = Corax.config(); String host = config.getProperty("Game.External", "0.0.0.0"); int port = config.getProperty("Game.Port", -1); int capacity = config.getProperty("Game.OnlineCount", -1); int serverId = config.getProperty("LoginServer.ServerId", -1); String password = config.getProperty("LoginServer.Password", "root"); boolean acceptAnyId = config.getProperty("LoginServer.AcceptAnyId", false); writeC(buff, 0x0A);//from w w w . jav a 2s . c o m writeD(buff, serverId); writeS(buff, host); writeD(buff, port); writeD(buff, capacity); writeS(buff, password); buff.writeBoolean(acceptAnyId); }
From source file:com.vethrfolnir.game.network.mu.send.AllowSummonerCreation.java
License:Open Source License
@Override public void write(NetworkClient context, ByteBuf buff, Object... params) { boolean allow = as(params[0]); writeC(buff, 0xC1);//from www. j av a 2 s. c o m writeC(buff, 0x05); writeC(buff, 0xDE); writeC(buff, 0x00); //writeC(buff, allow ? 0x0F : 0x00); buff.writeBoolean(allow); }
From source file:com.yyon.grapplinghook.entities.grappleArrow.java
License:Open Source License
@Override public void writeSpawnData(ByteBuf data) { data.writeInt(this.shootingEntity != null ? this.shootingEntity.getEntityId() : 0); data.writeBoolean(this.righthand); }
From source file:com.yyon.grapplinghook.network.GrappleClickMessage.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeInt(this.id); buf.writeBoolean(this.leftclick); }
From source file:com.yyon.grapplinghook.network.MultiHookMessage.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeInt(this.id); buf.writeBoolean(this.sneaking); }
From source file:dan200.qcraft.shared.QCraftPacket.java
License:Open Source License
@Override public void toBytes(ByteBuf buffer) { buffer.writeByte(packetType);/*from w ww. j a v a 2 s .c om*/ if (dataString != null) { buffer.writeByte(dataString.length); } else { buffer.writeByte(0); } if (dataInt != null) { buffer.writeByte(dataInt.length); } else { buffer.writeByte(0); } if (dataByte != null) { buffer.writeInt(dataByte.length); } else { buffer.writeInt(0); } if (dataString != null) { for (String s : dataString) { if (s != null) { try { byte[] b = s.getBytes("UTF-8"); buffer.writeBoolean(true); buffer.writeInt(b.length); buffer.writeBytes(b); } catch (UnsupportedEncodingException e) { buffer.writeBoolean(false); } } else { buffer.writeBoolean(false); } } } if (dataInt != null) { for (int i : dataInt) { buffer.writeInt(i); } } if (dataByte != null) { for (byte[] bytes : dataByte) { if (bytes != null) { buffer.writeInt(bytes.length); buffer.writeBytes(bytes); } else { buffer.writeInt(0); } } } }
From source file:de.canitzp.rarmor.packet.PacketOpenModule.java
@Override public void toBytes(ByteBuf buf) { buf.writeInt(this.moduleId); buf.writeBoolean(this.alsoSetData); buf.writeBoolean(this.sendRarmorDataToClient); }
From source file:de.canitzp.rarmor.packet.PacketSyncRarmorData.java
@Override public void toBytes(ByteBuf buf) { buf.writeBoolean(this.shouldReloadTabs); buf.writeInt(this.moduleIdForConfirmation); PacketBuffer buffer = new PacketBuffer(buf); buffer.writeUniqueId(this.stackId); NBTTagCompound compound = new NBTTagCompound(); this.data.writeToNBT(compound, true); buffer.writeCompoundTag(compound);/*from w w w.jav a 2 s . com*/ }