当前位置: 首页>>代码示例>>Java>>正文


Java ByteBufUtils.writeTag方法代码示例

本文整理汇总了Java中cpw.mods.fml.common.network.ByteBufUtils.writeTag方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBufUtils.writeTag方法的具体用法?Java ByteBufUtils.writeTag怎么用?Java ByteBufUtils.writeTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cpw.mods.fml.common.network.ByteBufUtils的用法示例。


在下文中一共展示了ByteBufUtils.writeTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf)
{
    NBTTagCompound data = new NBTTagCompound();
    data.setInteger("x", x);
    data.setInteger("y", y);
    data.setInteger("z", z);
    data.setBoolean("once", once);
    ByteBufUtils.writeTag(buf, data);
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:11,代码来源:PacketSetTransferMode.java

示例2: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) 
{
 ByteBufUtils.writeVarInt(buf, entityId, 4);
 ByteBufUtils.writeTag(buf, entitySyncDataCompound);
    // DEBUG
    System.out.println("toBytes encoded");
}
 
开发者ID:jtrent238,项目名称:PopularMMOS-EpicProportions-Mod,代码行数:9,代码来源:MessageSyncEntityToServer.java

示例3: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	NBTTagCompound tag = new NBTTagCompound();
	tag.setLong("startTime", startTime);
	tag.setInteger("time", time);
	tag.setString("uuid", profile.getId().toString());
	tag.setString("name", profile.getName());
	ByteBufUtils.writeTag(buf, tag);
}
 
开发者ID:austinv11,项目名称:CollectiveFramework,代码行数:10,代码来源:TimeUpdatePacket.java

示例4: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	NBTTagCompound tag = new NBTTagCompound();
	tag.setInteger("dim", world.provider.dimensionId);
	tag.setInteger("x", x);
	tag.setInteger("y", y);
	tag.setInteger("z", z);
	tag.setTag("tag", updateData);
	ByteBufUtils.writeTag(buf, tag);
}
 
开发者ID:austinv11,项目名称:CollectiveFramework,代码行数:11,代码来源:TileEntityClientUpdatePacket.java

示例5: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
    NBTTagCompound tag = new NBTTagCompound();
    NBTTagList tagList = new NBTTagList();
    for (ItemStack stack : knownTransmutations) {
        if (stack != null) {
            NBTTagCompound itemTag = new NBTTagCompound();
            stack.writeToNBT(itemTag);
            tagList.appendTag(itemTag);
        }
    }
    tag.setTag("KnownItems", tagList);
    ByteBufUtils.writeTag(buf, tag);
}
 
开发者ID:Lomeli12,项目名称:WIIEMC,代码行数:15,代码来源:MessageKnowledge.java

示例6: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	NBTTagCompound tag = new NBTTagCompound();
	tag.setBoolean("isEntity", isEntity);
	tag.setInteger("player", player.getEntityId());
	tag.setInteger("dim", world.provider.dimensionId);
	if (isEntity)
		tag.setInteger("entityId", entityId);
	else {
		tag.setInteger("x", x);
		tag.setInteger("y", y);
		tag.setInteger("z", z);
	}
	ByteBufUtils.writeTag(buf, tag);
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:16,代码来源:TransmutePacket.java

示例7: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	NBTTagCompound tag = new NBTTagCompound();
	tag.setInteger("dim", world.provider.dimensionId);
	tag.setDouble("x", x);
	tag.setDouble("y", y);
	tag.setDouble("z", z);
	ByteBufUtils.writeTag(buf, tag);
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:10,代码来源:DartCraftEffectPacket.java

示例8: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	NBTTagCompound tag = new NBTTagCompound();
	tag.setString("player", player);
	tag.setInteger("type", buttonType.ordinal());
	tag.setInteger("dim", world.provider.dimensionId);
	ByteBufUtils.writeTag(buf, tag);
}
 
开发者ID:austinv11,项目名称:DartCraft2,代码行数:9,代码来源:ClipboardButtonPressPacket.java

示例9: writeDescPacket

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void writeDescPacket(ByteBuf buf)
{
    buf.writeBoolean(machineCore != null);
    if (machineCore != null)
    {
        ByteBufUtils.writeTag(buf, writeMachineNBT(new NBTTagCompound()));
    }
    //TODO write machine sides
    //TODO write connections
    markRender();
}
 
开发者ID:BuiltBrokenModding,项目名称:BasicIndustry,代码行数:13,代码来源:TileDynamicMachine.java

示例10: writeSpawnData

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void writeSpawnData(ByteBuf buffer) {
	
	NBTTagCompound nbt = new NBTTagCompound();		
	writeEntityToNBT(nbt);		
	ByteBufUtils.writeTag(buffer, nbt);
}
 
开发者ID:TeamMonumental,项目名称:FusionWarfare,代码行数:8,代码来源:EntityRocket.java

示例11: writeObject

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
public static void writeObject(Object object, ByteBuf dataStream) {
    try {
        // Language types.
        if (object instanceof Boolean) {
            dataStream.writeBoolean((Boolean) object);
        } else if (object instanceof Byte) {
            dataStream.writeByte((Byte) object);
        } else if (object instanceof byte[]) {
            dataStream.writeBytes((byte[]) object);
        } else if (object instanceof Double) {
            dataStream.writeDouble((Double) object);
        } else if (object instanceof Float) {
            dataStream.writeFloat((Float) object);
        } else if (object instanceof Integer) {
            dataStream.writeInt((Integer) object);
        } else if (object instanceof int[]) {
            for (int i : (int[]) object) {
                dataStream.writeInt(i);
            }
        } else if (object instanceof Long) {
            dataStream.writeLong((Long) object);
        } else if (object instanceof String) {
            ByteBufUtils.writeUTF8String(dataStream, (String) object);
        } else if (object instanceof ItemStack) {
            ByteBufUtils.writeItemStack(dataStream, (ItemStack) object);
        } else if (object instanceof NBTTagCompound) {
            ByteBufUtils.writeTag(dataStream, (NBTTagCompound) object);
        }
    } catch (Exception e) {
        Electrometrics.getLogger().error("An error occurred when sending packet data.");
        e.printStackTrace();
    }
}
 
开发者ID:halvors,项目名称:Electrometrics,代码行数:34,代码来源:NetworkHandler.java

示例12: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf)
{
    for (int i=0;i<3;i++)
    {
        ByteBufUtils.writeVarInt(buf,location[i],5);
    }

    ByteBufUtils.writeTag(buf,tagCompound);
}
 
开发者ID:M4thG33k,项目名称:M4thThings,代码行数:11,代码来源:PacketNBT.java

示例13: toBytes

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override 
  public void toBytes ( ByteBuf buf ) {
  	
  	try {

  		buf . writeBoolean ( is != null ) ;
  		
  		if ( is != null ) {
  			
   		NBTTagCompound data = new NBTTagCompound ( ) ;
   		
   		is . writeToNBT ( data ) ;
   		
           ByteBufUtils . writeTag ( buf, data ) ;
		
           data = null ;
           
  		}
  		
} catch ( Exception ex ) {
	
	ex . printStackTrace ( ) ;
	
}
  	
  }
 
开发者ID:Pishka,项目名称:MineDonate,代码行数:27,代码来源:ItemMergedPacket.java

示例14: write

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
  public void write(ByteBuf buf) {
  	
  	super.write(buf);
  	
      buf.writeInt(cost);
      
      try {
	
      	Utils . netWriteString ( buf, name ) ;
	
} catch ( Exception ex ) {
	
	ex . printStackTrace ( ) ;
	
}
      
      buf.writeInt(limit);
      ByteBufUtils.writeTag(buf, stack_data);
  }
 
开发者ID:Pishka,项目名称:MineDonate,代码行数:21,代码来源:ItemInfo.java

示例15: write

import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
  public void write(ByteBuf buf) {
  	
      super.write(buf);
              
      try {
	
          buf.writeInt(cost);

      	Utils . netWriteString ( buf, name ) ;
       
       ByteBufUtils.writeTag(buf, entity_data);
       buf.writeInt(limit);

      	Utils . netWriteString ( buf, classpath ) ;
	
} catch ( Exception ex ) {
	
	ex . printStackTrace ( ) ;
	
}
      
  }
 
开发者ID:Pishka,项目名称:MineDonate,代码行数:24,代码来源:EntityInfo.java


注:本文中的cpw.mods.fml.common.network.ByteBufUtils.writeTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。