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


Java ItemStack.func_190916_E方法代码示例

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


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

示例1: calcRedstoneFromInventory

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public static int calcRedstoneFromInventory(@Nullable IInventory inv)
{
    if (inv == null)
    {
        return 0;
    }
    else
    {
        int i = 0;
        float f = 0.0F;

        for (int j = 0; j < inv.getSizeInventory(); ++j)
        {
            ItemStack itemstack = inv.getStackInSlot(j);

            if (!itemstack.func_190926_b())
            {
                f += (float)itemstack.func_190916_E() / (float)Math.min(inv.getInventoryStackLimit(), itemstack.getMaxStackSize());
                ++i;
            }
        }

        f = f / (float)inv.getSizeInventory();
        return MathHelper.floor(f * 14.0F) + (i > 0 ? 1 : 0);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:Container.java

示例2: setInventorySlotContents

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
 */
public void setInventorySlotContents(int index, ItemStack stack)
{
    ItemStack itemstack = (ItemStack)this.furnaceItemStacks.get(index);
    boolean flag = !stack.func_190926_b() && stack.isItemEqual(itemstack) && ItemStack.areItemStackTagsEqual(stack, itemstack);
    this.furnaceItemStacks.set(index, stack);

    if (stack.func_190916_E() > this.getInventoryStackLimit())
    {
        stack.func_190920_e(this.getInventoryStackLimit());
    }

    if (index == 0 && !flag)
    {
        this.totalCookTime = this.getCookTime(stack);
        this.cookTime = 0;
        this.markDirty();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:TileEntityFurnace.java

示例3: processRightClick

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public EnumActionResult processRightClick(EntityPlayer player, World worldIn, EnumHand stack)
{
    if (this.currentGameType == GameType.SPECTATOR)
    {
        return EnumActionResult.PASS;
    }
    else
    {
        this.syncCurrentPlayItem();
        this.connection.sendPacket(new CPacketPlayerTryUseItem(stack));
        ItemStack itemstack = player.getHeldItem(stack);

        if (player.getCooldownTracker().hasCooldown(itemstack.getItem()))
        {
            return EnumActionResult.PASS;
        }
        else
        {
            int i = itemstack.func_190916_E();
            ActionResult<ItemStack> actionresult = itemstack.useItemRightClick(worldIn, player, stack);
            ItemStack itemstack1 = actionresult.getResult();

            if (itemstack1 != itemstack || itemstack1.func_190916_E() != i)
            {
                player.setHeldItem(stack, itemstack1);
            }

            return actionresult.getType();
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:32,代码来源:PlayerControllerMP.java

示例4: setInventorySlotContents

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
 */
public void setInventorySlotContents(int index, ItemStack stack)
{
    this.fillWithLoot((EntityPlayer)null);
    this.func_190576_q().set(index, stack);

    if (stack.func_190916_E() > this.getInventoryStackLimit())
    {
        stack.func_190920_e(this.getInventoryStackLimit());
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:TileEntityHopper.java

示例5: swapItem

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private void swapItem(EntityPlayer player, EntityEquipmentSlot p_184795_2_, ItemStack p_184795_3_, EnumHand hand)
{
    ItemStack itemstack = this.getItemStackFromSlot(p_184795_2_);

    if (itemstack.func_190926_b() || (this.disabledSlots & 1 << p_184795_2_.getSlotIndex() + 8) == 0)
    {
        if (!itemstack.func_190926_b() || (this.disabledSlots & 1 << p_184795_2_.getSlotIndex() + 16) == 0)
        {
            if (player.capabilities.isCreativeMode && itemstack.func_190926_b() && !p_184795_3_.func_190926_b())
            {
                ItemStack itemstack2 = p_184795_3_.copy();
                itemstack2.func_190920_e(1);
                this.setItemStackToSlot(p_184795_2_, itemstack2);
            }
            else if (!p_184795_3_.func_190926_b() && p_184795_3_.func_190916_E() > 1)
            {
                if (itemstack.func_190926_b())
                {
                    ItemStack itemstack1 = p_184795_3_.copy();
                    itemstack1.func_190920_e(1);
                    this.setItemStackToSlot(p_184795_2_, itemstack1);
                    p_184795_3_.func_190918_g(1);
                }
            }
            else
            {
                this.setItemStackToSlot(p_184795_2_, p_184795_3_);
                player.setHeldItem(hand, itemstack);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:33,代码来源:EntityArmorStand.java

示例6: setInventorySlotContents

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
 */
public void setInventorySlotContents(int index, @Nullable ItemStack stack)
{
    this.fillWithLoot((EntityPlayer)null);
    this.func_190576_q().set(index, stack);

    if (stack.func_190916_E() > this.getInventoryStackLimit())
    {
        stack.func_190920_e(this.getInventoryStackLimit());
    }

    this.markDirty();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:TileEntityLockableLoot.java

示例7: isInventoryFull

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Returns false if the inventory has any room to place items in
 */
private boolean isInventoryFull(IInventory inventoryIn, EnumFacing side)
{
    if (inventoryIn instanceof ISidedInventory)
    {
        ISidedInventory isidedinventory = (ISidedInventory)inventoryIn;
        int[] aint = isidedinventory.getSlotsForFace(side);

        for (int k : aint)
        {
            ItemStack itemstack1 = isidedinventory.getStackInSlot(k);

            if (itemstack1.func_190926_b() || itemstack1.func_190916_E() != itemstack1.getMaxStackSize())
            {
                return false;
            }
        }
    }
    else
    {
        int i = inventoryIn.getSizeInventory();

        for (int j = 0; j < i; ++j)
        {
            ItemStack itemstack = inventoryIn.getStackInSlot(j);

            if (itemstack.func_190926_b() || itemstack.func_190916_E() != itemstack.getMaxStackSize())
            {
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:38,代码来源:TileEntityHopper.java

示例8: getIsWillingToMate

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Returns current or updated value of {@link #isWillingToMate}
 */
public boolean getIsWillingToMate(boolean updateFirst)
{
    if (!this.isWillingToMate && updateFirst && this.hasEnoughFoodToBreed())
    {
        boolean flag = false;

        for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.villagerInventory.getStackInSlot(i);

            if (!itemstack.func_190926_b())
            {
                if (itemstack.getItem() == Items.BREAD && itemstack.func_190916_E() >= 3)
                {
                    flag = true;
                    this.villagerInventory.decrStackSize(i, 3);
                }
                else if ((itemstack.getItem() == Items.POTATO || itemstack.getItem() == Items.CARROT) && itemstack.func_190916_E() >= 12)
                {
                    flag = true;
                    this.villagerInventory.decrStackSize(i, 12);
                }
            }

            if (flag)
            {
                this.world.setEntityState(this, (byte)18);
                this.isWillingToMate = true;
                break;
            }
        }
    }

    return this.isWillingToMate;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:39,代码来源:EntityVillager.java

示例9: matches

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (!itemstack.func_190926_b())
        {
            list.add(itemstack);

            if (list.size() > 1)
            {
                ItemStack itemstack1 = (ItemStack)list.get(0);

                if (itemstack.getItem() != itemstack1.getItem() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.getItem().isDamageable())
                {
                    return false;
                }
            }
        }
    }

    return list.size() == 2;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:30,代码来源:RecipeRepairItem.java

示例10: processInteract

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	if (hand == EnumHand.MAIN_HAND && !this.world.isRemote) {
		if (this.angerTargetUUID != null && this.angerTargetUUID.equals(player.getUniqueID())) {
			if (!this.world.isRemote) {
				this.sayMessage(player, "angry");
			}
			return false;
		}
		if (player.getHeldItem(hand).func_190926_b() || player.getHeldItem(hand).getItem() != Items.GOLD_INGOT) {
			if (!this.world.isRemote) {
				this.sayMessage(player, "need_gold");
			}
			return false;
		}

		if (this.greediness <= 0) {
			this.greediness = this.world.rand.nextInt(5) + 1;
		}

		if (this.cost < 0) {
			this.cost = (int) (this.greediness * (this.world.rand.nextFloat() + 1));
		}

		ItemStack goldStack = player.getHeldItem(hand);

		if (goldStack.func_190916_E() < this.cost) {
			if (!this.world.isRemote) {
				this.sayMessage(player, "more_gold");
			}
			return false;
		}
		if (goldStack.func_190916_E() >= this.cost) {
			if (player instanceof EntityPlayerMP) {
				((EntityPlayerMP) player).getHeldItem(hand).func_190918_g(this.cost);
				((EntityPlayerMP) player).updateHeldItem();
			}
			ItemStack spellStack = new ItemStack(InfernumItems.SPELL_PAGE);
			ItemSpellPage.setSpell(spellStack, Infernum.SPELL_REGISTRY.randSpell(this.world.rand));
			if (!player.inventory.addItemStackToInventory(spellStack)) {
				player.dropItem(spellStack, false);
			}
			if (!this.world.isRemote) {
				this.sayMessage(player, "thanks");
			}
			this.cost = -1;
		}
	}
	return false;
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:50,代码来源:EntityPigMage.java

示例11: func_190775_a

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public EnumActionResult func_190775_a(Entity p_190775_1_, EnumHand p_190775_2_)
{
    if (this.isSpectator())
    {
        if (p_190775_1_ instanceof IInventory)
        {
            this.displayGUIChest((IInventory)p_190775_1_);
        }

        return EnumActionResult.PASS;
    }
    else
    {
        ItemStack itemstack = this.getHeldItem(p_190775_2_);
        ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.copy();

        if (p_190775_1_.processInitialInteract(this, p_190775_2_))
        {
            if (this.capabilities.isCreativeMode && itemstack == this.getHeldItem(p_190775_2_) && itemstack.func_190916_E() < itemstack1.func_190916_E())
            {
                itemstack.func_190920_e(itemstack1.func_190916_E());
            }

            return EnumActionResult.SUCCESS;
        }
        else
        {
            if (!itemstack.func_190926_b() && p_190775_1_ instanceof EntityLivingBase)
            {
                if (this.capabilities.isCreativeMode)
                {
                    itemstack = itemstack1;
                }

                if (itemstack.interactWithEntity(this, (EntityLivingBase)p_190775_1_, p_190775_2_))
                {
                    if (itemstack.func_190926_b() && !this.capabilities.isCreativeMode)
                    {
                        this.setHeldItem(p_190775_2_, ItemStack.field_190927_a);
                    }

                    return EnumActionResult.SUCCESS;
                }
            }

            return EnumActionResult.PASS;
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:50,代码来源:EntityPlayer.java

示例12: processCreativeInventoryAction

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Update the server with an ItemStack in a slot.
 */
public void processCreativeInventoryAction(CPacketCreativeInventoryAction packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

    if (this.playerEntity.interactionManager.isCreative())
    {
        boolean flag = packetIn.getSlotId() < 0;
        ItemStack itemstack = packetIn.getStack();

        if (!itemstack.func_190926_b() && itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag");

            if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z"))
            {
                BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
                TileEntity tileentity = this.playerEntity.world.getTileEntity(blockpos);

                if (tileentity != null)
                {
                    NBTTagCompound nbttagcompound1 = tileentity.writeToNBT(new NBTTagCompound());
                    nbttagcompound1.removeTag("x");
                    nbttagcompound1.removeTag("y");
                    nbttagcompound1.removeTag("z");
                    itemstack.setTagInfo("BlockEntityTag", nbttagcompound1);
                }
            }
        }

        boolean flag1 = packetIn.getSlotId() >= 1 && packetIn.getSlotId() <= 45;
        boolean flag2 = itemstack.func_190926_b() || itemstack.getMetadata() >= 0 && itemstack.func_190916_E() <= 64 && !itemstack.func_190926_b();

        if (flag1 && flag2)
        {
            if (itemstack.func_190926_b())
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), ItemStack.field_190927_a);
            }
            else
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), itemstack);
            }

            this.playerEntity.inventoryContainer.setCanCraft(this.playerEntity, true);
        }
        else if (flag && flag2 && this.itemDropThreshold < 200)
        {
            this.itemDropThreshold += 20;
            EntityItem entityitem = this.playerEntity.dropItem(itemstack, true);

            if (entityitem != null)
            {
                entityitem.setAgeToCreativeDespawnTime();
            }
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:61,代码来源:NetHandlerPlayServer.java

示例13: transferStackInSlot

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Take a stack from the specified inventory slot.
 */
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
    ItemStack itemstack = ItemStack.field_190927_a;
    Slot slot = (Slot)this.inventorySlots.get(index);

    if (slot != null && slot.getHasStack())
    {
        ItemStack itemstack1 = slot.getStack();
        itemstack = itemstack1.copy();

        if (index == 0)
        {
            itemstack1.getItem().onCreated(itemstack1, this.worldObj, playerIn);

            if (!this.mergeItemStack(itemstack1, 10, 46, true))
            {
                return ItemStack.field_190927_a;
            }

            slot.onSlotChange(itemstack1, itemstack);
        }
        else if (index >= 10 && index < 37)
        {
            if (!this.mergeItemStack(itemstack1, 37, 46, false))
            {
                return ItemStack.field_190927_a;
            }
        }
        else if (index >= 37 && index < 46)
        {
            if (!this.mergeItemStack(itemstack1, 10, 37, false))
            {
                return ItemStack.field_190927_a;
            }
        }
        else if (!this.mergeItemStack(itemstack1, 10, 46, false))
        {
            return ItemStack.field_190927_a;
        }

        if (itemstack1.func_190926_b())
        {
            slot.putStack(ItemStack.field_190927_a);
        }
        else
        {
            slot.onSlotChanged();
        }

        if (itemstack1.func_190916_E() == itemstack.func_190916_E())
        {
            return ItemStack.field_190927_a;
        }

        ItemStack itemstack2 = slot.func_190901_a(playerIn, itemstack1);

        if (index == 0)
        {
            playerIn.dropItem(itemstack2, false);
        }
    }

    return itemstack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:68,代码来源:ContainerWorkbench.java

示例14: canAddItemToSlot

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Checks if it's possible to add the given itemstack to the given slot.
 */
public static boolean canAddItemToSlot(@Nullable Slot slotIn, ItemStack stack, boolean stackSizeMatters)
{
    boolean flag = slotIn == null || !slotIn.getHasStack();
    return !flag && stack.isItemEqual(slotIn.getStack()) && ItemStack.areItemStackTagsEqual(slotIn.getStack(), stack) ? slotIn.getStack().func_190916_E() + (stackSizeMatters ? 0 : stack.func_190916_E()) <= stack.getMaxStackSize() : flag;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:Container.java

示例15: transferStackInSlot

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Take a stack from the specified inventory slot.
 */
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
    ItemStack itemstack = ItemStack.field_190927_a;
    Slot slot = (Slot)this.inventorySlots.get(index);

    if (slot != null && slot.getHasStack())
    {
        ItemStack itemstack1 = slot.getStack();
        itemstack = itemstack1.copy();

        if (index == 2)
        {
            if (!this.mergeItemStack(itemstack1, 3, 39, true))
            {
                return ItemStack.field_190927_a;
            }

            slot.onSlotChange(itemstack1, itemstack);
        }
        else if (index != 0 && index != 1)
        {
            if (index >= 3 && index < 30)
            {
                if (!this.mergeItemStack(itemstack1, 30, 39, false))
                {
                    return ItemStack.field_190927_a;
                }
            }
            else if (index >= 30 && index < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
            {
                return ItemStack.field_190927_a;
            }
        }
        else if (!this.mergeItemStack(itemstack1, 3, 39, false))
        {
            return ItemStack.field_190927_a;
        }

        if (itemstack1.func_190926_b())
        {
            slot.putStack(ItemStack.field_190927_a);
        }
        else
        {
            slot.onSlotChanged();
        }

        if (itemstack1.func_190916_E() == itemstack.func_190916_E())
        {
            return ItemStack.field_190927_a;
        }

        slot.func_190901_a(playerIn, itemstack1);
    }

    return itemstack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:61,代码来源:ContainerMerchant.java


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