本文整理匯總了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);
}