本文整理汇总了Java中cpw.mods.fml.common.network.ByteBufUtils.writeItemStack方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBufUtils.writeItemStack方法的具体用法?Java ByteBufUtils.writeItemStack怎么用?Java ByteBufUtils.writeItemStack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cpw.mods.fml.common.network.ByteBufUtils
的用法示例。
在下文中一共展示了ByteBufUtils.writeItemStack方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(final ByteBuf buf)
{
ByteBufUtils.writeVarShort(buf, slotCount);
for (int i = 0; i < slotCount; i++) {
ByteBufUtils.writeItemStack(buf, itemStacks[i]);
ByteBufUtils.writeVarInt(buf, stackSizes[i], 5);
}
}
示例2: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(final ByteBuf buf)
{
ByteBufUtils.writeVarInt(buf, windowId, 4);
ByteBufUtils.writeVarShort(buf, slotNumber);
ByteBufUtils.writeVarInt(buf, mouseButton, 4);
ByteBufUtils.writeVarInt(buf, modifier, 4);
ByteBufUtils.writeItemStack(buf, itemStack);
ByteBufUtils.writeVarInt(buf, stackSize, 5);
ByteBufUtils.writeVarShort(buf, transactionID);
}
示例3: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(final ByteBuf buf)
{
ByteBufUtils.writeItemStack(buf, itemStack);
ByteBufUtils.writeVarShort(buf, slot);
ByteBufUtils.writeVarInt(buf, stackSize, 5);
}
示例4: writeToGui
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void writeToGui(ByteBuf buffer) {
if (stack != null) {
buffer.writeBoolean(true);
ByteBufUtils.writeItemStack(buffer, stack);
} else
buffer.writeBoolean(false);
}
示例5: writeToPacket
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
public void writeToPacket(ByteBuf buffer) {
buffer.writeInt(frameColour);
buffer.writeInt(portalColour);
buffer.writeInt(particleColour);
buffer.writeInt(particleType);
buffer.writeInt(customFrameTexture);
buffer.writeInt(customPortalTexture);
for (ItemStack element : inventory)
ByteBufUtils.writeItemStack(buffer, element);
}
示例6: 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();
}
}
示例7: writeSpawnData
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void writeSpawnData(ByteBuf buffer) {
ByteBufUtils.writeItemStack(buffer, stack);
}
示例8: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
super.toBytes(buf);
buf.writeShort(slot);
ByteBufUtils.writeItemStack(buf, stack);
}