Example usage for io.netty.buffer ByteBufOutputStream writeUTF

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

Introduction

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

Prototype

@Override
    public void writeUTF(String s) throws IOException 

Source Link

Usage

From source file:de.sanandrew.mods.claysoldiers.network.packet.PacketParticleFX.java

License:Creative Commons License

@Override
public void writeData(ByteBufOutputStream stream, Tuple dataTuple) throws IOException {
    EnumParticleFx fxType = (EnumParticleFx) dataTuple.getValue(0);
    stream.writeByte(fxType.ordinalByte());
    switch (fxType) {
    case FX_BREAK: // FALL_THROUGH
    case FX_SOLDIER_DEATH: // FALL_THROUGH
    case FX_DIGGING:
        stream.writeDouble((double) dataTuple.getValue(1));
        stream.writeDouble((double) dataTuple.getValue(2));
        stream.writeDouble((double) dataTuple.getValue(3));
        stream.writeUTF((String) dataTuple.getValue(4));
        break;/*from   ww  w.ja v  a  2  s . co  m*/
    case FX_CRIT: // FALL_THROUGH
    case FX_SHOCKWAVE: // FALL_THROUGH
    case FX_MAGMAFUSE:
        stream.writeDouble((double) dataTuple.getValue(1));
        stream.writeDouble((double) dataTuple.getValue(2));
        stream.writeDouble((double) dataTuple.getValue(3));
        break;
    case FX_HORSE_DEATH: // FALL_THROUGH
    case FX_BUNNY_DEATH: // FALL_THROUGH
    case FX_TURTLE_DEATH:
        stream.writeDouble((double) dataTuple.getValue(1));
        stream.writeDouble((double) dataTuple.getValue(2));
        stream.writeDouble((double) dataTuple.getValue(3));
        stream.writeByte((byte) dataTuple.getValue(4));
        break;
    case FX_SPELL:
        stream.writeDouble((double) dataTuple.getValue(1));
        stream.writeDouble((double) dataTuple.getValue(2));
        stream.writeDouble((double) dataTuple.getValue(3));
        stream.writeDouble((double) dataTuple.getValue(4));
        stream.writeDouble((double) dataTuple.getValue(5));
        stream.writeDouble((double) dataTuple.getValue(6));
        break;
    }
}

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

License:Creative Commons License

@Override
public void writeData(ByteBufOutputStream stream, Tuple dataTuple) throws IOException {
    stream.writeInt((int) dataTuple.getValue(0));
    stream.writeByte((byte) dataTuple.getValue(1));

    if (dataTuple.getSize() == 3) {
        stream.writeUTF((String) dataTuple.getValue(2));
    }//from ww  w  . j  av a 2  s.c om
}

From source file:de.sanandrew.mods.turretmod.network.packet.PacketEjectUpgrade.java

License:Creative Commons License

@Override
public void writeData(ByteBufOutputStream stream, Tuple data) throws IOException {
    stream.writeInt((Integer) data.getValue(0));
    stream.writeUTF((String) data.getValue(1));
}

From source file:de.sanandrew.mods.turretmod.network.packet.PacketSendMultiTargetFlag.java

License:Creative Commons License

@Override
public void writeData(ByteBufOutputStream stream, Tuple data) throws IOException {
    stream.writeInt((Integer) data.getValue(0));
    try {//from  w ww  . j a v a  2  s  .c  o m
        @SuppressWarnings("unchecked")
        Map<Class<? extends EntityLiving>, Boolean> newTargetStg = (Map<Class<? extends EntityLiving>, Boolean>) data
                .getValue(1);
        stream.writeInt(newTargetStg.size());
        for (Entry<Class<? extends EntityLiving>, Boolean> newTgts : newTargetStg.entrySet()) {
            stream.writeUTF((String) EntityList.classToStringMapping.get(newTgts.getKey()));
            stream.writeBoolean(newTgts.getValue());
        }
    } catch (ClassCastException ex) {
        TurretMod.MOD_LOG.log(Level.WARN, "Cannot send multi-target list to server! An entry is invalid!");
        throw new IOException(ex);
    }
}

From source file:de.sanandrew.mods.turretmod.network.packet.PacketSendTargetFlag.java

License:Creative Commons License

@Override
public void writeData(ByteBufOutputStream stream, Tuple data) throws IOException {
    stream.writeInt((Integer) data.getValue(0));
    stream.writeUTF((String) data.getValue(1));
    stream.writeBoolean((Boolean) data.getValue(2));
}

From source file:de.sanandrew.mods.turretmod.network.packet.PacketTargetList.java

License:Creative Commons License

@Override
@SuppressWarnings("unchecked")
public void writeData(ByteBufOutputStream outStream, Tuple data) throws IOException {
    List<Class<? extends EntityLiving>> applicableTargets = (List<Class<? extends EntityLiving>>) data
            .getValue(1);//from  www.  j  av  a  2 s  . c  o m
    outStream.writeInt((Integer) data.getValue(0));
    outStream.writeInt(applicableTargets.size());
    for (Class targetCls : applicableTargets) {
        outStream.writeUTF((String) EntityList.classToStringMapping.get(targetCls));
    }
}

From source file:de.sanandrew.mods.turretmod.network.packet.PacketUpgradeList.java

License:Creative Commons License

@Override
@SuppressWarnings("unchecked")
public void writeData(ByteBufOutputStream outStream, Tuple data) throws IOException {
    List<TurretUpgrade> upgrades = (List<TurretUpgrade>) data.getValue(1);
    outStream.writeInt((Integer) data.getValue(0));
    outStream.writeInt(upgrades.size());
    for (TurretUpgrade upg : upgrades) {
        outStream.writeUTF(TurretUpgradeRegistry.getRegistrationName(upg));
    }//from   www . j  a v  a2  s .c  om
}

From source file:net.mcsproject.daemon.network.packets.PacketAuth.java

License:Open Source License

@Override
public void write(ByteBufOutputStream byteBuf) throws IOException {
    byteBuf.writeUTF(apiKey);
}

From source file:net.mcsproject.daemon.network.packets.PacketAuthResponse.java

License:Open Source License

@Override
public void write(ByteBufOutputStream byteBuf) throws IOException {
    byteBuf.writeBoolean(this.ok);
    byteBuf.writeInt(this.minPort);
    byteBuf.writeInt(this.maxPort);
    byteBuf.writeUTF(this.resources);
}

From source file:net.mcsproject.daemon.network.packets.PacketRequest.java

License:Open Source License

@Override
public void write(ByteBufOutputStream byteBuf) throws IOException {
    byteBuf.writeUTF(this.resourceType);
    byteBuf.writeUTF(this.resourceName);
}