Example usage for io.netty.buffer ByteBuf readInt

List of usage examples for io.netty.buffer ByteBuf readInt

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf readInt.

Prototype

public abstract int readInt();

Source Link

Document

Gets a 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer.

Usage

From source file:appeng.core.sync.packets.PacketConfigButton.java

License:Open Source License

@Reflected
public PacketConfigButton(final ByteBuf stream) {
    this.option = Settings.values()[stream.readInt()];
    this.rotationDirection = stream.readBoolean();
}

From source file:appeng.core.sync.packets.PacketInventoryAction.java

License:Open Source License

public PacketInventoryAction(final ByteBuf stream) throws IOException {
    this.action = InventoryAction.values()[stream.readInt()];
    this.slot = stream.readInt();
    this.id = stream.readLong();
    final boolean hasItem = stream.readBoolean();
    if (hasItem) {
        this.slotItem = AEItemStack.loadItemStackFromPacket(stream);
    } else {//from www .j  a  va 2s  .  com
        this.slotItem = null;
    }
}

From source file:appeng.core.sync.packets.PacketNewStorageDimension.java

License:Open Source License

public PacketNewStorageDimension(final ByteBuf stream) {
    this.newDim = stream.readInt();
}

From source file:appeng.core.sync.packets.PacketPaintedEntity.java

License:Open Source License

public PacketPaintedEntity(final ByteBuf stream) {
    this.entityId = stream.readInt();
    this.myColor = AEColor.values()[stream.readByte()];
    this.ticks = stream.readInt();
}

From source file:appeng.core.sync.packets.PacketPartPlacement.java

License:Open Source License

public PacketPartPlacement(final ByteBuf stream) {
    this.x = stream.readInt();
    this.y = stream.readInt();
    this.z = stream.readInt();
    this.face = stream.readByte();
    this.eyeHeight = stream.readFloat();
    this.hand = EnumHand.values()[stream.readByte()];
}

From source file:appeng.core.sync.packets.PacketSwapSlots.java

License:Open Source License

public PacketSwapSlots(final ByteBuf stream) {
    this.slotA = stream.readInt();
    this.slotB = stream.readInt();
}

From source file:appeng.core.sync.packets.PacketSwitchGuis.java

License:Open Source License

public PacketSwitchGuis(final ByteBuf stream) {
    this.newGui = GuiBridge.values()[stream.readInt()];
}

From source file:appeng.facade.FacadeContainer.java

License:Open Source License

@Override
public boolean readFromStream(final ByteBuf out) throws IOException {
    final int facadeSides = out.readByte();

    boolean changed = false;

    final int[] ids = new int[2];
    for (int x = 0; x < this.facades; x++) {
        final AEPartLocation side = AEPartLocation.fromOrdinal(x);
        final int ix = (1 << x);
        if ((facadeSides & ix) == ix) {
            ids[0] = out.readInt();
            ids[1] = out.readInt();//from  w  w w  . ja  v a  2 s  .  co  m
            ids[0] = Math.abs(ids[0]);

            Optional<Item> maybeFacadeItem = AEApi.instance().definitions().items().facade().maybeItem();
            if (maybeFacadeItem.isPresent()) {
                final ItemFacade ifa = (ItemFacade) maybeFacadeItem.get();
                final ItemStack facade = ifa.createFromIDs(ids);
                if (facade != null) {
                    changed = changed || this.storage.getFacade(x) == null;
                    this.storage.setFacade(x, ifa.createPartFromItemStack(facade, side));
                }
            }
        } else {
            changed = changed || this.storage.getFacade(x) != null;
            this.storage.setFacade(x, null);
        }
    }

    return changed;
}

From source file:appeng.parts.p2p.PartP2PLight.java

License:Open Source License

@Override
public boolean readFromStream(final ByteBuf data) throws IOException {
    super.readFromStream(data);
    this.lastValue = data.readInt();
    this.setOutput(this.lastValue > 0);
    return false;
}

From source file:appeng.tile.grindstone.TileCrank.java

License:Open Source License

@TileEvent(TileEventType.NETWORK_READ)
public boolean readFromStream_TileCrank(final ByteBuf data) {
    this.rotation = data.readInt();
    return false;
}