当前位置: 首页>>代码示例>>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;未经允许,请勿转载。