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


Java ItemStack.func_190917_f方法代码示例

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


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

示例1: apply

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public ItemStack apply(ItemStack stack, Random rand, LootContext context)
{
    Entity entity = context.getKiller();

    if (entity instanceof EntityLivingBase)
    {
        int i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity);

        if (i == 0)
        {
            return stack;
        }

        float f = (float)i * this.count.generateFloat(rand);
        stack.func_190917_f(Math.round(f));

        if (this.limit != 0 && stack.func_190916_E() > this.limit)
        {
            stack.func_190920_e(this.limit);
        }
    }

    return stack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:LootingEnchantBonus.java

示例2: computeStackSize

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Compute the new stack size, Returns the stack with the new size. Args : dragSlots, dragMode, dragStack,
 * slotStackSize
 */
public static void computeStackSize(Set<Slot> dragSlotsIn, int dragModeIn, ItemStack stack, int slotStackSize)
{
    switch (dragModeIn)
    {
        case 0:
            stack.func_190920_e(MathHelper.floor((float)stack.func_190916_E() / (float)dragSlotsIn.size()));
            break;

        case 1:
            stack.func_190920_e(1);
            break;

        case 2:
            stack.func_190920_e(stack.getItem().getItemStackLimit());
    }

    stack.func_190917_f(slotStackSize);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:Container.java

示例3: smeltItem

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
 */
public void smeltItem()
{
    if (this.canSmelt())
    {
        ItemStack itemstack = (ItemStack)this.furnaceItemStacks.get(0);
        ItemStack itemstack1 = FurnaceRecipes.instance().getSmeltingResult(itemstack);
        ItemStack itemstack2 = (ItemStack)this.furnaceItemStacks.get(2);

        if (itemstack2.func_190926_b())
        {
            this.furnaceItemStacks.set(2, itemstack1.copy());
        }
        else if (itemstack2.getItem() == itemstack1.getItem())
        {
            itemstack2.func_190917_f(1);
        }

        if (itemstack.getItem() == Item.getItemFromBlock(Blocks.SPONGE) && itemstack.getMetadata() == 1 && !((ItemStack)this.furnaceItemStacks.get(1)).func_190926_b() && ((ItemStack)this.furnaceItemStacks.get(1)).getItem() == Items.BUCKET)
        {
            this.furnaceItemStacks.set(1, new ItemStack(Items.WATER_BUCKET));
        }

        itemstack.func_190918_g(1);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:TileEntityFurnace.java

示例4: func_190901_a

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_)
{
    this.onCrafting(p_190901_2_);
    NonNullList<ItemStack> nonnulllist = CraftingManager.getInstance().getRemainingItems(this.craftMatrix, p_190901_1_.world);

    for (int i = 0; i < nonnulllist.size(); ++i)
    {
        ItemStack itemstack = this.craftMatrix.getStackInSlot(i);
        ItemStack itemstack1 = (ItemStack)nonnulllist.get(i);

        if (!itemstack.func_190926_b())
        {
            this.craftMatrix.decrStackSize(i, 1);
            itemstack = this.craftMatrix.getStackInSlot(i);
        }

        if (!itemstack1.func_190926_b())
        {
            if (itemstack.func_190926_b())
            {
                this.craftMatrix.setInventorySlotContents(i, itemstack1);
            }
            else if (ItemStack.areItemsEqual(itemstack, itemstack1) && ItemStack.areItemStackTagsEqual(itemstack, itemstack1))
            {
                itemstack1.func_190917_f(itemstack.func_190916_E());
                this.craftMatrix.setInventorySlotContents(i, itemstack1);
            }
            else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack1))
            {
                this.thePlayer.dropItem(itemstack1, false);
            }
        }
    }

    return p_190901_2_;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:37,代码来源:SlotCrafting.java

示例5: combineItems

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Tries to merge this item with the item passed as the parameter. Returns true if successful. Either this item or
 * the other item will  be removed from the world.
 */
private boolean combineItems(EntityItem other)
{
    if (other == this)
    {
        return false;
    }
    else if (other.isEntityAlive() && this.isEntityAlive())
    {
        ItemStack itemstack = this.getEntityItem();
        ItemStack itemstack1 = other.getEntityItem();

        if (this.delayBeforeCanPickup != 32767 && other.delayBeforeCanPickup != 32767)
        {
            if (this.age != -32768 && other.age != -32768)
            {
                if (itemstack1.getItem() != itemstack.getItem())
                {
                    return false;
                }
                else if (itemstack1.hasTagCompound() ^ itemstack.hasTagCompound())
                {
                    return false;
                }
                else if (itemstack1.hasTagCompound() && !itemstack1.getTagCompound().equals(itemstack.getTagCompound()))
                {
                    return false;
                }
                else if (itemstack1.getItem() == null)
                {
                    return false;
                }
                else if (itemstack1.getItem().getHasSubtypes() && itemstack1.getMetadata() != itemstack.getMetadata())
                {
                    return false;
                }
                else if (itemstack1.func_190916_E() < itemstack.func_190916_E())
                {
                    return other.combineItems(this);
                }
                else if (itemstack1.func_190916_E() + itemstack.func_190916_E() > itemstack1.getMaxStackSize())
                {
                    return false;
                }
                else
                {
                    itemstack1.func_190917_f(itemstack.func_190916_E());
                    other.delayBeforeCanPickup = Math.max(other.delayBeforeCanPickup, this.delayBeforeCanPickup);
                    other.age = Math.min(other.age, this.age);
                    other.setEntityItemStack(itemstack1);
                    this.setDead();
                    return true;
                }
            }
            else
            {
                return false;
            }
        }
        else
        {
            return false;
        }
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:73,代码来源:EntityItem.java

示例6: addItem

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public ItemStack addItem(ItemStack stack)
{
    ItemStack itemstack = stack.copy();

    for (int i = 0; i < this.slotsCount; ++i)
    {
        ItemStack itemstack1 = this.getStackInSlot(i);

        if (itemstack1.func_190926_b())
        {
            this.setInventorySlotContents(i, itemstack);
            this.markDirty();
            return ItemStack.field_190927_a;
        }

        if (ItemStack.areItemsEqual(itemstack1, itemstack))
        {
            int j = Math.min(this.getInventoryStackLimit(), itemstack1.getMaxStackSize());
            int k = Math.min(itemstack.func_190916_E(), j - itemstack1.func_190916_E());

            if (k > 0)
            {
                itemstack1.func_190917_f(k);
                itemstack.func_190918_g(k);

                if (itemstack.func_190926_b())
                {
                    this.markDirty();
                    return ItemStack.field_190927_a;
                }
            }
        }
    }

    if (itemstack.func_190916_E() != stack.func_190916_E())
    {
        this.markDirty();
    }

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

示例7: insertStack

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Insert the specified stack to the specified inventory and return any leftover items
 */
private static ItemStack insertStack(IInventory inventoryIn, IInventory stack, ItemStack index, int side, EnumFacing p_174916_4_)
{
    ItemStack itemstack = stack.getStackInSlot(side);

    if (canInsertItemInSlot(stack, index, side, p_174916_4_))
    {
        boolean flag = false;
        boolean flag1 = stack.func_191420_l();

        if (itemstack.func_190926_b())
        {
            stack.setInventorySlotContents(side, index);
            index = ItemStack.field_190927_a;
            flag = true;
        }
        else if (canCombine(itemstack, index))
        {
            int i = index.getMaxStackSize() - itemstack.func_190916_E();
            int j = Math.min(index.func_190916_E(), i);
            index.func_190918_g(j);
            itemstack.func_190917_f(j);
            flag = j > 0;
        }

        if (flag)
        {
            if (flag1 && stack instanceof TileEntityHopper)
            {
                TileEntityHopper tileentityhopper1 = (TileEntityHopper)stack;

                if (!tileentityhopper1.mayTransfer())
                {
                    int k = 0;

                    if (inventoryIn != null && inventoryIn instanceof TileEntityHopper)
                    {
                        TileEntityHopper tileentityhopper = (TileEntityHopper)inventoryIn;

                        if (tileentityhopper1.field_190578_g >= tileentityhopper.field_190578_g)
                        {
                            k = 1;
                        }
                    }

                    tileentityhopper1.setTransferCooldown(8 - k);
                }
            }

            stack.markDirty();
        }
    }

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


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