本文整理汇总了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;
}
示例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);
}
}
}
}