當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。