List of usage examples for io.netty.buffer ByteBuf writeInt
public abstract ByteBuf writeInt(int value);
From source file:appeng.core.sync.packets.PacketPaintedEntity.java
License:Open Source License
public PacketPaintedEntity(final int myEntity, final AEColor myColor, final int ticksLeft) { final ByteBuf data = Unpooled.buffer(); data.writeInt(this.getPacketID()); data.writeInt(this.entityId = myEntity); data.writeByte((this.myColor = myColor).ordinal()); data.writeInt(ticksLeft);//from w w w .j a v a 2 s .c o m this.configureWrite(data); }
From source file:appeng.core.sync.packets.PacketPartialItem.java
License:Open Source License
public PacketPartialItem(final int page, final int maxPages, final byte[] buf) { final ByteBuf data = Unpooled.buffer(); this.pageNum = (short) (page | (maxPages << 8)); this.data = buf; data.writeInt(this.getPacketID()); data.writeShort(this.pageNum); data.writeBytes(buf);//from w ww . ja va2 s.c om this.configureWrite(data); }
From source file:appeng.core.sync.packets.PacketPartPlacement.java
License:Open Source License
public PacketPartPlacement(final BlockPos pos, final EnumFacing face, final float eyeHeight, final EnumHand hand) { final ByteBuf data = Unpooled.buffer(); data.writeInt(this.getPacketID()); data.writeInt(pos.getX());// w ww . jav a 2 s . c o m data.writeInt(pos.getY()); data.writeInt(pos.getZ()); data.writeByte(face.ordinal()); data.writeFloat(eyeHeight); data.writeByte(hand.ordinal()); this.configureWrite(data); }
From source file:appeng.core.sync.packets.PacketPatternSlot.java
License:Open Source License
public PacketPatternSlot(final IInventory pat, final IAEItemStack slotItem, final boolean shift) throws IOException { this.slotItem = slotItem; this.shift = shift; final ByteBuf data = Unpooled.buffer(); data.writeInt(this.getPacketID()); data.writeBoolean(shift);/*from w ww .j ava2 s.co m*/ this.writeItem(slotItem, data); for (int x = 0; x < 9; x++) { this.pattern[x] = AEApi.instance().storage().createItemStack(pat.getStackInSlot(x)); this.writeItem(this.pattern[x], data); } this.configureWrite(data); }
From source file:appeng.core.sync.packets.PacketProgressBar.java
License:Open Source License
public PacketProgressBar(final int shortID, final long value) { this.id = (short) shortID; this.value = value; final ByteBuf data = Unpooled.buffer(); data.writeInt(this.getPacketID()); data.writeShort(shortID);//from ww w . j a v a2 s. co m data.writeLong(value); this.configureWrite(data); }
From source file:appeng.core.sync.packets.PacketSwapSlots.java
License:Open Source License
public PacketSwapSlots(final int slotA, final int slotB) { final ByteBuf data = Unpooled.buffer(); data.writeInt(this.getPacketID()); data.writeInt(this.slotA = slotA); data.writeInt(this.slotB = slotB); this.configureWrite(data); }
From source file:appeng.core.sync.packets.PacketSwitchGuis.java
License:Open Source License
public PacketSwitchGuis(final GuiBridge newGui) { this.newGui = newGui; if (Platform.isClient()) { AEBaseGui.setSwitchingGuis(true); }//from w w w . j ava 2s . co m final ByteBuf data = Unpooled.buffer(); data.writeInt(this.getPacketID()); data.writeInt(newGui.ordinal()); this.configureWrite(data); }
From source file:appeng.core.sync.packets.PacketTransitionEffect.java
License:Open Source License
public PacketTransitionEffect(final double x, final double y, final double z, final AEPartLocation dir, final boolean wasBlock) { this.x = x;/* w w w . ja v a 2 s . c o m*/ this.y = y; this.z = z; this.d = dir; this.mode = wasBlock; final ByteBuf data = Unpooled.buffer(); data.writeInt(this.getPacketID()); data.writeFloat((float) x); data.writeFloat((float) y); data.writeFloat((float) z); data.writeByte(this.d.ordinal()); data.writeBoolean(wasBlock); this.configureWrite(data); }
From source file:appeng.core.sync.packets.PacketValueConfig.java
License:Open Source License
public PacketValueConfig(final String name, final String value) throws IOException { this.Name = name; this.Value = value; final ByteBuf data = Unpooled.buffer(); data.writeInt(this.getPacketID()); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final DataOutputStream dos = new DataOutputStream(bos); dos.writeUTF(name);// www . j a v a 2s . c om dos.writeUTF(value); // dos.close(); data.writeBytes(bos.toByteArray()); this.configureWrite(data); }
From source file:appeng.facade.FacadeContainer.java
License:Open Source License
@Override public void writeToStream(final ByteBuf out) throws IOException { int facadeSides = 0; for (int x = 0; x < this.facades; x++) { if (this.getFacade(AEPartLocation.fromOrdinal(x)) != null) { facadeSides |= (1 << x); }/* ww w. j a v a 2s.co m*/ } out.writeByte((byte) facadeSides); for (int x = 0; x < this.facades; x++) { final IFacadePart part = this.getFacade(AEPartLocation.fromOrdinal(x)); if (part != null) { final int itemID = Item.getIdFromItem(part.getItem()); final int dmgValue = part.getItemDamage(); out.writeInt(itemID * (part.notAEFacade() ? -1 : 1)); out.writeInt(dmgValue); } } }