List of usage examples for io.netty.buffer ByteBuf readInt
public abstract int readInt();
From source file:buildcraftAdditions.tileEntities.TileMechanicalDuster.java
License:GNU General Public License
@Override public void readFromByteBuff(ByteBuf buf) { super.readFromByteBuff(buf); energy = buf.readInt(); progressStage = buf.readInt();/*w w w .j a v a 2 s . c o m*/ }
From source file:buildcraftAdditions.tileEntities.TileRefinery.java
License:GNU General Public License
@Override public void readFromByteBuff(ByteBuf buf) { valve = buf.readBoolean();/* w w w . j a v a2 s. com*/ currentHeat = buf.readInt(); lastRequiredHeat = buf.readInt(); energyCost = buf.readInt(); requiredHeat = buf.readInt(); inputFluid = ByteBufUtils.readUTF8String(buf); outputFluid = ByteBufUtils.readUTF8String(buf); input.readFromByteBuff(buf); output.readFromByteBuff(buf); data.readFromByteBuff(buf); upgrades.readFromByteBuff(buf); }
From source file:buildcraftAdditions.tileEntities.TileSemiAutomaticDuster.java
License:GNU General Public License
@Override public ByteBuf readFromByteBuff(ByteBuf buf) { buf = super.readFromByteBuff(buf); int id = buf.readInt(); int meta = buf.readInt(); ItemStack stack = id == -1 ? null : new ItemStack(Item.getItemById(id), 1, meta); setInventorySlotContents(0, stack);/*from w w w. j a va 2s. c om*/ return buf; }
From source file:buildcraftAdditions.tileEntities.varHelpers.MultiBlockData.java
License:GNU General Public License
@Override public void readFromByteBuff(ByteBuf buf) { isMaster = buf.readBoolean();/*from w ww . ja va2 s .co m*/ partOfMultiBlock = buf.readBoolean(); masterX = buf.readInt(); masterY = buf.readInt(); masterZ = buf.readInt(); }
From source file:buildcraftAdditions.tileEntities.varHelpers.SideConfiguration.java
License:GNU General Public License
@Override public ByteBuf readFromByteBuff(ByteBuf buf) { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { configurations[direction.ordinal()] = EnumSideStatus.values()[buf.readInt()]; priorities[direction.ordinal()] = EnumPriority.values()[buf.readInt()]; }// w w w .ja v a2 s . c o m return buf; }
From source file:buildcraftAdditions.utils.fluids.Tank.java
License:GNU General Public License
@Override public void readFromByteBuff(ByteBuf buf) { int id = buf.readInt(); int amount = buf.readInt(); NBTTagCompound tag = ByteBufUtils.readTag(buf); if (id < 0 || amount <= 0) setFluid(null);// w ww . j a v a2s. c o m else setFluid(new FluidStack(id, amount, tag)); }
From source file:buildcraftAdditions.utils.MultiBlockData.java
License:GNU General Public License
@Override public ByteBuf readFromByteBuff(ByteBuf buf) { isMaster = buf.readBoolean();/*from w w w . j a v a2 s.c om*/ partOfMultiBlock = buf.readBoolean(); masterX = buf.readInt(); masterY = buf.readInt(); masterZ = buf.readInt(); return null; }
From source file:buildcraftAdditions.utils.PlayerUtils.java
License:GNU General Public License
public static UUID readFromByteBuff(ByteBuf buf) { String s = ""; int length = buf.readInt(); for (int i = 0; i < length; i++) s += buf.readChar();//from w w w .j a v a 2 s . c om return getUUID(s); }
From source file:buildcraftAdditions.utils.Tank.java
License:GNU General Public License
@Override public ByteBuf readFromByteBuff(ByteBuf buf) { int id = buf.readInt(); int amount = buf.readInt(); NBTTagCompound tag = ByteBufUtils.readTag(buf); if (id < 0) setFluid(null);// w w w .j a v a 2 s. c om else setFluid(new FluidStack(id, amount, tag)); return buf; }
From source file:ch.ethz.globis.distindex.middleware.net.MiddlewareMessageDecoder.java
License:Open Source License
/** * Checks whether the bytes accumulated in the in Buffer constitute a full message sent * from the client. If that is the case, the message is copied to the out list and the * next handler is notified./*from w ww.j av a 2s . c om*/ * * @param ctx The Netty context associated with the channel. * @param in A Netty managed buffer that holds the accumulated received chunks. * @param out The list of objects to be passed to the next handler. * @throws Exception */ @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { if (in.readableBytes() < 4) { //need to know exactly how many bytes to read return; } if (bytesToRead == -1) { bytesToRead = in.readInt(); } if (in.readableBytes() == bytesToRead) { out.add(in.readBytes(in.readableBytes())); bytesToRead = -1; } }