Java 类net.minecraft.item.crafting.CraftingManager 实例源码

项目:MakeClayValuableAgain    文件:MakeClayValuableAgain.java   
/**
 * 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();
        }
    }
}
项目:DecompiledMinecraft    文件:EntitySheep.java   
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
项目:DecompiledMinecraft    文件:EntitySheep.java   
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
项目:BaseClient    文件:EntitySheep.java   
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
项目:BaseClient    文件:EntitySheep.java   
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
项目:ProjectEon    文件:GuideArticle.java   
@Override
public IGuideElement[] loadElements() {
    String[] txt = new String[]{"Heyo", "This is just a test of a new algorithm for my little guide :D", "", "Nice to meet ya", "Ya boi", "", "", "Hehehehe", ""};
    return new IGuideElement[]{
            /*new TextElement(Arrays.asList(txt)),
            new TextElement(Arrays.asList(txt)),
            new TextElement(Arrays.asList(txt)),*/
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
            new CraftingElement(CraftingManager.getInstance().getRecipeList().get((int)(Math.random() * CraftingManager.getInstance().getRecipeList().size()))),
    };
}
项目:Proyecto-DASI    文件:CraftingHelper.java   
/** Attempt to find all recipes that result in an item of the requested output.
 * @param output the desired item, eg from Types.xsd - "diamond_pickaxe" etc - or as a Minecraft name - eg "tile.woolCarpet.blue"
 * @return a list of IRecipe objects that result in this item.
 */
public static List<IRecipe> getRecipesForRequestedOutput(String output)
{
    List<IRecipe> matchingRecipes = new ArrayList<IRecipe>();
    ItemStack target = MinecraftTypeHelper.getItemStackFromParameterString(output);
    List<?> recipes = CraftingManager.getInstance().getRecipeList();
    for (Object obj : recipes)
    {
        if (obj == null)
            continue;
        if (obj instanceof IRecipe)
        {
            ItemStack is = ((IRecipe)obj).getRecipeOutput();
            if (is == null)
                continue;
            if (ItemStack.areItemsEqual(is, target))
            {
                matchingRecipes.add((IRecipe)obj);
            }
        }
    }
    return matchingRecipes;
}
项目:Proyecto-DASI    文件:CraftingHelper.java   
/** Attempt to find all recipes that result in an item of the requested output.
 * @param output the desired item, eg from Types.xsd - "diamond_pickaxe" etc - or as a Minecraft name - eg "tile.woolCarpet.blue"
 * @return a list of IRecipe objects that result in this item.
 */
public static List<IRecipe> getRecipesForRequestedOutput(String output)
{
    List<IRecipe> matchingRecipes = new ArrayList<IRecipe>();
    ItemStack target = MinecraftTypeHelper.getItemStackFromParameterString(output);
    List<?> recipes = CraftingManager.getInstance().getRecipeList();
    for (Object obj : recipes)
    {
        if (obj == null)
            continue;
        if (obj instanceof IRecipe)
        {
            ItemStack is = ((IRecipe)obj).getRecipeOutput();
            if (is == null)
                continue;
            if (ItemStack.areItemsEqual(is, target))
            {
                matchingRecipes.add((IRecipe)obj);
            }
        }
    }
    return matchingRecipes;
}
项目:refinedstorageaddons    文件:WirelessCraftingGrid.java   
@Override
public void onCraftingMatrixChanged() {
    if (currentRecipe == null || !currentRecipe.matches(matrix, DimensionManager.getWorld(controllerDimension))) {
        currentRecipe = CraftingManager.findMatchingRecipe(matrix, DimensionManager.getWorld(controllerDimension));
    }

    if (currentRecipe == null) {
        result.setInventorySlotContents(0, ItemStack.EMPTY);
    } else {
        result.setInventorySlotContents(0, currentRecipe.getCraftingResult(matrix));
    }

    if (!getStack().hasTagCompound()) {
        getStack().setTagCompound(new NBTTagCompound());
    }

    StackUtils.writeItems(matrix, 1, getStack().getTagCompound());
}
项目:Backmemed    文件:EntitySheep.java   
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).world);
    int k;

    if (itemstack.getItem() == Items.DYE)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.world.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
项目:Technical    文件:AutoWorkBenchRecipes.java   
public ItemStack[] getSmeltingResult(InventoryCrafting inv, World world, Tier tier) {
    return new ItemStack[] { CraftingManager.getInstance().findMatchingRecipe(inv, world) };
    /*
    @SuppressWarnings("unchecked")
    List<IRecipe> recipeList = CraftingManager.getInstance().getRecipeList();

    Iterator<IRecipe> iterator = recipeList.iterator();
    while(iterator.hasNext()) {
        IRecipe recipe = iterator.next();
        if(recipe != null && inv != null) {
            if(recipe.getCraftingResult(inv) != null)
                FMLLog.log(Level.INFO, "result: " + recipe.getCraftingResult(inv));
            else
                FMLLog.log(Level.INFO, "result: null");
            if(recipe.matches(inv, world)) {
                return new ItemStack[] { recipe.getCraftingResult(inv) };
            }
        } else {
            FMLLog.log(Level.INFO, "_null");
        }
    }
    return null;
    */
}
项目:CustomWorldGen    文件:RecipeSorter.java   
public static void sortCraftManager()
{
    bake();
    FMLLog.fine("Sorting recipes");
    warned.clear();
    Collections.sort(CraftingManager.getInstance().getRecipeList(), INSTANCE);
}
项目:CustomWorldGen    文件:EntitySheep.java   
/**
 * Attempts to mix both parent sheep to come up with a mixed dye color.
 */
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
    int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
    int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
    this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
    this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.DYE)
    {
        k = itemstack.getMetadata();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return EnumDyeColor.byDyeDamage(k);
}
项目:NotEnoughItems    文件:ShapedRecipeHandler.java   
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
        CachedShapedRecipe recipe = null;
        if (irecipe instanceof ShapedRecipes) {
            recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
        } else if (irecipe instanceof ShapedOreRecipe) {
            recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
        }

        if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem())) {
            continue;
        }

        recipe.computeVisuals();
        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
项目:TerrafirmaPunk-Tweaks    文件:RecipeTweaks.java   
@SuppressWarnings("unchecked")
public static void SC2RecipeTweaks()
{
    if(Loader.isModLoaded("steamcraft2"))
    {
        if(!ConfigSettings.FleshBlockRecipe)
        {
            List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
            for (int i = 0; i < recipes.size(); i++)
            {
                if (recipes.get(i) != null)
                {
                    ItemStack recipeResult = recipes.get(i).getRecipeOutput();

                    if (recipeResult != null && recipeResult.getItem() == Item.getItemFromBlock(InitBlocks.blockFlesh))
                    {
                        recipes.remove(i--);
                    }
                }
            }
        }

        //OreDictionary.registerOre("itemAxe", new ItemStack(InitItems.axeSteam, 1, OreDictionary.WILDCARD_VALUE));
    }
}
项目:4Space-5    文件:ShapelessRecipeHandler.java   
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapelessRecipeHandler.class) {
        List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
        for (IRecipe irecipe : allrecipes) {
            CachedShapelessRecipe recipe = null;
            if (irecipe instanceof ShapelessRecipes)
                recipe = shapelessRecipe((ShapelessRecipes) irecipe);
            else if (irecipe instanceof ShapelessOreRecipe)
                recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

            if (recipe == null)
                continue;

            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:NotEnoughItems    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
        for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes) {
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            } else if (irecipe instanceof ShapedOreRecipe) {
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
            }

            if (recipe == null) {
                continue;
            }

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:4Space-5    文件:ShapelessRecipeHandler.java   
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        CachedShapelessRecipe recipe = null;
        if (irecipe instanceof ShapelessRecipes)
            recipe = shapelessRecipe((ShapelessRecipes) irecipe);
        else if (irecipe instanceof ShapelessOreRecipe)
            recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

        if (recipe == null)
            continue;

        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
项目:4Space-5    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
        for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes)
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            else if (irecipe instanceof ShapedOreRecipe)
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

            if (recipe == null)
                continue;

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:4Space-5    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(ItemStack result) {
    for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes)
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            else if (irecipe instanceof ShapedOreRecipe)
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

            if (recipe == null)
                continue;

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    }
}
项目:4Space-5    文件:ShapedRecipeHandler.java   
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
        CachedShapedRecipe recipe = null;
        if (irecipe instanceof ShapedRecipes)
            recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
        else if (irecipe instanceof ShapedOreRecipe)
            recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

        if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
            continue;

        recipe.computeVisuals();
        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
项目:CrystalMod    文件:GuiComponentStandardRecipePage.java   
private static Object[] getFirstRecipeForItem(ItemStack resultingItem) {
    Object[] recipeItems = new Object[9];
    for (IRecipe recipe : CraftingManager.getInstance().getRecipeList()) {
        if (recipe == null) continue;

        ItemStack result = recipe.getRecipeOutput();
        if (result == null || !ItemUtil.canCombine(result, resultingItem)) continue;

        Object[] input = getRecipeInput(recipe);
        if (input == null) continue;

        for (int i = 0; i < input.length; i++)
            recipeItems[i] = input[i];
        break;

    }
    return recipeItems;
}
项目:CrystalMod    文件:CraftingPattern.java   
public NonNullList<ItemStack> getOutputs(NonNullList<ItemStack> took) {
    NonNullList<ItemStack> outputs = NonNullList.create();

    InventoryCrafting inv = new InventoryCrafting(new Container() {
        @Override
        public boolean canInteractWith(EntityPlayer player) {
            return false;
        }
    }, 3, 3);

    for (int i = 0; i < 9; ++i) {
        if(i < took.size()){
            ItemStack stack = took.get(i);
            inv.setInventorySlotContents(i, stack);
        }
    }

    ItemStack output = CraftingManager.getInstance().findMatchingRecipe(inv, crafter.getWorld());
    outputs.add(output);

    return outputs;
}
项目:CrystalMod    文件:CraftingPattern.java   
public NonNullList<ItemStack> getByproducts(NonNullList<ItemStack> took) {
    NonNullList<ItemStack> byproducts = NonNullList.create();

    InventoryCrafting inv = new InventoryCrafting(new Container() {
        @Override
        public boolean canInteractWith(EntityPlayer player) {
            return false;
        }
    }, 3, 3);

    for (int i = 0; i < 9; ++i) {
        if(i < took.size())inv.setInventorySlotContents(i, took.get(i));
    }

    for (ItemStack remaining : CraftingManager.getInstance().getRemainingItems(inv, crafter.getWorld())) {
        if (ItemStackTools.isValid(remaining)) {
            byproducts.add(fixItemStack(remaining));
        }
    }

    return byproducts;
}
项目:MidgarCrusade    文件:CraftRegister.java   
public static void load()
{
    CraftingManager craftingManager;

    craftingManager = CraftingManager.getInstance();
    craftingManager.addRecipe(new ItemStack(ItemRegister.BLUE_STICK, 4), new Object[] {"#", "#", '#', new ItemStack(BlockRegister.PLANKS, 1, 0)});
    craftingManager.addRecipe(new ItemStack(Items.stick, 4), new Object[] {"#", "#", '#', new ItemStack(BlockRegister.PLANKS, 1, 1)});

    craftingManager.addRecipe(new ItemStack(BlockRegister.PLANKS, 4, 0), new Object[] {"#", '#', new ItemStack(BlockRegister.LOGS1, 1, 0)});
    craftingManager.addRecipe(new ItemStack(BlockRegister.PLANKS, 4, 0), new Object[] {"#", '#', new ItemStack(BlockRegister.LOGS1, 1, 1)});
    craftingManager.addRecipe(new ItemStack(BlockRegister.PLANKS, 4, 1), new Object[] {"#", '#', new ItemStack(BlockRegister.LOGS1, 1, 2)});
       (new RecipesToolsM()).addRecipes(craftingManager);
       (new RecipesWeaponsM()).addRecipes(craftingManager);
       (new RecipesArmorM()).addRecipes(craftingManager);


       GameRegistry.registerFuelHandler(new FuelHandler());
       GameRegistry.addSmelting(BlockRegister.ORE_SILVER, new ItemStack(ItemRegister.INGOT_SILVER, 1), 0.1f);
       GameRegistry.addSmelting(BlockRegister.ORE_COMBUSTIUM, new ItemStack(ItemRegister.COMBUSTIUM, 1), 0.1f);
       GameRegistry.addSmelting(BlockRegister.ORE_ETHERNIUM, new ItemStack(ItemRegister.ETHERNIUM, 1), 0.1f);
       GameRegistry.addSmelting(BlockRegister.ORE_TITANIUM, new ItemStack(ItemRegister.INGOT_TITANIUM, 1), 0.1f);


}
项目:AquaRegia    文件:ModRecipes.java   
/**
 * Remove all crafting recipes with the specified {@link Item} as their output.
 * <p>
 * Adapted from Rohzek's code in this post:
 * http://www.minecraftforge.net/forum/index.php/topic,33631.0.html
 *
 * @param output The output Item
 */
private static void removeRecipe(Item output) {
    int recipesRemoved = 0;

    final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
    final Iterator<IRecipe> remover = recipes.iterator();

    while (remover.hasNext()) {
        final ItemStack itemstack = remover.next().getRecipeOutput();

        // If the recipe's output Item is the specified Item,
        if (itemstack != null && itemstack.getItem() == output) {
            // Remove the recipe
            remover.remove();
            recipesRemoved++;
        }
    }

    Logger.info("Removed %d recipes for %s", recipesRemoved, output.getRegistryName());
}
项目:AquaRegia    文件:ModRecipes.java   
/**
 * Remove all crafting recipes that are instances of the specified class.
 * <p>
 * Test for this thread:
 * http://www.minecraftforge.net/forum/index.php/topic,33631.0.html
 *
 * @param recipeClass The recipe class
 */
private static void removeRecipeClass(Class<? extends IRecipe> recipeClass) {
    int recipesRemoved = 0;

    final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
    final Iterator<IRecipe> remover = recipes.iterator();

    while (remover.hasNext()) {
        // If the recipe is an instance of the specified class,
        if (recipeClass.isInstance(remover.next())) {
            // Remove the recipe
            remover.remove();
            recipesRemoved++;
        }
    }

    Logger.info("Removed %d recipes for %s", recipesRemoved, recipeClass);
}
项目:BIGB    文件:ShapelessRecipeHandler.java   
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapelessRecipeHandler.class) {
        List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
        for (IRecipe irecipe : allrecipes) {
            CachedShapelessRecipe recipe = null;
            if (irecipe instanceof ShapelessRecipes)
                recipe = shapelessRecipe((ShapelessRecipes) irecipe);
            else if (irecipe instanceof ShapelessOreRecipe)
                recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

            if (recipe == null)
                continue;

            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:BIGB    文件:ShapelessRecipeHandler.java   
@Override
public void loadCraftingRecipes(ItemStack result) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            CachedShapelessRecipe recipe = null;
            if (irecipe instanceof ShapelessRecipes)
                recipe = shapelessRecipe((ShapelessRecipes) irecipe);
            else if (irecipe instanceof ShapelessOreRecipe)
                recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

            if (recipe == null)
                continue;

            arecipes.add(recipe);
        }
    }
}
项目:BIGB    文件:ShapelessRecipeHandler.java   
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
    for (IRecipe irecipe : allrecipes) {
        CachedShapelessRecipe recipe = null;
        if (irecipe instanceof ShapelessRecipes)
            recipe = shapelessRecipe((ShapelessRecipes) irecipe);
        else if (irecipe instanceof ShapelessOreRecipe)
            recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);

        if (recipe == null)
            continue;

        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
项目:BIGB    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
        for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes)
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            else if (irecipe instanceof ShapedOreRecipe)
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

            if (recipe == null)
                continue;

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:BIGB    文件:ShapedRecipeHandler.java   
@Override
public void loadCraftingRecipes(ItemStack result) {
    for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes)
                recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
            else if (irecipe instanceof ShapedOreRecipe)
                recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

            if (recipe == null)
                continue;

            recipe.computeVisuals();
            arecipes.add(recipe);
        }
    }
}
项目:BIGB    文件:ShapedRecipeHandler.java   
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
        CachedShapedRecipe recipe = null;
        if (irecipe instanceof ShapedRecipes)
            recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
        else if (irecipe instanceof ShapedOreRecipe)
            recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);

        if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
            continue;

        recipe.computeVisuals();
        if (recipe.contains(recipe.ingredients, ingredient)) {
            recipe.setIngredientPermutation(recipe.ingredients, ingredient);
            arecipes.add(recipe);
        }
    }
}
项目:malmo    文件:CraftingHelper.java   
/** Attempt to find all recipes that result in an item of the requested output.
 * @param output the desired item, eg from Types.xsd - "diamond_pickaxe" etc - or as a Minecraft name - eg "tile.woolCarpet.blue"
 * @return a list of IRecipe objects that result in this item.
 */
public static List<IRecipe> getRecipesForRequestedOutput(String output)
{
    List<IRecipe> matchingRecipes = new ArrayList<IRecipe>();
    ItemStack target = MinecraftTypeHelper.getItemStackFromParameterString(output);
    List<?> recipes = CraftingManager.getInstance().getRecipeList();
    for (Object obj : recipes)
    {
        if (obj == null)
            continue;
        if (obj instanceof IRecipe)
        {
            ItemStack is = ((IRecipe)obj).getRecipeOutput();
            if (is == null)
                continue;
            if (ItemStack.areItemsEqual(is, target))
            {
                matchingRecipes.add((IRecipe)obj);
            }
        }
    }
    return matchingRecipes;
}
项目:TeambattleMod    文件:ClientRegistryUtil.java   
public static void addTeambattleRecipes() {
    ArrayList<CommonGuiRecipe> stacks = new ArrayList<CommonGuiRecipe>();
    List<IRecipe> re = CraftingManager.getInstance().getRecipeList();
    for (IRecipe r : re) {
        if (r.getRecipeOutput() != null && r.getRecipeOutput().getItem() != null && r.getRecipeOutput().getItem().getRegistryName().startsWith(TeambattleReference.modid)) {
            if (r instanceof ShapedRecipes) {
                ShapedRecipes rep = (ShapedRecipes) r;
                stacks.add(new CommonGuiRecipe(RecipeUtil.matches(rep), rep.getRecipeOutput()));
            } else if (r instanceof ShapelessRecipes) {
                List<ItemStack> rs = ((ShapelessRecipes) r).recipeItems;
                ItemStack[] ar = new ItemStack[rs.size()];
                for (int i = 0; i < ar.length; i++) {
                    ar[i] = rs.get(i);
                }
                stacks.add(new CommonGuiRecipe(ar, r.getRecipeOutput()));
            } else {
                continue;
            }
        }
    }
    guirecipes.addAll(stacks);
}
项目:RorysMod    文件:RoryShapelessRecipeHandler.java   
@SuppressWarnings("unchecked")
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == RoryShapelessRecipeHandler.class) {
        List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();

        for (IRecipe irecipe : allrecipes) {
            if (irecipe instanceof RoryShapelessRecipe) {
                RoryShapelessRecipe rorysmodRecipe = (RoryShapelessRecipe) irecipe;
                CachedRoryShapelessRecipe recipe = new CachedRoryShapelessRecipe(rorysmodRecipe);

                arecipes.add(recipe);
            }
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:RorysMod    文件:RoryShapelessRecipeHandler.java   
@SuppressWarnings("unchecked")
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();

    for (IRecipe irecipe : allrecipes) {
        if (irecipe instanceof RoryShapelessRecipeHandler) {
            RoryShapelessRecipe rorysmodRecipe = (RoryShapelessRecipe) irecipe;
            CachedRoryShapelessRecipe recipe = new CachedRoryShapelessRecipe(rorysmodRecipe);
            if (recipe.contains(recipe.ingredients, ingredient)) {
                recipe.setIngredientPermutation(recipe.ingredients, ingredient);
                arecipes.add(recipe);
            }
        }
    }
}
项目:RorysMod    文件:RoryShapedRecipeHandler.java   
@SuppressWarnings("unchecked")
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
    if (outputId.equals("crafting") && getClass() == RoryShapedRecipeHandler.class) {
        List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();

        for (IRecipe irecipe : allrecipes) {
            if (irecipe instanceof RoryShapedRecipe) {
                RoryShapedRecipe rorysmodRecipe = (RoryShapedRecipe) irecipe;
                CachedShapedRorysModRecipe recipe = new CachedShapedRorysModRecipe(rorysmodRecipe);

                recipe.computeVisuals();
                arecipes.add(recipe);
            }
        }
    } else {
        super.loadCraftingRecipes(outputId, results);
    }
}
项目:RorysMod    文件:RoryShapedRecipeHandler.java   
@SuppressWarnings("unchecked")
@Override
public void loadUsageRecipes(ItemStack ingredient) {
    List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();

    for (IRecipe irecipe : allrecipes) {
        if (irecipe instanceof RoryShapedRecipe) {
            RoryShapedRecipe rorysmodRecipe = (RoryShapedRecipe) irecipe;
            CachedShapedRorysModRecipe recipe = new CachedShapedRorysModRecipe(rorysmodRecipe);

            recipe.computeVisuals();

            if (recipe.contains(recipe.ingredients, ingredient)) {
                recipe.setIngredientPermutation(recipe.ingredients, ingredient);
                arecipes.add(recipe);
            }
        }
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:EntityPopo.java   
private int func_90014_a(EntityAnimal p_90014_1_, EntityAnimal p_90014_2_)
{
    int i = this.func_90013_b(p_90014_1_);
    int j = this.func_90013_b(p_90014_2_);
    this.field_90016_e.getStackInSlot(0).setItemDamage(i);
    this.field_90016_e.getStackInSlot(1).setItemDamage(j);
    ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.field_90016_e, ((EntityPopo)p_90014_1_).worldObj);
    int k;

    if (itemstack != null && itemstack.getItem() == Items.dye)
    {
        k = itemstack.getItemDamage();
    }
    else
    {
        k = this.worldObj.rand.nextBoolean() ? i : j;
    }

    return k;
}