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


Java IIngredient类代码示例

本文整理汇总了Java中minetweaker.api.item.IIngredient的典型用法代码示例。如果您正苦于以下问题:Java IIngredient类的具体用法?Java IIngredient怎么用?Java IIngredient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addMelting

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
/**********************************************
 * TConstruct Melting Recipes
 **********************************************/

// Adding a Meltery Recipe
@ZenMethod
public static void addMelting(ILiquidStack output, IIngredient input, int temp) {
	if (input == null || output == null) {
		LogHelper.logError(String.format("Required parameters missing for %s Recipe.", nameMelting));
		return;
	}

	List<MelteryRecipe> recipes = new LinkedList<>();
	for (IItemStack in : input.getItems()) {
		recipes.add(new MelteryRecipe(new RecipeMatch.ItemCombination(output.getAmount(), toStack(in)), toFluid(output), temp));
	}

	if (!recipes.isEmpty()) {
		MineTweakerAPI.apply(new AddMelting(recipes));
	} else {
		LogHelper.logError(String.format("No %s recipes could be added for input %s.", nameMelting, input.toString()));
	}
}
 
开发者ID:primetoxinz,项目名称:Meltery,代码行数:24,代码来源:Minetweaker.java

示例2: set

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
@ZenMethod
public static void set(IIngredient item, int price) {
    if (!MCE.available) {
        MineTweakerAPI.getLogger().logError("MCE support not available.");
        return;
    }
    Object citem = toObject(item);
    if (citem == null) {
        MineTweakerAPI.getLogger().logError("Set price: item must not be null!");
        return;
    }
    if (!((citem instanceof String) || (citem instanceof ItemStack))) {
        MineTweakerAPI.getLogger().logError("Set price: unsupported item type!");
        return;
    }
    MineTweakerAPI.apply(new PriceSet(citem, price));
}
 
开发者ID:Belgabor,项目名称:AMTweaker,代码行数:18,代码来源:Price.java

示例3: convertShapelessIngredients

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
private static OreRecipeElement[] convertShapelessIngredients(IIngredient[] inputs)
{	
	OreRecipeElement[] convertedIngredients = new OreRecipeElement[inputs.length];
	for(int i = 0; i < inputs.length; i++)
	{
		IIngredient ingredient = inputs[i];
		if(ingredient instanceof IOreDictEntry)
		{
			convertedIngredients[i] = new OreRecipeElement(((IOreDictEntry) ingredient).getName(), 1);
		}
		else if(ingredient instanceof IItemStack)
		{
			convertedIngredients[i] = new OreRecipeElement(MineTweakerMC.getItemStack(ingredient));
		}
	}
	return convertedIngredients;
}
 
开发者ID:einsteinsci,项目名称:betterbeginnings-MC1.7,代码行数:18,代码来源:OvenTweaker.java

示例4: remove

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
@ZenMethod
public static void remove(IIngredient item) {
    if (!MCE.available) {
        MineTweakerAPI.getLogger().logError("MCE support not available.");
        return;
    }
    Object citem = toObject(item, true);
    if (citem == null) {
        MineTweakerAPI.getLogger().logError("Price removal: Item may not be null!");
        return;
    }
    if (MCEAccessHelper.findPurchaseItem(citem) == null) {
        MineTweakerAPI.getLogger().logError("Price removal: Item has no price!");
        return;
    }
    MineTweakerAPI.apply(new PriceRemove(citem));
}
 
开发者ID:Belgabor,项目名称:AMTweaker,代码行数:18,代码来源:Price.java

示例5: convertCatalysts

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
private static OreRecipeElement[] convertCatalysts(IIngredient[] catalysts)
{
	OreRecipeElement[] convertedCatalysts = new OreRecipeElement[catalysts.length];
	for(int i = 0; i < catalysts.length; i++)
	{
		IIngredient ingredient = catalysts[i];
		if(ingredient instanceof IOreDictEntry)
		{
			convertedCatalysts[i] = new OreRecipeElement(((IOreDictEntry) ingredient).getName(), ingredient.getAmount());
		}
		else if(ingredient instanceof IItemStack)
		{
			convertedCatalysts[i] = new OreRecipeElement(MineTweakerMC.getItemStack(ingredient));
		}
		else if (ingredient instanceof IngredientStack)
		{
			ItemStack[] validItems = MineTweakerMC.getItemStacks(ingredient.getItems());
			for(ItemStack stack : validItems)
			{
				stack.stackSize = ingredient.getAmount();
			}
			convertedCatalysts[i] = new OreRecipeElement(validItems, ingredient.getAmount());
		}
	}
	return convertedCatalysts;
}
 
开发者ID:einsteinsci,项目名称:betterbeginnings-MC1.7,代码行数:27,代码来源:AdvancedCraftingTweaker.java

示例6: doAddRecipe

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
private static void doAddRecipe(IItemStack output, IItemStack secondary, IIngredient[] inputs, boolean isFoodRecipe, Float secondaryChance, boolean forceReturnContainer, int tier) {
    if (isFoodRecipe) {
        if (tier>=0)
            MineTweakerAPI.getLogger().logWarning("Processor: Food processor recipes only support tier -1");
        tier = -1;
    }
    if (inputs == null) {
        MineTweakerAPI.getLogger().logError("Processor: Input set must not be null!");
        return;
    }
    if (inputs.length == 0) {
        MineTweakerAPI.getLogger().logError("Processor: Input set must not empty!");
        return;
    }
    if ((output == null) && (secondary == null)) {
        MineTweakerAPI.getLogger().logError("Processor: Primary and secondary output must not both be null!");
        return;
    }
    MineTweakerAPI.apply(new Add(new ProcessorRecipeWrapper(output, secondary, inputs, isFoodRecipe, secondaryChance, forceReturnContainer, tier)));
}
 
开发者ID:Belgabor,项目名称:AMTweaker,代码行数:21,代码来源:Processor.java

示例7: removeFondueSource

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
@ZenMethod
public static void removeFondueSource(IIngredient input, int beforeType) {
    Object cinput = toObject(input, true);
    if (cinput == null) {
        MineTweakerAPI.getLogger().logError("Fondue Source removal: Input may not be null!");
        return;
    }
    if ((beforeType < 0) || (beforeType >= SoupType.types.length)) {
        MineTweakerAPI.getLogger().logError(String.format("Fondue Source removal: Unknown soup type %d for input item %s", beforeType, input.toString()));
        return;
    }
    if (findSource(cinput, beforeType) == null) {
        MineTweakerAPI.getLogger().logError(String.format("Fondue Source removal: Input item %s has no recipe for soup type %d (%s)", input.toString(), beforeType, SoupType.getType(beforeType).display));
        return;
    }
    MineTweakerAPI.apply(new SourceRemove(cinput, beforeType));
}
 
开发者ID:Belgabor,项目名称:AMTweaker,代码行数:18,代码来源:Pan.java

示例8: addRecipe

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
/**
 * Adds an Arc Furnace recipe.
 *
 * @param outputs       1-4 recipe output
 * @param fluidOutput   primary fluidOutput
 * @param input         primary input
 * @param fluidInput    primary fluidInput
 * @param outChances    chances of 1-4 output
 * @param durationTicks assembling duration, in ticks
 * @param euPerTick     eu consumption per tick
 */
@ZenMethod
public static void addRecipe(IItemStack[] outputs, ILiquidStack fluidOutput, IIngredient input, ILiquidStack fluidInput, int[] outChances, int durationTicks, int euPerTick) {
    if (outputs.length < 1) {
        MineTweakerAPI.logError("Plasma Arc Furnace must have at least 1 output");
    } else if (outputs.length != outChances.length) {
        MineTweakerAPI.logError("Number of Outputs does not equal number of Chances");
    } else {
        MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Plasma Arc Furnace recipe for " + input, input, fluidInput, outputs, fluidOutput, outChances, durationTicks, euPerTick) {
            @Override
            protected void applySingleRecipe(ArgIterator i) {
                RA.addPlasmaArcFurnaceRecipe(i.nextItem(), i.nextFluid(), i.nextItemArr(), i.nextFluid(), i.nextIntArr(), i.nextInt(), i.nextInt());
            }
        });
    }
}
 
开发者ID:GTNewHorizons,项目名称:Minetweaker-Gregtech-5-Addon,代码行数:27,代码来源:PlasmaArcFurnace.java

示例9: addRecipe

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
/**
 * Adds a Centrifuge recipe.
 *
 * @param outputs       array with 1-6 outputs
 * @param fluidOutput   primary fluid output
 * @param input1        primary input
 * @param input2        Cell input
 * @param fluidInput    primary fluid input
 * @param chances       chance 1-6
 * @param durationTicks reaction time, in ticks
 * @param euPerTick     eu consumption per tick
 */
@ZenMethod
public static void addRecipe(IItemStack[] outputs, ILiquidStack fluidOutput, IIngredient input1, IIngredient input2, ILiquidStack fluidInput, int[] chances, int durationTicks, int euPerTick) {
    if (outputs.length < 1) {
        MineTweakerAPI.logError("Centrifuge must have at least 1 output");
    } else if (outputs.length != chances.length) {
        MineTweakerAPI.logError("Number of Outputs does not equal number of Chances");
    } else {
        MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Centrifuge recipe with Fluids for " + input1, input1, input2, fluidOutput, fluidInput, outputs[0],
                itemOrNull(outputs, 1), itemOrNull(outputs, 2), itemOrNull(outputs, 3), itemOrNull(outputs, 4), itemOrNull(outputs, 5), chances, durationTicks, euPerTick) {
            @Override
            protected void applySingleRecipe(ArgIterator i) {
                RA.addCentrifugeRecipe(i.nextItem(), i.nextItem(), i.nextFluid(), i.nextFluid(), i.nextItem(), i.nextItem(),
                        i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextIntArr(), i.nextInt(), i.nextInt());
            }
        });
    }
}
 
开发者ID:GTNewHorizons,项目名称:Minetweaker-Gregtech-5-Addon,代码行数:30,代码来源:Centrifuge.java

示例10: addRecipe

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
/**
 * Adds a Separator recipe.
 *
 * @param input         recipe input
 * @param output        Item output Slot 1-3
 * @param outChances    Item output chances
 * @param durationTicks reaction time, in ticks
 * @param euPerTick     eu consumption per tick
 */
@ZenMethod
public static void addRecipe(IItemStack[] output, IIngredient input, int[] outChances, int durationTicks, int euPerTick) {
    if (output.length < 1) {
        MineTweakerAPI.logError("Seperator must have at least 1 output");
    } else if (output.length != outChances.length) {
        MineTweakerAPI.logError("Number of Outputs does not equal number of Chances");
    } else {
        MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Separator recipe for " + input, input, output[0], itemOrNull(output, 1), itemOrNull(output, 2), outChances, durationTicks, euPerTick) {
            @Override
            protected void applySingleRecipe(ArgIterator i) {
                RA.addElectromagneticSeparatorRecipe(i.nextItem(), i.nextItem(), i.nextItem(), i.nextItem(), i.nextIntArr(), i.nextInt(), i.nextInt());
            }
        });
    }
}
 
开发者ID:GTNewHorizons,项目名称:Minetweaker-Gregtech-5-Addon,代码行数:25,代码来源:Separator.java

示例11: addRecipe

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
/**
 * Adds a Pulverizer recipe.
 *
 * @param outputs       recipe outputs
 * @param input         primary input
 * @param outChances    Chances for Outputs
 * @param durationTicks reaction time, in ticks
 * @param euPerTick     eu consumption per tick
 */
@ZenMethod
public static void addRecipe(IItemStack[] outputs, IIngredient input, int[] outChances, int durationTicks, int euPerTick) {
    if (outputs.length < 1) {
        MineTweakerAPI.logError("Pulverizer must have at least 1 output");
    } else if (outputs.length != outChances.length) {
        MineTweakerAPI.logError("Number of Outputs does not equal number of Chances");
    } else {
        MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Pulverizer recipe for " + input, input, outputs, outChances, durationTicks, euPerTick) {
            @Override
            protected void applySingleRecipe(ArgIterator i) {
                RA.addPulveriserRecipe(i.nextItem(), i.nextItemArr(), i.nextIntArr(), i.nextInt(), i.nextInt());
            }
        });
    }
}
 
开发者ID:GTNewHorizons,项目名称:Minetweaker-Gregtech-5-Addon,代码行数:25,代码来源:Pulverizer.java

示例12: addRecipe

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
/**
 * Adds a Sifter recipe.
 *
 * @param outputs       1-9 outputs
 * @param input         primary input
 * @param outChances    chances of 1-9 output
 * @param durationTicks reaction time, in ticks
 * @param euPerTick     eu consumption per tick
 */
@ZenMethod
public static void addRecipe(IItemStack[] outputs, IIngredient input, int[] outChances, int durationTicks, int euPerTick) {
    if (outputs.length < 1) {
        MineTweakerAPI.logError("Sifter must have at least 1 output");
    } else if (outputs.length != outChances.length) {
        MineTweakerAPI.logError("Number of Outputs does not equal number of Chances");
    } else {
        MineTweakerAPI.apply(new AddMultipleRecipeAction("Adding Sifter recipe for " + input, input, outputs, outChances, durationTicks, euPerTick) {
            @Override
            protected void applySingleRecipe(ArgIterator i) {
                RA.addSifterRecipe(i.nextItem(), i.nextItemArr(), i.nextIntArr(), i.nextInt(), i.nextInt());
            }
        });
    }
}
 
开发者ID:GTNewHorizons,项目名称:Minetweaker-Gregtech-5-Addon,代码行数:25,代码来源:Sifter.java

示例13: getItemStackArrays

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
private List<ItemStack[]> getItemStackArrays(IIngredient[] recipeArg) {
    List<List<Object>> tempArgs = createNewMatrix(recipeArg.length);
    for (IIngredient ingredient : recipeArg) {
        extendByMultiple(getItemStacks(ingredient), tempArgs);
    }

    List<ItemStack[]> result = new ArrayList<ItemStack[]>(tempArgs.size());
    for (List<Object> tempArg : tempArgs) {
        ItemStack[] arg = new ItemStack[tempArg.size()];
        for (int i = 0; i < arg.length; i++)
            arg[i] = (ItemStack) tempArg.get(i);
        result.add(arg);
    }

    return result;
}
 
开发者ID:GTNewHorizons,项目名称:Minetweaker-Gregtech-5-Addon,代码行数:17,代码来源:AddMultipleRecipeAction.java

示例14: removeFondueRecipe

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
@ZenMethod
public static void removeFondueRecipe(IIngredient input, int type) {
    Object cinput = toObject(input, true);
    if (cinput == null) {
        MineTweakerAPI.getLogger().logError("Fondue Recipe removal: Input may not be null!");
        return;
    }
    if ((type < 0) || (type >= SoupType.types.length)) {
        MineTweakerAPI.getLogger().logError(String.format("Fondue Recipe removal: Unknown soup type %d for input item %s", type, input.toString()));
        return;
    }
    if (findRecipe(cinput, type) == null) {
        MineTweakerAPI.getLogger().logError(String.format("Fondue Recipe removal: Input item %s has no recipe for soup type %d (%s)", input.toString(), type, SoupType.getType(type).display));
        return;
    }
    MineTweakerAPI.apply(new ChocolateRemove(cinput, type));
}
 
开发者ID:Belgabor,项目名称:AMTweaker,代码行数:18,代码来源:Pan.java

示例15: addShapeless

import minetweaker.api.item.IIngredient; //导入依赖的package包/类
@ZenMethod
public static void addShapeless(IItemStack output, IIngredient[] inputs) {
    if (inputs == null) {
        MineTweakerAPI.getLogger().logError("Large Furnace: Input set must not be null!");
        return;
    }
    if (inputs.length == 0) {
        MineTweakerAPI.getLogger().logError("Large Furnace: Input set must not empty!");
        return;
    }
    if (output == null) {
        MineTweakerAPI.getLogger().logError("Large Furnace: Output must not be null!");
        return;
    }
    ShapelessOreRecipe recipe = constructSafely(toStack(output), toObjects(inputs));
    if (recipe == null) {
        MineTweakerAPI.getLogger().logError("Large Furnace: Illegal recipe.");
        return;
    }
    MineTweakerAPI.apply(new FurnaceAdd(output, recipe));
}
 
开发者ID:Belgabor,项目名称:AMTweaker,代码行数:22,代码来源:LargeFurnace.java


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