Example usage for io.netty.buffer ByteBufOutputStream writeShort

List of usage examples for io.netty.buffer ByteBufOutputStream writeShort

Introduction

In this page you can find the example usage for io.netty.buffer ByteBufOutputStream writeShort.

Prototype

@Override
    public void writeShort(int v) throws IOException 

Source Link

Usage

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  w w  .j  a  v a2  s . com
    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());
    }
}