Example usage for io.netty.buffer ByteBufInputStream readShort

List of usage examples for io.netty.buffer ByteBufInputStream readShort

Introduction

In this page you can find the example usage for io.netty.buffer ByteBufInputStream readShort.

Prototype

@Override
    public short readShort() throws IOException 

Source Link

Usage

From source file:de.sanandrew.mods.enderstuffp.network.packet.PacketBiomeChangerActions.java

License:Creative Commons License

@Override
public void process(ByteBufInputStream stream, ByteBuf rawData, INetHandler handler) throws IOException {
    EnumAction action = EnumAction.VALUES[stream.readByte()];
    World world = EnderStuffPlus.proxy.getWorld(handler);
    TileEntityBiomeChanger biomeChanger = (TileEntityBiomeChanger) world.getTileEntity(stream.readInt(),
            stream.readInt(), stream.readInt());

    if (biomeChanger == null) {
        return;// www . j a va 2  s.  c o  m
    }

    switch (action) {
    case ACTIVATE:
        biomeChanger.activate();
        break;
    case DEACTIVATE:
        biomeChanger.deactivate();
        break;
    case CHANGE_BIOME:
        biomeChanger.setCurrRange(stream.readByte());
        biomeChanger.changeBiome();
        biomeChanger.setCurrRange(biomeChanger.getCurrRange() + 1);
        break;
    case REPLACE_BLOCKS:
        biomeChanger.replaceBlocks(stream.readBoolean());
        break;
    case CHNG_MAX_RANGE:
        biomeChanger.setMaxRange(stream.readShort());
        break;
    case CHNG_PERIM_FORM:
        biomeChanger.perimForm = EnumPerimForm.VALUES[stream.readByte()];
        break;
    }
}