當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。