当前位置: 首页>>代码示例>>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;未经允许,请勿转载。