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


Java NonNullList.func_191196_a方法代碼示例

本文整理匯總了Java中net.minecraft.util.NonNullList.func_191196_a方法的典型用法代碼示例。如果您正苦於以下問題:Java NonNullList.func_191196_a方法的具體用法?Java NonNullList.func_191196_a怎麽用?Java NonNullList.func_191196_a使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.NonNullList的用法示例。


在下文中一共展示了NonNullList.func_191196_a方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getInventory

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
public NonNullList<ItemStack> getInventory()
{
    NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191196_a();

    for (int i = 0; i < this.inventorySlots.size(); ++i)
    {
        nonnulllist.add(((Slot)this.inventorySlots.get(i)).getStack());
    }

    return nonnulllist;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:12,代碼來源:Container.java

示例2: processClickWindow

import net.minecraft.util.NonNullList; //導入方法依賴的package包/類
/**
 * Executes a container/inventory slot manipulation as indicated by the packet. Sends the serverside result if they
 * didn't match the indicated result and prevents further manipulation by the player until he confirms that it has
 * the same open container/inventory
 */
public void processClickWindow(CPacketClickWindow packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    this.playerEntity.markPlayerActive();

    if (this.playerEntity.openContainer.windowId == packetIn.getWindowId() && this.playerEntity.openContainer.getCanCraft(this.playerEntity))
    {
        if (this.playerEntity.isSpectator())
        {
            NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191196_a();

            for (int i = 0; i < this.playerEntity.openContainer.inventorySlots.size(); ++i)
            {
                nonnulllist.add(((Slot)this.playerEntity.openContainer.inventorySlots.get(i)).getStack());
            }

            this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, nonnulllist);
        }
        else
        {
            ItemStack itemstack2 = this.playerEntity.openContainer.slotClick(packetIn.getSlotId(), packetIn.getUsedButton(), packetIn.getClickType(), this.playerEntity);

            if (ItemStack.areItemStacksEqual(packetIn.getClickedItem(), itemstack2))
            {
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
                this.playerEntity.isChangingQuantityOnly = true;
                this.playerEntity.openContainer.detectAndSendChanges();
                this.playerEntity.updateHeldItem();
                this.playerEntity.isChangingQuantityOnly = false;
            }
            else
            {
                this.pendingTransactions.addKey(this.playerEntity.openContainer.windowId, Short.valueOf(packetIn.getActionNumber()));
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), false));
                this.playerEntity.openContainer.setCanCraft(this.playerEntity, false);
                NonNullList<ItemStack> nonnulllist1 = NonNullList.<ItemStack>func_191196_a();

                for (int j = 0; j < this.playerEntity.openContainer.inventorySlots.size(); ++j)
                {
                    ItemStack itemstack = ((Slot)this.playerEntity.openContainer.inventorySlots.get(j)).getStack();
                    ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack;
                    nonnulllist1.add(itemstack1);
                }

                this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, nonnulllist1);
            }
        }
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:55,代碼來源:NetHandlerPlayServer.java


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