List of usage examples for io.netty.buffer ByteBuf readByte
public abstract byte readByte();
From source file:appeng.parts.reporting.PartStorageMonitor.java
License:Open Source License
@Override public boolean readFromStream(ByteBuf data) throws IOException { boolean stuff = super.readFromStream(data); this.spin = data.readByte(); this.isLocked = data.readBoolean(); boolean val = data.readBoolean(); if (val) { this.configuredItem = AEItemStack.loadItemStackFromPacket(data); } else {/*w w w.j a v a2 s .c o m*/ this.configuredItem = null; } this.updateList = true; return stuff; }
From source file:appeng.tile.AEBaseTile.java
License:Open Source License
private final boolean readFromStream(final ByteBuf data) { boolean output = false; try {/* ww w . j a v a 2 s . com*/ if (this.canBeRotated()) { final EnumFacing old_Forward = this.forward; final EnumFacing old_Up = this.up; final byte orientation = data.readByte(); this.forward = EnumFacing.VALUES[orientation & 0x7]; this.up = EnumFacing.VALUES[orientation >> 3]; output = this.forward != old_Forward || this.up != old_Up; } this.renderFragment = 100; for (final AETileEventHandler h : this.getHandlerListFor(TileEventType.NETWORK_READ)) { if (h.readFromStream(this, data)) { output = true; } } if ((this.renderFragment & 1) == 1) { output = true; } this.renderFragment = 0; } catch (final Throwable t) { AELog.debug(t); } return output; }
From source file:appeng.tile.crafting.TileCraftingMonitorTile.java
License:Open Source License
@TileEvent(TileEventType.NETWORK_READ) public boolean readFromStream_TileCraftingMonitorTile(final ByteBuf data) throws IOException { final AEColor oldPaintedColor = this.paintedColor; this.paintedColor = AEColor.values()[data.readByte()]; final boolean hasItem = data.readBoolean(); if (hasItem) { this.dspPlay = AEItemStack.loadItemStackFromPacket(data); } else {//from w w w . j a v a2s . com this.dspPlay = null; } this.setUpdateList(true); return oldPaintedColor != this.paintedColor; // tesr! }
From source file:appeng.tile.misc.TileInscriber.java
License:Open Source License
@TileEvent(TileEventType.NETWORK_READ) public boolean readFromStream_TileInscriber(final ByteBuf data) throws IOException { final int slot = data.readByte(); final boolean oldSmash = this.isSmash(); final boolean newSmash = (slot & 64) == 64; if (oldSmash != newSmash && newSmash) { this.setSmash(true); this.setClientStart(System.currentTimeMillis()); }/* w w w. ja v a 2s. c o m*/ for (int num = 0; num < this.inv.getSizeInventory(); num++) { if ((slot & (1 << num)) > 0) { this.inv.setInventorySlotContents(num, AEItemStack.loadItemStackFromPacket(data).getItemStack()); } else { this.inv.setInventorySlotContents(num, null); } } return false; }
From source file:appeng.tile.misc.TilePaint.java
License:Open Source License
private void readBuffer(final ByteBuf in) { final byte howMany = in.readByte(); if (howMany == 0) { this.isLit = 0; this.dots = null; return;// ww w. j av a 2 s. co m } this.dots = new ArrayList(howMany); for (int x = 0; x < howMany; x++) { this.dots.add(new Splotch(in)); } this.isLit = 0; for (final Splotch s : this.dots) { if (s.isLumen()) { this.isLit += LIGHT_PER_DOT; } } this.maxLit(); }
From source file:appeng.tile.misc.TileSecurity.java
License:Open Source License
@TileEvent(TileEventType.NETWORK_READ) public boolean readFromStream_TileSecurity(final ByteBuf data) { final boolean wasActive = this.isActive; this.isActive = data.readBoolean(); final AEColor oldPaintedColor = this.paintedColor; this.paintedColor = AEColor.values()[data.readByte()]; return oldPaintedColor != this.paintedColor || wasActive != this.isActive; }
From source file:appeng.tile.networking.TileWireless.java
License:Open Source License
@TileEvent(TileEventType.NETWORK_READ) public boolean readFromStream_TileWireless(final ByteBuf data) { final int old = this.getClientFlags(); this.setClientFlags(data.readByte()); return old != this.getClientFlags(); }
From source file:appeng.tile.qnb.TileQuantumBridge.java
License:Open Source License
@TileEvent(TileEventType.NETWORK_READ) public boolean onNetworkReadEvent(final ByteBuf data) { final int oldValue = this.constructed; this.constructed = data.readByte(); return this.constructed != oldValue; }
From source file:appeng.tile.spatial.TileSpatialPylon.java
License:Open Source License
@TileEvent(TileEventType.NETWORK_READ) public boolean readFromStream_TileSpatialPylon(final ByteBuf data) { final int old = this.displayBits; this.displayBits = data.readByte(); return old != this.displayBits; }
From source file:appeng.tile.storage.TileChest.java
License:Open Source License
@TileEvent(TileEventType.NETWORK_READ) public boolean readFromStream_TileChest(final ByteBuf data) { final int oldState = this.state; final ItemStack oldType = this.storageType; this.state = data.readByte(); final AEColor oldPaintedColor = this.paintedColor; this.paintedColor = AEColor.values()[data.readByte()]; final int item = data.readInt(); if (item == 0) { this.storageType = null; } else {// w w w. ja v a 2s. c o m this.storageType = new ItemStack(Item.getItemById(item & 0xffff), 1, item >> Platform.DEF_OFFSET); } this.lastStateChange = this.worldObj.getTotalWorldTime(); return oldPaintedColor != this.paintedColor || (this.state & 0xDB6DB6DB) != (oldState & 0xDB6DB6DB) || !Platform.itemComparisons().isSameItem(oldType, this.storageType); }