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


Java IRecipe.getRecipeOutput方法代码示例

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


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

示例1: removeRecipe

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/**
 * Removes all recipes that produce a given item.
 * @param itemToRemove The item whose recipes are to be removed.
 */
private static void removeRecipe(Item itemToRemove) {
    Iterator<IRecipe> iter = CraftingManager.getInstance().getRecipeList().iterator();
    while (iter.hasNext()) {
        IRecipe recipe = iter.next();
        ItemStack out = recipe.getRecipeOutput();
        if (out != ItemStack.EMPTY && out.getItem() == itemToRemove) {
            FMLLog.info("Removing recipe for " + out);
            iter.remove();
        }
    }
}
 
开发者ID:elifoster,项目名称:MakeClayValuableAgain,代码行数:16,代码来源:MakeClayValuableAgain.java

示例2: unregister

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
public void unregister() {
	Iterator<IRecipe> it = CraftingManager.getInstance().getRecipeList().iterator();
	
	while (it.hasNext()) {
		IRecipe recipe = it.next();
		ItemStack output = recipe.getRecipeOutput();
		if (output != null && output.getItem() != null) {
			if (output.isItemEqual(new ItemStack(Items.IRON_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 6, 0), EntityEquipmentSlot.MAINHAND);
			}
			if (output.isItemEqual(new ItemStack(Items.GOLDEN_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 5, 0), EntityEquipmentSlot.MAINHAND);
			}
			if (output.isItemEqual(new ItemStack(Items.DIAMOND_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 8, 0), EntityEquipmentSlot.MAINHAND);
			}
			if (output.isItemEqual(new ItemStack(Items.WOODEN_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 4, 0), EntityEquipmentSlot.MAINHAND);
			}
			if (output.isItemEqual(new ItemStack(Items.STONE_SWORD))){
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
				output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 5, 0), EntityEquipmentSlot.MAINHAND);
			}
		}
	}
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:31,代码来源:CraftingRegistry.java

示例3: initCraftableStats

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/**
 * Initializes statistics related to craftable items. Is only called after both block and item stats have been
 * initialized.
 */
private static void initCraftableStats()
{
    Set<Item> set = Sets.<Item>newHashSet();

    for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList())
    {
        if (irecipe.getRecipeOutput() != null)
        {
            set.add(irecipe.getRecipeOutput().getItem());
        }
    }

    for (ItemStack itemstack : FurnaceRecipes.instance().getSmeltingList().values())
    {
        set.add(itemstack.getItem());
    }

    for (Item item : set)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = func_180204_a(item);

            if (s != null)
            {
                objectCraftStats[i] = (new StatCrafting("stat.craftItem.", s, new ChatComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat();
            }
        }
    }

    replaceAllSimilarBlocks(objectCraftStats);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:StatList.java

示例4: attemptCrafting

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/** Attempt to craft the given recipe.<br>
 * This pays no attention to tedious things like using the right crafting table / brewing stand etc, or getting the right shape.<br>
 * It simply takes the raw ingredients out of the player's inventory, and inserts the output of the recipe, if possible.
 * @param player the SERVER SIDE player that will do the crafting.
 * @param recipe the IRecipe we wish to craft.
 * @return true if the recipe had an output, and the player had the required ingredients to create it; false otherwise.
 */
public static boolean attemptCrafting(EntityPlayerMP player, IRecipe recipe)
{
    if (player == null || recipe == null)
        return false;

    ItemStack is = recipe.getRecipeOutput();
    if (is == null)
        return false;

    List<ItemStack> ingredients = getIngredients(recipe);
    if (playerHasIngredients(player, ingredients))
    {
        // We have the ingredients we need, so directly manipulate the inventory.
        // First, remove the ingredients:
        removeIngredientsFromPlayer(player, ingredients);
        // Now add the output of the recipe:

        ItemStack resultForInventory = is.copy();
        ItemStack resultForReward = is.copy();
        player.inventory.addItemStackToInventory(resultForInventory);
        RewardForCollectingItemImplementation.GainItemEvent event = new RewardForCollectingItemImplementation.GainItemEvent(resultForReward);
        MinecraftForge.EVENT_BUS.post(event);

        return true;
    }
    return false;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:35,代码来源:CraftingHelper.java

示例5: initCraftableStats

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/**
 * Initializes statistics related to craftable items. Is only called after both block and item stats have been
 * initialized.
 */
private static void initCraftableStats()
{
    Set<Item> set = Sets.<Item>newHashSet();

    for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList())
    {
        ItemStack itemstack = irecipe.getRecipeOutput();

        if (!itemstack.func_190926_b())
        {
            set.add(irecipe.getRecipeOutput().getItem());
        }
    }

    for (ItemStack itemstack1 : FurnaceRecipes.instance().getSmeltingList().values())
    {
        set.add(itemstack1.getItem());
    }

    for (Item item : set)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = getItemName(item);

            if (s != null)
            {
                CRAFTS_STATS[i] = (new StatCrafting("stat.craftItem.", s, new TextComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
            }
        }
    }

    replaceAllSimilarBlocks(CRAFTS_STATS);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:StatList.java

示例6: initCraftableStats

import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/**
 * Initializes statistics related to craftable items. Is only called after both block and item stats have been
 * initialized.
 */
private static void initCraftableStats()
{
    Set<Item> set = Sets.<Item>newHashSet();

    for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList())
    {
        if (irecipe.getRecipeOutput() != null)
        {
            set.add(irecipe.getRecipeOutput().getItem());
        }
    }

    for (ItemStack itemstack : FurnaceRecipes.instance().getSmeltingList().values())
    {
        set.add(itemstack.getItem());
    }

    for (Item item : set)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = getItemName(item);

            if (s != null)
            {
                CRAFTS_STATS[i] = (new StatCrafting("stat.craftItem.", s, new TextComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
            }
        }
    }

    replaceAllSimilarBlocks(CRAFTS_STATS, true);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:38,代码来源:StatList.java


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