List of usage examples for io.netty.buffer ByteBufOutputStream writeInt
@Override public void writeInt(int v) throws IOException
From source file:com.kanbekotori.keycraft.network.RewriteNetwork.java
License:Open Source License
public static FMLProxyPacket createSyncAuroraPointPacket(EntityPlayer player) { ByteBufOutputStream stream = new ByteBufOutputStream(Unpooled.buffer()); FMLProxyPacket packet = null;/*from w w w.j av a 2s . c o m*/ try { stream.writeInt(SYNC_AURORA_POINT_CODE); stream.writeInt(RewriteHelper.getAuroraPoint(player)); packet = new FMLProxyPacket(stream.buffer(), REWRITE_CHANNEL); stream.close(); } catch (IOException e) { e.printStackTrace(); } return packet; }
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;/*from w w w .j a v a2 s . c om*/ 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:com.kanbekotori.keycraft.network.RewriteNetwork.java
License:Open Source License
public static FMLProxyPacket createLearnSkillPacket(int skillId) { ByteBufOutputStream stream = new ByteBufOutputStream(Unpooled.buffer()); FMLProxyPacket packet = null;// www .j ava 2 s .co m try { stream.writeInt(LEARN_SKILL_CODE); stream.writeInt(skillId); packet = new FMLProxyPacket(stream.buffer(), REWRITE_CHANNEL); stream.close(); } catch (IOException e) { e.printStackTrace(); } return packet; }
From source file:com.kanbekotori.keycraft.network.RewriteNetwork.java
License:Open Source License
public static FMLProxyPacket createUseSkillPacket() { ByteBufOutputStream stream = new ByteBufOutputStream(Unpooled.buffer()); FMLProxyPacket packet = null;/* www.j a va2s . c o m*/ try { stream.writeInt(USE_SKILL_CODE); packet = new FMLProxyPacket(stream.buffer(), REWRITE_CHANNEL); stream.close(); } catch (IOException e) { e.printStackTrace(); } return packet; }
From source file:de.sanandrew.mods.claysoldiers.network.packet.PacketSendEffectNBT.java
License:Creative Commons License
@Override public void writeData(ByteBufOutputStream stream, Tuple dataTuple) throws IOException { @SuppressWarnings("unchecked") Triplet<Integer, Byte, NBTTagCompound> data = (Triplet) dataTuple; stream.writeInt(data.getValue0()); stream.writeByte(data.getValue1());// w w w. ja va2 s . c o m ByteBufUtils.writeTag(stream.buffer(), data.getValue2()); }
From source file:de.sanandrew.mods.claysoldiers.network.packet.PacketSoldierRender.java
License:Creative Commons License
@Override @SuppressWarnings("unchecked") public void writeData(ByteBufOutputStream stream, Tuple dataTuple) throws IOException { Triplet<Integer, long[], long[]> data = (Triplet) dataTuple; stream.writeInt(data.getValue0()); // entity id stream.writeLong(data.getValue1()[0]); // upgrade flags 1 stream.writeLong(data.getValue1()[1]); // upgrade flags 2 stream.writeLong(data.getValue2()[0]); // effect flags 1 stream.writeLong(data.getValue2()[1]); // effect flags 2 }
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 ww . j ava 2 s . c om 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.enderstuffp.network.packet.PacketBiomeChangerModify.java
License:Creative Commons License
@Override public void writeData(ByteBufOutputStream stream, Tuple dataTuple) throws IOException { stream.writeInt((int) dataTuple.getValue(0)); // x stream.writeInt((int) dataTuple.getValue(1)); // z stream.writeByte((byte) dataTuple.getValue(2)); // biomeId }
From source file:de.sanandrew.mods.enderstuffp.network.packet.PacketEnderPetGuiAction.java
License:Creative Commons License
@Override public void writeData(ByteBufOutputStream stream, Tuple dataTuple) throws IOException { stream.writeInt((int) dataTuple.getValue(0)); stream.writeByte((byte) dataTuple.getValue(1)); if (dataTuple.getSize() == 3) { stream.writeUTF((String) dataTuple.getValue(2)); }//from w w w . ja v a 2 s . c om }
From source file:de.sanandrew.mods.enderstuffp.network.packet.PacketRemoteOpenGui.java
License:Creative Commons License
@Override public void writeData(ByteBufOutputStream stream, Tuple dataTuple) throws IOException { stream.writeByte((byte) dataTuple.getValue(0)); stream.writeInt((int) dataTuple.getValue(1)); stream.writeInt((int) dataTuple.getValue(2)); stream.writeInt((int) dataTuple.getValue(3)); }