List of usage examples for io.netty.buffer ByteBuf writeBoolean
public abstract ByteBuf writeBoolean(boolean value);
From source file:com.builtbroken.grappling.network.packets.PacketHookSync.java
@Override public void write(ByteBuf buffer) { buffer.writeBoolean(playerHook != null); if (playerHook != null) { playerHook.write(buffer);//from ww w. ja va2 s . c o m } }
From source file:com.builtbroken.grappling.network.packets.PacketMouseClick.java
@Override public void write(ByteBuf buffer) { buffer.writeInt(slot); buffer.writeInt(button); buffer.writeInt(dwheel); buffer.writeBoolean(state); }
From source file:com.builtbroken.icbm.content.fof.TileFoF.java
@Override public void writeDescPacket(ByteBuf buf) { super.writeDescPacket(buf); buf.writeBoolean(profile != null); }
From source file:com.builtbroken.icbm.content.fragments.EntityFragment.java
@Override public void writeSpawnData(ByteBuf buffer) { if (fragmentType != null) { buffer.writeByte(fragmentType.ordinal()); } else {//from ww w. java 2s . c o m buffer.writeByte(-1); } if (fragmentMaterial != null) { buffer.writeInt(Block.getIdFromBlock(fragmentMaterial)); } else { buffer.writeByte(-1); } if (renderShape != null) { buffer.writeBoolean(true); renderShape.writeBytes(buffer); } else { buffer.writeBoolean(false); } }
From source file:com.builtbroken.icbm.content.missile.tile.TileCrashedMissile.java
@Override public void writeDescPacket(ByteBuf buf) { if (missile != null) { ByteBufUtils.writeItemStack(buf, missile.toStack()); } else {//from ww w.j a va2 s . c om ByteBufUtils.writeItemStack(buf, new ItemStack(Items.stone_axe)); //random sync data, set the missile to null } buf.writeFloat(yaw); buf.writeFloat(pitch); posOffset.writeByteBuf(buf); buf.writeBoolean(block != null); if (block != null) { ByteBufUtils.writeUTF8String(buf, Block.blockRegistry.getNameForObject(block)); buf.writeShort(meta); } }
From source file:com.builtbroken.icbm.content.rail.EntityMissileCart.java
@Override public void writeSpawnData(ByteBuf buffer) { super.writeSpawnData(buffer); buffer.writeInt(getType().ordinal()); buffer.writeBoolean(cargoStack != null); if (cargoStack != null) { ByteBufUtils.writeItemStack(buffer, cargoStack); }/*from w w w .j a v a 2 s . co m*/ }
From source file:com.Da_Technomancer.crossroads.API.packets.Message.java
License:Creative Commons License
private static void writeBoolean(boolean b, ByteBuf buf) { buf.writeBoolean(b); }
From source file:com.flowpowered.engine.network.codec.InputSnapshotCodec.java
License:MIT License
@Override public ByteBuf encode(ByteBuf buf, InputSnapshotMessage message) throws IOException { buf.writeInt(message.getKeyEvents().size()); for (KeyboardEvent e : message.getKeyEvents()) { buf.writeByte(e.getKeyId());/*from ww w. j a v a 2 s . co m*/ buf.writeBoolean(e.wasPressedDown()); } buf.writeInt(message.getMouseEvents().size()); for (MouseEvent e : message.getMouseEvents()) { buf.writeInt(e.getX()); buf.writeInt(e.getY()); buf.writeInt(e.getDX()); buf.writeInt(e.getDY()); buf.writeInt(e.getDWheel()); buf.writeInt(e.getButton()); buf.writeBoolean(e.wasPressedDown()); } buf.writeFloat(message.getDt()); buf.writeBoolean(message.isMouseGrabbed()); return buf; }
From source file:com.github.mrstampy.pprspray.core.streamer.negotiation.NegotiationMessageUtils.java
License:Open Source License
/** * Gets the negotiation ack message.//w w w . jav a 2 s .co m * * @param mediaHash * the media hash * @param accepted * the accepted * @return the negotiation ack message */ public static ByteBuf getNegotiationAckMessage(int mediaHash, boolean accepted) { int headerLength = MediaStreamerUtils.DEFAULT_HEADER_LENGTH; ByteBuf buf = Unpooled.buffer(headerLength + 1); MediaStreamerUtils.writeHeader(buf, MediaStreamType.NEGOTIATION_ACK, headerLength, 0, mediaHash, 0, false); buf.writeBoolean(accepted); return buf; }
From source file:com.github.mrstampy.pprspray.core.streamer.util.MediaStreamerUtils.java
License:Open Source License
/** * Write header.// w ww .j a v a2 s.co m * * @param buf * the buf * @param type * the type * @param headerLength * the header length * @param messageHash * the message hash * @param mediaHash * the media hash * @param sequence * the sequence * @param ackRequired * the ack required */ public static void writeHeader(ByteBuf buf, MediaStreamType type, int headerLength, int messageHash, int mediaHash, long sequence, boolean ackRequired) { buf.writeBytes(type.ordinalBytes()); buf.writeShort(headerLength); buf.writeInt(messageHash); buf.writeInt(mediaHash); buf.writeLong(sequence); buf.writeBoolean(ackRequired); }