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

The following examples show how to use cpw.mods.fml.common.network.ByteBufUtils#readUTF8String() . 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: ReactantContainer.java    From BigReactors with MIT License 6 votes vote down vote up
public void deserialize(ByteBuf buffer) {
	capacity = buffer.readInt();
	for(int i = 0; i < tankNames.length; i++) {
		tanks[i] = null;

		boolean hasReactant = buffer.readBoolean();
		if(hasReactant) {
			String reactantName = ByteBufUtils.readUTF8String(buffer);
			int amount = buffer.readInt();
			
			if(!Reactants.isKnown(reactantName)) {
				BRLog.warning("Read an unknown reactant <%s> from a network message; tank %s will remain empty", reactantName, tankNames[i]);
			}
			else {
				tanks[i] = new ReactantStack(reactantName, amount);
				levelAtLastUpdate[i] = amount;
			}
		}
	}
}
 
Example 2
Source File: PacketPlaySound.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fromBytes(ByteBuf buffer){
    super.fromBytes(buffer);
    sound = ByteBufUtils.readUTF8String(buffer);
    volume = buffer.readFloat();
    pitch = buffer.readFloat();
    bool = buffer.readBoolean();
}
 
Example 3
Source File: PacketAddChatMessage.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fromBytes(ByteBuf buffer){
    message = ByteBufUtils.readUTF8String(buffer);
    replacements = new String[buffer.readInt()];
    for(int i = 0; i < replacements.length; i++) {
        replacements[i] = ByteBufUtils.readUTF8String(buffer);
    }
}
 
Example 4
Source File: AmadronOfferCustom.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static AmadronOfferCustom loadFromBuf(ByteBuf buf){
    AmadronOfferCustom offer = new AmadronOfferCustom(PacketSyncAmadronOffers.getFluidOrItemStack(buf), PacketSyncAmadronOffers.getFluidOrItemStack(buf), ByteBufUtils.readUTF8String(buf), ByteBufUtils.readUTF8String(buf));
    if(buf.readBoolean()) {
        offer.setProvidingPosition(new ChunkPosition(buf.readInt(), buf.readInt(), buf.readInt()), buf.readInt());
    }
    if(buf.readBoolean()) {
        offer.setReturningPosition(new ChunkPosition(buf.readInt(), buf.readInt(), buf.readInt()), buf.readInt());
    }
    offer.inStock = buf.readInt();
    offer.maxTrades = buf.readInt();
    offer.pendingPayments = buf.readInt();
    return offer;
}
 
Example 5
Source File: PacketSpawnParticle.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fromBytes(ByteBuf buffer){
    super.fromBytes(buffer);
    particleName = ByteBufUtils.readUTF8String(buffer);
    dx = buffer.readDouble();
    dy = buffer.readDouble();
    dz = buffer.readDouble();
}
 
Example 6
Source File: CTTClientSyncMessage.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fromBytes( ByteBuf pBuffer )
{
  _mFrame = pBuffer.readInt();
  _mNumFrames = pBuffer.readInt();
  _mPayload = ByteBufUtils.readUTF8String( pBuffer );
}
 
Example 7
Source File: PacketAphorismTileUpdate.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fromBytes(ByteBuf buffer){
    super.fromBytes(buffer);
    int lines = buffer.readInt();
    text = new String[lines];
    for(int i = 0; i < lines; i++) {
        text[i] = ByteBufUtils.readUTF8String(buffer);
    }
}
 
Example 8
Source File: PacketUpdateTextfield.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buffer){
    super.fromBytes(buffer);
    textFieldID = buffer.readInt();
    text = ByteBufUtils.readUTF8String(buffer);
}
 
Example 9
Source File: PacketCommandGetGlobalVariableOutput.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf){
    varName = ByteBufUtils.readUTF8String(buf);
    pos = new ChunkPosition(buf.readInt(), buf.readInt(), buf.readInt());
    stack = ByteBufUtils.readItemStack(buf);
}
 
Example 10
Source File: PacketAmadronTradeNotifyDeal.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf){
    super.fromBytes(buf);
    offerAmount = buf.readInt();
    buyingPlayer = ByteBufUtils.readUTF8String(buf);
}
 
Example 11
Source File: PacketSetGlobalVariable.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf){
    varName = ByteBufUtils.readUTF8String(buf);
    value = new ChunkPosition(buf.readInt(), buf.readInt(), buf.readInt());
}
 
Example 12
Source File: PacketSetSemiBlock.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf){
    super.fromBytes(buf);
    id = ByteBufUtils.readUTF8String(buf);
}
 
Example 13
Source File: PacketChangeGPSToolCoordinate.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf){
    super.fromBytes(buf);
    variable = ByteBufUtils.readUTF8String(buf);
}
 
Example 14
Source File: PacketUpdateEntityFilter.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buffer){
    filter = ByteBufUtils.readUTF8String(buffer);
}
 
Example 15
Source File: DebugEntry.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public DebugEntry(ByteBuf buf){
    message = ByteBufUtils.readUTF8String(buf);
    pos = new ChunkPosition(buf.readInt(), buf.readInt(), buf.readInt());
    id = buf.readInt();
    progWidgetId = buf.readInt();
}
 
Example 16
Source File: EntityDrone.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void readSpawnData(ByteBuf data){
    playerName = ByteBufUtils.readUTF8String(data);
}
 
Example 17
Source File: MessageChiselMode.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
	this.mode = ByteBufUtils.readUTF8String(buf);
}
 
Example 18
Source File: ConfigMessage.java    From OmniOcular with Apache License 2.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
    text = ByteBufUtils.readUTF8String(buf);
}
 
Example 19
Source File: ControlRodChangeNameMessage.java    From BigReactors with MIT License 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
	super.fromBytes(buf);
    name = ByteBufUtils.readUTF8String(buf);
}
 
Example 20
Source File: MCPacket.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public String readString() {
	return ByteBufUtils.readUTF8String(buf);
}