本文整理汇总了Java中net.minecraftforge.oredict.OreIngredient类的典型用法代码示例。如果您正苦于以下问题:Java OreIngredient类的具体用法?Java OreIngredient怎么用?Java OreIngredient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OreIngredient类属于net.minecraftforge.oredict包,在下文中一共展示了OreIngredient类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: genShaped
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
/**
* Same thing as genShaped above, but uses a specific group.
*/
private static ShapedRecipes genShaped(String group, ItemStack output, int l, int w, Object[] input)
{
if (input[0] instanceof List)
input = ((List<?>) input[0]).toArray();
if (l * w != input.length)
throw new UnsupportedOperationException(
"Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME);
NonNullList<Ingredient> inputL = NonNullList.create();
for (int i = 0; i < input.length; i++)
{
Object k = input[i];
if (k instanceof String)
inputL.add(i, new OreIngredient((String) k));
else if (k instanceof ItemStack && !((ItemStack) k).isEmpty())
inputL.add(i, Ingredient.fromStacks((ItemStack) k));
else if (k instanceof IForgeRegistryEntry)
inputL.add(i, Ingredient.fromStacks(makeStack((IForgeRegistryEntry<?>) k)));
else
inputL.add(i, Ingredient.EMPTY);
}
return new ShapedRecipes(group, l, w, inputL, output);
}
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:27,代码来源:RecipeHelper.java
示例2: createInput
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
/**
* Creates a list of ingredients based on an Object[]. Valid types are {@link String}, {@link ItemStack}, {@link Item}, and {@link Block}.
* Used for shapeless recipes.
*/
private static NonNullList<Ingredient> createInput(Object[] input)
{
if (input[0] instanceof List)
input = ((List<?>) input[0]).toArray();
else if (input[0] instanceof Object[])
input = (Object[]) input[0];
NonNullList<Ingredient> inputL = NonNullList.create();
for (int i = 0; i < input.length; i++)
{
Object k = input[i];
if (k instanceof String)
inputL.add(i, new OreIngredient((String) k));
else if (k instanceof ItemStack && !((ItemStack) k).isEmpty())
inputL.add(i, Ingredient.fromStacks((ItemStack) k));
else if (k instanceof IForgeRegistryEntry)
inputL.add(i, Ingredient.fromStacks(makeStack((IForgeRegistryEntry<?>) k)));
else
throw new UnsupportedOperationException(
"Attempted to add invalid shapeless recipe. Complain to the author of " + MODNAME);
}
return inputL;
}
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:27,代码来源:RecipeHelper.java
示例3: createElementalInput
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
/**
* Creates a list of ingredients based on an Object[]. Valid types are {@link String}, {@link ItemStack}, {@link Item}, and {@link Block}.
* Used for elemental recipes.
*/
private static NonNullList<Ingredient> createElementalInput(Object[] input)
{
if (input[0] instanceof List)
input = ((List<?>) input[0]).toArray();
else if (input[0] instanceof Object[])
input = (Object[]) input[0];
NonNullList<Ingredient> inputL = NonNullList.withSize(9, Ingredient.EMPTY);
for (int i = 0; i < input.length; i++)
{
Object k = input[i];
if (k instanceof String)
inputL.set(i, new OreIngredient((String) k));
else if (k instanceof ItemStack && !((ItemStack) k).isEmpty())
inputL.set(i, Ingredient.fromStacks((ItemStack) k));
else if (k instanceof IForgeRegistryEntry)
inputL.set(i, Ingredient.fromStacks(makeStack((IForgeRegistryEntry<?>) k)));
}
return inputL;
}
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:24,代码来源:RecipeHelper.java
示例4: getToolHeadSchematicRecipe
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
private static IRecipe getToolHeadSchematicRecipe(ItemStack output, String material, String type, int cost) {
NonNullList<Ingredient> inputs = NonNullList.withSize(cost + 1, Ingredient.EMPTY);
ItemStack schematic = new ItemStack(ModItems.schematic);
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(ItemSchematic.type_tag, type);
schematic.setTagCompound(nbt);
Ingredient schematicIngredient = new IngredientNBT(schematic) {
};
inputs.set(0, schematicIngredient);
for (int i = 1; i <= cost; i++) {
inputs.set(i, new OreIngredient(material));
}
return new ShapelessOreRecipe(null, inputs, output);
}
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:17,代码来源:ModRecipes.java
示例5: test_isSameRecipeInput
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
@Test
public void test_isSameRecipeInput()
{
assertTrue(ItemHelper.isSameRecipeInput(new OreIngredient("stickWood"), "stickWood"));
assertFalse(ItemHelper.isSameRecipeInput(new OreIngredient("stickWood"), "oreIron"));
assertTrue(ItemHelper.isSameRecipeInput(Ingredient.fromItem(Items.APPLE), new ItemStack(Items.APPLE)));
assertFalse(ItemHelper.isSameRecipeInput(Ingredient.fromItem(Items.APPLE), new ItemStack(Items.DIAMOND_SWORD)));
NonNullList<ItemStack> stickWoodList = OreDictionary.getOres("stickWood");
ItemStack[] stickWood = stickWoodList.toArray(new ItemStack[0]);
assertTrue(ItemHelper.isSameRecipeInput(Ingredient.fromStacks(stickWood), stickWoodList));
assertFalse(ItemHelper.isSameRecipeInput(Ingredient.fromStacks(stickWood), OreDictionary.getOres("ingotIron")));
assertTrue(ItemHelper.isSameRecipeInput(Ingredient.fromStacks(stickWood), new ItemStack(Items.STICK)));
assertTrue(ItemHelper.isSameRecipeInput(Ingredient.fromItem(Items.STICK), stickWoodList));
assertFalse(ItemHelper.isSameRecipeInput(Ingredient.fromStacks(stickWood), new ItemStack(Items.DIAMOND_PICKAXE)));
}
开发者ID:cubex2,项目名称:customstuff4,代码行数:20,代码来源:ItemHelperTests.java
示例6: RecipeSockRainbow
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
public RecipeSockRainbow(ResourceLocation location, String group) {
super(location, group, true, 3, 3);
ingredients.add(new OreIngredient("dyeRed"));
ingredients.add(Ingredient.EMPTY);
ingredients.add(new OreIngredient("dyeLime"));
ingredients.add(new OreIngredient("dyeOrange"));
ingredients.add(Ingredient.fromStacks(new ItemStack(PonySocks.sock, 1, 0)));
ingredients.add(new OreIngredient("dyeLightBlue"));
ingredients.add(new OreIngredient("dyeYellow"));
ingredients.add(Ingredient.EMPTY);
ingredients.add(new OreIngredient("dyePurple"));
}
开发者ID:asiekierka,项目名称:PonySocks2,代码行数:16,代码来源:RecipeSockRainbow.java
示例7: addIngotToGearRecipe
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
public static void addIngotToGearRecipe(String metalName)
{
ItemStack gearStack = new ItemStack(QBarItems.METALGEAR, 1, QBarMaterials.metals.indexOf(metalName));
QBarRecipeHandler.CRAFTING_RECIPES.add(new ShapedOreRecipe(new ResourceLocation(QBarConstants.MODID, "gear" +
metalName), gearStack, " X ", "XOX", " X ", 'X',
new OreIngredient("ingot" + StringUtils.capitalize(metalName)), 'O', new ItemStack(Items.IRON_INGOT))
.setRegistryName(new ResourceLocation(QBarConstants.MODID, "gear" + metalName)));
}
开发者ID:OPMCorp,项目名称:Qbar,代码行数:10,代码来源:QBarRecipeHelper.java
示例8: addBlockToIngotRecipe
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
public static void addBlockToIngotRecipe(String metalName)
{
ItemStack ingotStack = new ItemStack(QBarItems.METALINGOT, 9, QBarMaterials.metals.indexOf(metalName));
QBarRecipeHandler.CRAFTING_RECIPES
.add(new ShapelessOreRecipe(new ResourceLocation(QBarConstants.MODID, "block" + metalName), ingotStack,
new OreIngredient("block" + StringUtils.capitalize(metalName)))
.setRegistryName(new ResourceLocation(QBarConstants.MODID, "block" + metalName)));
}
开发者ID:OPMCorp,项目名称:Qbar,代码行数:10,代码来源:QBarRecipeHelper.java
示例9: addIngotToBlockRecipe
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
public static void addIngotToBlockRecipe(String metalName)
{
ItemStack blockStack = new ItemStack(QBarBlocks.METALBLOCK, 1, QBarMaterials.metals.indexOf(metalName));
QBarRecipeHandler.CRAFTING_RECIPES
.add(new ShapedOreRecipe(new ResourceLocation(QBarConstants.MODID, "block_ingot" + metalName),
blockStack, "XXX", "XXX", "XXX", 'X',
new OreIngredient("ingot" + StringUtils.capitalize(metalName)))
.setRegistryName(new ResourceLocation(QBarConstants.MODID, "block_ingot" + metalName)));
}
开发者ID:OPMCorp,项目名称:Qbar,代码行数:11,代码来源:QBarRecipeHelper.java
示例10: create
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
public static Ingredient create() {
Set<Ingredient> ingredients = new HashSet<>();
for (EnumColour c : EnumColour.values()) {
ingredients.add(new OreIngredient(c.getDyeOreName()));
}
return new MultiIngredient(ingredients);
}
开发者ID:TheCBProject,项目名称:EnderStorage,代码行数:8,代码来源:Factories.java
示例11: parse
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
@Nonnull
@Override
public Ingredient parse(JsonContext context, JsonObject json) {
Set<Ingredient> ingredients = new HashSet<>();
for (EnumColour c : EnumColour.values()) {
ingredients.add(new OreIngredient(c.getWoolOreName()));
}
return new MultiIngredient(ingredients);
}
开发者ID:TheCBProject,项目名称:EnderStorage,代码行数:10,代码来源:Factories.java
示例12: registerRecipes
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
@Override
public void registerRecipes(List<IRecipe> recipes) {
recipes.add(new ShapelessOreRecipe(null, new ItemStack(steelNugget, 9), new OreIngredient("ingotSteel")));
}
开发者ID:canitzp,项目名称:Metalworks,代码行数:5,代码来源:Registry.java
示例13: AnalysisStack
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
protected AnalysisStack(String ore)
{
this(new OreIngredient(ore));
}
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:5,代码来源:AnalysisStack.java
示例14: priceCraftedItems
import net.minecraftforge.oredict.OreIngredient; //导入依赖的package包/类
private void priceCraftedItems() {
// FMLLog.log.info("in autoPriceCraftedItems");
Set<ResourceLocation> recipeResourceLocations = CraftingManager.REGISTRY.getKeys();
boolean priceUpdate = false;
// we rerun multiple times if needed since recipe components might be
// priced in previous runs
int loopCount = 0;
do {
loopCount++;
// FMLLog.log.info("priceUpdate loop: " + loopCount);
priceUpdate = false;
for (ResourceLocation rloc : recipeResourceLocations) {
IRecipe irecipe = CraftingManager.getRecipe(rloc);
int itemCost = 0;
boolean validRecipe = true;
ItemStack output = irecipe.getRecipeOutput();
// FMLLog.log.info("Recipe output: " + output.getDisplayName());
if (output == null || output.getItem() == Items.AIR) {
continue;
}
if (UCItemPricer.getInstance().getItemPrice(output) != -1) {
// FMLLog.log.info("recipe output price already set.");
continue;
}
// FMLLog.log.info("Starting pricing for " +
// output.getDisplayName());
NonNullList<Ingredient> recipeItems = irecipe.getIngredients();
for (int i = 0; i < recipeItems.size(); i++) {
ItemStack stack = null;
// FMLLog.log.info("Ingredient: " + recipeItems.get(i));
if (recipeItems.get(i) instanceof OreIngredient) {
OreIngredient test = (OreIngredient) recipeItems.get(i);
if (test.getMatchingStacks().length > 0)
stack = test.getMatchingStacks()[0];
// TODO iterate and check for priced items
} else {
if (recipeItems.get(i).getMatchingStacks().length > 0) {
stack = recipeItems.get(i).getMatchingStacks()[0];
// TODO do we need to iterate here?
}
}
if (stack == null)
continue;
// FMLLog.log.info("recipe ingredient " + i + " " +
// stack.getDisplayName());
// FMLLog.log.info("price: " +
// UCItemPricer.getInstance().getItemPrice(stack));
if (UCItemPricer.getInstance().getItemPrice(stack) != -1) {
itemCost += UCItemPricer.getInstance().getItemPrice(stack);
} else {
validRecipe = false;
// FMLLog.log.info("can't price " +
// output.getDisplayName());
break;
}
}
if (validRecipe && itemCost > 0) {
priceUpdate = true;
if (output.getCount() > 1) {
itemCost = itemCost / output.getCount();
}
try {
// FMLLog.log.info("Setting price of " +
// output.getDisplayName() + " to " + itemCost);
UCItemPricer.getInstance().setItemPrice(output, itemCost);
} catch (Exception e) {
FMLLog.log.warn(
"Universal Coins Autopricer: Failed to set item price: " + output.getUnlocalizedName());
}
}
}
} while (priceUpdate == true);
}
开发者ID:notabadminer,项目名称:UniversalCoins,代码行数:75,代码来源:UCItemPricer.java
注:本文中的net.minecraftforge.oredict.OreIngredient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论