當前位置: 首頁>>代碼示例>>Java>>正文


Java ByteBufUtils.writeItemStack方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:WanionCane,項目名稱:Avaritiaddons,代碼行數:10,代碼來源:InfinityChestSyncAllSlots.java

示例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);
}
 
開發者ID:WanionCane,項目名稱:Avaritiaddons,代碼行數:12,代碼來源:InfinityChestClick.java

示例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);
}
 
開發者ID:WanionCane,項目名稱:Avaritiaddons,代碼行數:8,代碼來源:InfinityChestSlotSync.java

示例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);
}
 
開發者ID:enhancedportals,項目名稱:enhancedportals,代碼行數:9,代碼來源:TileTransferItem.java

示例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);
}
 
開發者ID:enhancedportals,項目名稱:enhancedportals,代碼行數:12,代碼來源:PortalTextureManager.java

示例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();
    }
}
 
開發者ID:halvors,項目名稱:Electrometrics,代碼行數:34,代碼來源:NetworkHandler.java

示例7: writeSpawnData

import cpw.mods.fml.common.network.ByteBufUtils; //導入方法依賴的package包/類
@Override
public void writeSpawnData(ByteBuf buffer) {
	ByteBufUtils.writeItemStack(buffer, stack);
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:5,代碼來源:EntityLingeringEffect.java

示例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);
}
 
開發者ID:SleepyTrousers,項目名稱:EnderCore,代碼行數:7,代碼來源:PacketGhostSlot.java


注:本文中的cpw.mods.fml.common.network.ByteBufUtils.writeItemStack方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。