List of usage examples for io.netty.buffer ByteBufOutputStream writeBoolean
@Override public void writeBoolean(boolean v) throws IOException
From source file:com.kanbekotori.keycraft.network.RewriteNetwork.java
License:Open Source License
public static FMLProxyPacket createSyncSkillPacket(EntityPlayer player) { ByteBufOutputStream stream = new ByteBufOutputStream(Unpooled.buffer()); FMLProxyPacket packet = null;/*ww w . j a va2 s . co m*/ try { stream.writeInt(SYNC_SKILL_CODE); for (RewriteHelper.Skill i : RewriteHelper.SKILLS) { stream.writeBoolean(RewriteHelper.hasSkill(player, i.id)); } packet = new FMLProxyPacket(stream.buffer(), REWRITE_CHANNEL); stream.close(); } catch (IOException e) { e.printStackTrace(); } return packet; }
From source file:de.sanandrew.mods.enderstuffp.network.packet.PacketBiomeChangerActions.java
License:Creative Commons License
@Override public void writeData(ByteBufOutputStream stream, Tuple dataTuple) throws IOException { EnumAction action = (EnumAction) dataTuple.getValue(0); TileEntityBiomeChanger biomeChangerTile = (TileEntityBiomeChanger) dataTuple.getValue(1); stream.writeByte(action.ordinal());/*w w w . j a v a 2 s. com*/ stream.writeInt(biomeChangerTile.xCoord); stream.writeInt(biomeChangerTile.yCoord); stream.writeInt(biomeChangerTile.zCoord); switch (action) { case CHANGE_BIOME: stream.writeByte(biomeChangerTile.getCurrRange()); break; case REPLACE_BLOCKS: stream.writeBoolean(biomeChangerTile.isReplacingBlocks()); break; case CHNG_MAX_RANGE: stream.writeShort(biomeChangerTile.getMaxRange()); break; case CHNG_PERIM_FORM: stream.writeByte(biomeChangerTile.perimForm.ordinal()); } }
From source file:de.sanandrew.mods.turretmod.network.packet.PacketSendMultiTargetFlag.java
License:Creative Commons License
@Override public void writeData(ByteBufOutputStream stream, Tuple data) throws IOException { stream.writeInt((Integer) data.getValue(0)); try {/*from w w w . j av a 2s . c o m*/ @SuppressWarnings("unchecked") Map<Class<? extends EntityLiving>, Boolean> newTargetStg = (Map<Class<? extends EntityLiving>, Boolean>) data .getValue(1); stream.writeInt(newTargetStg.size()); for (Entry<Class<? extends EntityLiving>, Boolean> newTgts : newTargetStg.entrySet()) { stream.writeUTF((String) EntityList.classToStringMapping.get(newTgts.getKey())); stream.writeBoolean(newTgts.getValue()); } } catch (ClassCastException ex) { TurretMod.MOD_LOG.log(Level.WARN, "Cannot send multi-target list to server! An entry is invalid!"); throw new IOException(ex); } }
From source file:de.sanandrew.mods.turretmod.network.packet.PacketSendTargetFlag.java
License:Creative Commons License
@Override public void writeData(ByteBufOutputStream stream, Tuple data) throws IOException { stream.writeInt((Integer) data.getValue(0)); stream.writeUTF((String) data.getValue(1)); stream.writeBoolean((Boolean) data.getValue(2)); }
From source file:net.mcsproject.daemon.network.packets.PacketAuthResponse.java
License:Open Source License
@Override public void write(ByteBufOutputStream byteBuf) throws IOException { byteBuf.writeBoolean(this.ok); byteBuf.writeInt(this.minPort); byteBuf.writeInt(this.maxPort); byteBuf.writeUTF(this.resources); }