Java Code Examples for cpw.mods.fml.common.network.ByteBufUtils#writeUTF8String()

The following examples show how to use cpw.mods.fml.common.network.ByteBufUtils#writeUTF8String() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AmadronOfferCustom.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
public void writeToBuf(ByteBuf buf){
    ByteBufUtils.writeUTF8String(buf, offeringPlayerName);
    ByteBufUtils.writeUTF8String(buf, offeringPlayerId);
    if(providingPosition != null) {
        buf.writeBoolean(true);
        buf.writeInt(providingPosition.chunkPosX);
        buf.writeInt(providingPosition.chunkPosY);
        buf.writeInt(providingPosition.chunkPosZ);
        buf.writeInt(providingDimensionId);
    } else {
        buf.writeBoolean(false);
    }
    if(returningPosition != null) {
        buf.writeBoolean(true);
        buf.writeInt(returningPosition.chunkPosX);
        buf.writeInt(returningPosition.chunkPosY);
        buf.writeInt(returningPosition.chunkPosZ);
        buf.writeInt(returningDimensionId);
    } else {
        buf.writeBoolean(false);
    }
    buf.writeInt(inStock);
    buf.writeInt(maxTrades);
    buf.writeInt(pendingPayments);
}
 
Example 2
Source File: DebugEntry.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public void toBytes(ByteBuf buf){
    ByteBufUtils.writeUTF8String(buf, message);
    buf.writeInt(pos.chunkPosX);
    buf.writeInt(pos.chunkPosY);
    buf.writeInt(pos.chunkPosZ);
    buf.writeInt(id);
    buf.writeInt(progWidgetId);
}
 
Example 3
Source File: PacketSetGlobalVariable.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void toBytes(ByteBuf buf){
    ByteBufUtils.writeUTF8String(buf, varName);
    buf.writeInt(value.chunkPosX);
    buf.writeInt(value.chunkPosY);
    buf.writeInt(value.chunkPosZ);
}
 
Example 4
Source File: PacketAddChatMessage.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void toBytes(ByteBuf buffer){
    ByteBufUtils.writeUTF8String(buffer, message);
    if(replacements != null) {
        buffer.writeInt(replacements.length);
        for(String replacement : replacements) {
            ByteBufUtils.writeUTF8String(buffer, replacement);
        }
    } else {
        buffer.writeInt(0);
    }
}
 
Example 5
Source File: PacketUpdateGui.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static void writeField(ByteBuf buf, Object value, int type){
    switch(type){
        case 0:
            buf.writeInt((Integer)value);
            break;
        case 1:
            buf.writeFloat((Float)value);
            break;
        case 2:
            buf.writeDouble((Double)value);
            break;
        case 3:
            buf.writeBoolean((Boolean)value);
            break;
        case 4:
            ByteBufUtils.writeUTF8String(buf, (String)value);
            break;
        case 5:
            buf.writeByte((Byte)value);
            break;
        case 6:
            ByteBufUtils.writeItemStack(buf, (ItemStack)value);
            break;
        case 7:
            buf.writeBoolean(value != null);
            if(value != null) {
                FluidStack stack = (FluidStack)value;
                ByteBufUtils.writeUTF8String(buf, stack.getFluid().getName());
                buf.writeInt(stack.amount);
                ByteBufUtils.writeTag(buf, stack.tag);
            }
            break;
    }
}
 
Example 6
Source File: PacketSetLogisticsFluidFilterStack.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void toBytes(ByteBuf buf){
    super.toBytes(buf);
    buf.writeBoolean(settingStack != null);
    if(settingStack != null) {
        ByteBufUtils.writeUTF8String(buf, settingStack.getFluid().getName());
        buf.writeInt(settingStack.amount);
        ByteBufUtils.writeTag(buf, settingStack.tag);
    }
    buf.writeInt(settingIndex);
}
 
Example 7
Source File: CTTClientSyncMessage.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void toBytes( ByteBuf pBuffer )
{
  pBuffer.writeInt( _mFrame );
  pBuffer.writeInt( _mNumFrames );
  ByteBufUtils.writeUTF8String( pBuffer, _mPayload );
}
 
Example 8
Source File: ReactantContainer.java    From BigReactors with MIT License 5 votes vote down vote up
public void serialize(ByteBuf buffer) {
	buffer.writeInt(capacity);
	for(int i = 0; i < tankNames.length; i++) {
		boolean hasReactant = getReactantAmount(i) > 0;
		buffer.writeBoolean(hasReactant);
		if(hasReactant) {
			ByteBufUtils.writeUTF8String(buffer, tanks[i].getName());
			buffer.writeInt(tanks[i].amount);
		}
	}
}
 
Example 9
Source File: ConfigMessage.java    From OmniOcular with Apache License 2.0 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buf) {
    ByteBufUtils.writeUTF8String(buf, text);
}
 
Example 10
Source File: MessageHandleTextUpdate.java    From AdvancedMod with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buf){
    super.toBytes(buf);
    buf.writeInt(id);
    ByteBufUtils.writeUTF8String(buf, text);
}
 
Example 11
Source File: PacketChangeGPSToolCoordinate.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buf){
    super.toBytes(buf);
    ByteBufUtils.writeUTF8String(buf, variable);
}
 
Example 12
Source File: PacketAmadronTradeNotifyDeal.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buf){
    super.toBytes(buf);
    buf.writeInt(offerAmount);
    ByteBufUtils.writeUTF8String(buf, buyingPlayer);
}
 
Example 13
Source File: PacketSecurityStation.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buffer){
    super.toBytes(buffer);
    ByteBufUtils.writeUTF8String(buffer, username);
}
 
Example 14
Source File: SetPlayerModelMessage.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buf) {
	ByteBufUtils.writeUTF8String(buf, playerName);
	buf.writeBoolean(isAlex);
}
 
Example 15
Source File: MCPacket.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public Packet writeString(String value) {
	ByteBufUtils.writeUTF8String(buf, value);
	return this;
}
 
Example 16
Source File: PacketNotifyVariablesRemote.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buf){
    buf.writeInt(variables.length);
    for(String s : variables)
        ByteBufUtils.writeUTF8String(buf, s);
}
 
Example 17
Source File: PacketUpdateEntityFilter.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buffer){
    ByteBufUtils.writeUTF8String(buffer, filter);
}
 
Example 18
Source File: PacketUpdateAirGrateModule.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buffer){
    super.toBytes(buffer);
    ByteBufUtils.writeUTF8String(buffer, entityFilter);
}
 
Example 19
Source File: PacketSetSemiBlock.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buf){
    super.toBytes(buf);
    ByteBufUtils.writeUTF8String(buf, id);
}
 
Example 20
Source File: ControlRodChangeNameMessage.java    From BigReactors with MIT License 4 votes vote down vote up
@Override
public void toBytes(ByteBuf buf) {
	super.toBytes(buf);
    ByteBufUtils.writeUTF8String(buf, name);
}