当前位置: 首页>>代码示例>>Java>>正文


Java PacketBuffer.writeItemStackToBuffer方法代码示例

本文整理汇总了Java中net.minecraft.network.PacketBuffer.writeItemStackToBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java PacketBuffer.writeItemStackToBuffer方法的具体用法?Java PacketBuffer.writeItemStackToBuffer怎么用?Java PacketBuffer.writeItemStackToBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.network.PacketBuffer的用法示例。


在下文中一共展示了PacketBuffer.writeItemStackToBuffer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeToBuf

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
public void writeToBuf(PacketBuffer buffer)
{
    buffer.writeByte((byte)(this.size() & 255));

    for (int i = 0; i < this.size(); ++i)
    {
        MerchantRecipe merchantrecipe = (MerchantRecipe)this.get(i);
        buffer.writeItemStackToBuffer(merchantrecipe.getItemToBuy());
        buffer.writeItemStackToBuffer(merchantrecipe.getItemToSell());
        ItemStack itemstack = merchantrecipe.getSecondItemToBuy();
        buffer.writeBoolean(itemstack != null);

        if (itemstack != null)
        {
            buffer.writeItemStackToBuffer(itemstack);
        }

        buffer.writeBoolean(merchantrecipe.isRecipeDisabled());
        buffer.writeInt(merchantrecipe.getToolUses());
        buffer.writeInt(merchantrecipe.getMaxTradeUses());
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:MerchantRecipeList.java

示例2: writeToBuf

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
public void writeToBuf(PacketBuffer buffer)
{
    buffer.writeByte((byte)(this.size() & 255));

    for (int i = 0; i < this.size(); ++i)
    {
        MerchantRecipe merchantrecipe = (MerchantRecipe)this.get(i);
        buffer.writeItemStackToBuffer(merchantrecipe.getItemToBuy());
        buffer.writeItemStackToBuffer(merchantrecipe.getItemToSell());
        ItemStack itemstack = merchantrecipe.getSecondItemToBuy();
        buffer.writeBoolean(!itemstack.func_190926_b());

        if (!itemstack.func_190926_b())
        {
            buffer.writeItemStackToBuffer(itemstack);
        }

        buffer.writeBoolean(merchantrecipe.isRecipeDisabled());
        buffer.writeInt(merchantrecipe.getToolUses());
        buffer.writeInt(merchantrecipe.getMaxTradeUses());
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:MerchantRecipeList.java

示例3: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeByte(this.windowId);
    buf.writeShort(this.slot);
    buf.writeItemStackToBuffer(this.item);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:S2FPacketSetSlot.java

示例4: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeByte(this.windowId);
    buf.writeShort(this.slotId);
    buf.writeByte(this.usedButton);
    buf.writeShort(this.actionNumber);
    buf.writeEnumValue(this.mode);
    buf.writeItemStackToBuffer(this.clickedItem);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:CPacketClickWindow.java

示例5: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeByte(this.windowId);
    buf.writeShort(this.slotId);
    buf.writeByte(this.usedButton);
    buf.writeShort(this.actionNumber);
    buf.writeByte(this.mode);
    buf.writeItemStackToBuffer(this.clickedItem);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:C0EPacketClickWindow.java

示例6: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeVarIntToBuffer(this.entityID);
    buf.writeShort(this.equipmentSlot);
    buf.writeItemStackToBuffer(this.itemStack);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:S04PacketEntityEquipment.java

示例7: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeByte(this.windowId);
    buf.writeShort(this.itemStacks.length);

    for (ItemStack itemstack : this.itemStacks)
    {
        buf.writeItemStackToBuffer(itemstack);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:S30PacketWindowItems.java

示例8: sendBookToServer

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
private void sendBookToServer(boolean publish) throws IOException
{
    if (this.bookIsUnsigned && this.bookIsModified)
    {
        if (this.bookPages != null)
        {
            while (this.bookPages.tagCount() > 1)
            {
                String s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1);

                if (s.length() != 0)
                {
                    break;
                }

                this.bookPages.removeTag(this.bookPages.tagCount() - 1);
            }

            if (this.bookObj.hasTagCompound())
            {
                NBTTagCompound nbttagcompound = this.bookObj.getTagCompound();
                nbttagcompound.setTag("pages", this.bookPages);
            }
            else
            {
                this.bookObj.setTagInfo("pages", this.bookPages);
            }

            String s2 = "MC|BEdit";

            if (publish)
            {
                s2 = "MC|BSign";
                this.bookObj.setTagInfo("author", new NBTTagString(this.editingPlayer.getName()));
                this.bookObj.setTagInfo("title", new NBTTagString(this.bookTitle.trim()));

                for (int i = 0; i < this.bookPages.tagCount(); ++i)
                {
                    String s1 = this.bookPages.getStringTagAt(i);
                    IChatComponent ichatcomponent = new ChatComponentText(s1);
                    s1 = IChatComponent.Serializer.componentToJson(ichatcomponent);
                    this.bookPages.set(i, new NBTTagString(s1));
                }

                this.bookObj.setItem(Items.written_book);
            }

            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            packetbuffer.writeItemStackToBuffer(this.bookObj);
            this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(s2, packetbuffer));
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:54,代码来源:GuiScreenBook.java

示例9: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeShort(this.slotId);
    buf.writeItemStackToBuffer(this.stack);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:CPacketCreativeInventoryAction.java

示例10: writeWatchableObjectToPacketBuffer

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes a watchable object (entity attribute of type {byte, short, int, float, string, ItemStack,
 * ChunkCoordinates}) to the specified PacketBuffer
 */
private static void writeWatchableObjectToPacketBuffer(PacketBuffer buffer, DataWatcher.WatchableObject object) throws IOException
{
    int i = (object.getObjectType() << 5 | object.getDataValueId() & 31) & 255;
    buffer.writeByte(i);

    switch (object.getObjectType())
    {
        case 0:
            buffer.writeByte(((Byte)object.getObject()).byteValue());
            break;

        case 1:
            buffer.writeShort(((Short)object.getObject()).shortValue());
            break;

        case 2:
            buffer.writeInt(((Integer)object.getObject()).intValue());
            break;

        case 3:
            buffer.writeFloat(((Float)object.getObject()).floatValue());
            break;

        case 4:
            buffer.writeString((String)object.getObject());
            break;

        case 5:
            ItemStack itemstack = (ItemStack)object.getObject();
            buffer.writeItemStackToBuffer(itemstack);
            break;

        case 6:
            BlockPos blockpos = (BlockPos)object.getObject();
            buffer.writeInt(blockpos.getX());
            buffer.writeInt(blockpos.getY());
            buffer.writeInt(blockpos.getZ());
            break;

        case 7:
            Rotations rotations = (Rotations)object.getObject();
            buffer.writeFloat(rotations.getX());
            buffer.writeFloat(rotations.getY());
            buffer.writeFloat(rotations.getZ());
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:51,代码来源:DataWatcher.java

示例11: writeItemStack

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Write an {@link ItemStack} using minecraft compatible encoding.
 *
 * @param to The buffer to write to
 * @param stack The itemstack to write
 */
public static void writeItemStack(ByteBuf to, ItemStack stack)
{
    PacketBuffer pb = new PacketBuffer(to);
    pb.writeItemStackToBuffer(stack);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:ByteBufUtils.java


注:本文中的net.minecraft.network.PacketBuffer.writeItemStackToBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。