本文整理汇总了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);
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
}
示例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);
}
示例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 ( ) ;
}
}
示例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);
}
示例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 ( ) ;
}
}