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


Java ItemStack.func_190920_e方法代码示例

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


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

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private void setDisplayedItemWithUpdate(ItemStack stack, boolean p_174864_2_)
{
    if (!stack.func_190926_b())
    {
        stack = stack.copy();
        stack.func_190920_e(1);
        stack.setItemFrame(this);
    }

    this.getDataManager().set(ITEM, stack);
    this.getDataManager().setDirty(ITEM);

    if (!stack.func_190926_b())
    {
        this.playSound(SoundEvents.ENTITY_ITEMFRAME_ADD_ITEM, 1.0F, 1.0F);
    }

    if (p_174864_2_ && this.hangingPosition != null)
    {
        this.world.updateComparatorOutputLevel(this.hangingPosition, Blocks.AIR);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:EntityItemFrame.java

示例3: updateEquipmentIfNeeded

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Tests if this entity should pickup a weapon or an armor. Entity drops current weapon or armor if the new one is
 * better.
 */
protected void updateEquipmentIfNeeded(EntityItem itemEntity)
{
    ItemStack itemstack = itemEntity.getEntityItem();
    Item item = itemstack.getItem();

    if (this.canVillagerPickupItem(item))
    {
        ItemStack itemstack1 = this.villagerInventory.addItem(itemstack);

        if (itemstack1.func_190926_b())
        {
            itemEntity.setDead();
        }
        else
        {
            itemstack.func_190920_e(itemstack1.func_190916_E());
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:EntityVillager.java

示例4: getCraftingResult

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (!itemstack.func_190926_b() && TileEntityBanner.getPatterns(itemstack) > 0)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.func_190920_e(1);
            return itemstack1;
        }
    }

    return ItemStack.field_190927_a;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:RecipesBanners.java

示例5: getCraftingResult

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    ItemStack itemstack = ItemStack.field_190927_a;

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

        if (itemstack1.getItem() == Items.FILLED_MAP)
        {
            itemstack = itemstack1;
        }
    }

    itemstack = itemstack.copy();
    itemstack.func_190920_e(1);

    if (itemstack.getTagCompound() == null)
    {
        itemstack.setTagCompound(new NBTTagCompound());
    }

    itemstack.getTagCompound().setInteger("map_scale_direction", 1);
    return itemstack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:RecipesMapExtending.java

示例6: getRemainingItems

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
    NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);

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

        if (itemstack.getItem() instanceof ItemWrittenBook)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.func_190920_e(1);
            nonnulllist.set(i, itemstack1);
            break;
        }
    }

    return nonnulllist;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:RecipeBookCloning.java

示例7: 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

示例8: addLoot

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public void addLoot(Collection<ItemStack> stacks, Random rand, LootContext context)
{
    ItemStack itemstack = new ItemStack(this.item);

    for (LootFunction lootfunction : this.functions)
    {
        if (LootConditionManager.testAllConditions(lootfunction.getConditions(), rand, context))
        {
            itemstack = lootfunction.apply(itemstack, rand, context);
        }
    }

    if (!itemstack.func_190926_b())
    {
        if (itemstack.func_190916_E() < this.item.getItemStackLimit())
        {
            stacks.add(itemstack);
        }
        else
        {
            int i = itemstack.func_190916_E();

            while (i > 0)
            {
                ItemStack itemstack1 = itemstack.copy();
                itemstack1.func_190920_e(Math.min(itemstack.getMaxStackSize(), i));
                i -= itemstack1.func_190916_E();
                stacks.add(itemstack1);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:33,代码来源:LootEntryItem.java

示例9: 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.addLoot((EntityPlayer)null);
    this.minecartContainerItems.set(index, stack);

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

示例10: 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

示例11: 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

示例12: 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.theInventory.set(index, stack);

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

    if (this.inventoryResetNeededOnSlotChange(index))
    {
        this.resetRecipeAndSlots();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:InventoryMerchant.java

示例13: 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

示例14: 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

示例15: processRightClick

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public EnumActionResult processRightClick(EntityPlayer player, World worldIn, ItemStack stack, EnumHand hand)
{
    if (this.gameType == GameType.SPECTATOR)
    {
        return EnumActionResult.PASS;
    }
    else if (player.getCooldownTracker().hasCooldown(stack.getItem()))
    {
        return EnumActionResult.PASS;
    }
    else
    {
        int i = stack.func_190916_E();
        int j = stack.getMetadata();
        ActionResult<ItemStack> actionresult = stack.useItemRightClick(worldIn, player, hand);
        ItemStack itemstack = (ItemStack)actionresult.getResult();

        if (itemstack == stack && itemstack.func_190916_E() == i && itemstack.getMaxItemUseDuration() <= 0 && itemstack.getMetadata() == j)
        {
            return actionresult.getType();
        }
        else if (actionresult.getType() == EnumActionResult.FAIL && itemstack.getMaxItemUseDuration() > 0 && !player.isHandActive())
        {
            return actionresult.getType();
        }
        else
        {
            player.setHeldItem(hand, itemstack);

            if (this.isCreative())
            {
                itemstack.func_190920_e(i);

                if (itemstack.isItemStackDamageable())
                {
                    itemstack.setItemDamage(j);
                }
            }

            if (itemstack.func_190926_b())
            {
                player.setHeldItem(hand, ItemStack.field_190927_a);
            }

            if (!player.isHandActive())
            {
                ((EntityPlayerMP)player).sendContainerToPlayer(player.inventoryContainer);
            }

            return actionresult.getType();
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:54,代码来源:PlayerInteractionManager.java


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