當前位置: 首頁>>代碼示例>>Java>>正文


Java ByteBufUtils.writeUTF8String方法代碼示例

本文整理匯總了Java中cpw.mods.fml.common.network.ByteBufUtils.writeUTF8String方法的典型用法代碼示例。如果您正苦於以下問題:Java ByteBufUtils.writeUTF8String方法的具體用法?Java ByteBufUtils.writeUTF8String怎麽用?Java ByteBufUtils.writeUTF8String使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cpw.mods.fml.common.network.ByteBufUtils的用法示例。


在下文中一共展示了ByteBufUtils.writeUTF8String方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: write

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void write( ByteBuf buffer )
{
	buffer.writeInt( data.size() );
	
	Iterator< Entry< UUID, PetData > > it = data.entrySet().iterator();
	while ( it.hasNext() )
	{
		Entry< UUID, PetData > entry = it.next();
		
		UUID id = entry.getKey();
		PetData pet = entry.getValue();
		
		buffer.writeLong( id.getMostSignificantBits() );
		buffer.writeLong( id.getLeastSignificantBits() );
		
		buffer.writeInt( pet.dim );
		buffer.writeInt( pet.pos.x );
		buffer.writeInt( pet.pos.y );
		buffer.writeInt( pet.pos.z );

		ByteBufUtils.writeUTF8String( buffer, pet.name );
		ByteBufUtils.writeUTF8String( buffer, pet.tex );
		buffer.writeInt( pet.level );
	}
}
 
開發者ID:spacechase0,項目名稱:UsefulPets,代碼行數:27,代碼來源:TrackingDataPacket.java

示例2: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buffer)
{
    super.toBytes(buffer);
    ByteBufUtils.writeVarInt(buffer, modTags.size(), 2);
    for (Map.Entry<String,String> modTag: modTags.entrySet())
    {
        ByteBufUtils.writeUTF8String(buffer, modTag.getKey());
        ByteBufUtils.writeUTF8String(buffer, modTag.getValue());
    }
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:12,代碼來源:FMLHandshakeMessage.java

示例3: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
void toBytes(ByteBuf buf)
{
    buf.writeInt(windowId);
    ByteBufUtils.writeUTF8String(buf, modId);
    buf.writeInt(modGuiId);
    buf.writeInt(x);
    buf.writeInt(y);
    buf.writeInt(z);
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:11,代碼來源:FMLMessage.java

示例4: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buf) {

    ByteBufUtils.writeUTF8String(buf, Name);
    buf.writeDouble(X);
    buf.writeDouble(Y);
    buf.writeDouble(Z);

}
 
開發者ID:evshiron,項目名稱:IngressCraft,代碼行數:10,代碼來源:MessageCreatePortal.java

示例5: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buf)
{
    ByteBufUtils.writeVarInt(buf,x,5);
    ByteBufUtils.writeVarInt(buf,y,5);
    ByteBufUtils.writeVarInt(buf,z,5);
    ByteBufUtils.writeVarInt(buf,direction,1);
    ByteBufUtils.writeVarInt(buf,isFilling,1);
    ByteBufUtils.writeUTF8String(buf,fluidName);
    ByteBufUtils.writeVarInt(buf,amount,5);
    ByteBufUtils.writeVarInt(buf,size,1);
}
 
開發者ID:M4thG33k,項目名稱:M4thThings,代碼行數:13,代碼來源:PacketFilling.java

示例6: writeString

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
private void writeString(ByteBuf buf, String string) {
    if (string == null) {
        buf.writeBoolean(false);
        return;
    }

    buf.writeBoolean(true);
    ByteBufUtils.writeUTF8String(buf, string);
}
 
開發者ID:CannibalVox,項目名稱:McDiscord,代碼行數:10,代碼來源:UpdateServerPacket.java

示例7: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void toBytes( ByteBuf pBuffer )
{
  pBuffer.writeInt( _mFrame );
  pBuffer.writeInt( _mNumFrames );
  ByteBufUtils.writeUTF8String( pBuffer, _mPayload );
}
 
開發者ID:GTNewHorizons,項目名稱:NewHorizonsCoreMod,代碼行數:8,代碼來源:CTTClientSyncMessage.java

示例8: writeSpawnData

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void writeSpawnData(ByteBuf buffer) {

    ByteBufUtils.writeUTF8String(buffer, String.valueOf(Level));
    ByteBufUtils.writeUTF8String(buffer, String.valueOf(Faction));
    ByteBufUtils.writeUTF8String(buffer, Owner);

}
 
開發者ID:evshiron,項目名稱:IngressCraft,代碼行數:9,代碼來源:EntityResonator.java

示例9: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buf) {
    ByteBufUtils.writeUTF8String(buf, identifier);
    buf.writeInt(index);
    ByteBufUtils.writeUTF8String(buf, title);
    buf.writeLong(created.getTime());
    ByteBufUtils.writeUTF8String(buf, author);
    buf.writeLong(lastModified.getTime());
    ByteBufUtils.writeUTF8String(buf, lastContributor);
    ByteBufUtils.writeUTF8String(buf, contents);
}
 
開發者ID:AlmuraDev,項目名稱:Guide-Legacy,代碼行數:12,代碼來源:S00PageInformation.java

示例10: writeSpawnData

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void writeSpawnData(ByteBuf buffer) {

    ByteBufUtils.writeUTF8String(buffer, UUID);
    ByteBufUtils.writeUTF8String(buffer, Name);
    ByteBufUtils.writeUTF8String(buffer, String.valueOf(Faction));
    ByteBufUtils.writeUTF8String(buffer, Owner);

}
 
開發者ID:evshiron,項目名稱:IngressCraft,代碼行數:10,代碼來源:EntityPortal.java

示例11: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buf) {
	super.toBytes(buf);
	buf.writeInt(relX);
	buf.writeInt(relY);
	buf.writeInt(relZ);
	ByteBufUtils.writeUTF8String(buf, name);
}
 
開發者ID:thraaawn,項目名稱:CCFactoryManager,代碼行數:9,代碼來源:MessageNameChange.java

示例12: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buf) {

    ByteBufUtils.writeUTF8String(buf, Codename);
    buf.writeInt(Faction);
    buf.writeInt(Level);
    buf.writeInt(AP);
    buf.writeInt(XM);

}
 
開發者ID:evshiron,項目名稱:IngressCraft,代碼行數:11,代碼來源:MessageSyncScanner.java

示例13: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buf) {
	buf.writeInt(x);
	buf.writeInt(y);
	buf.writeInt(z);
	buf.writeInt(val);
       ByteBufUtils.writeUTF8String(buf, componentName);
}
 
開發者ID:NotGyro,項目名稱:WeirdScience,代碼行數:9,代碼來源:MessageTileIntComponent.java

示例14: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buffer)
{
    ByteBufUtils.writeVarInt(buffer, modIds.size(), 3);
    for (Entry<String, Integer> entry: modIds.entrySet())
    {
        ByteBufUtils.writeUTF8String(buffer, entry.getKey());
        ByteBufUtils.writeVarInt(buffer, entry.getValue(), 3);
    }
}
 
開發者ID:alexandrage,項目名稱:CauldronGit,代碼行數:11,代碼來源:FMLHandshakeMessage.java

示例15: testByteBufUtilsStrings

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Test
public void testByteBufUtilsStrings()
{
    String test = new String("test");
    ByteBuf buf = Unpooled.buffer(20, 20);
    ByteBufUtils.writeUTF8String(buf, test);
    assertArrayEquals("String bytes", new byte[] { 4, 116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, buf.array());

    String repeat = Strings.repeat("test", 100);
    buf = Unpooled.buffer(420, 420);
    ByteBufUtils.writeUTF8String(buf, repeat);
    assertArrayEquals("String repeat bytes", new byte[] {-112, 3, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, buf.array());
}
 
開發者ID:alexandrage,項目名稱:CauldronGit,代碼行數:14,代碼來源:TestNetStuff.java


注:本文中的cpw.mods.fml.common.network.ByteBufUtils.writeUTF8String方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。