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


Java ShapedRecipes类代码示例

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


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

示例1: genShaped

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的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: RecipeSorter

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
private RecipeSorter()
{
    register("minecraft:shaped",       ShapedRecipes.class,       SHAPED,    "before:minecraft:shapeless");
    register("minecraft:mapextending", RecipesMapExtending.class, SHAPED,    "after:minecraft:shaped before:minecraft:shapeless");
    register("minecraft:shapeless",    ShapelessRecipes.class,    SHAPELESS, "after:minecraft:shaped");
    register("minecraft:shield_deco",  ShieldRecipes.Decoration.class, SHAPELESS, "after:minecraft:shapeless"); //Size 2
    register("minecraft:repair",       RecipeRepairItem.class,    SHAPELESS, "after:minecraft:shapeless"); //Size 4
    register("minecraft:bookcloning",  RecipeBookCloning.class,   SHAPELESS, "after:minecraft:shapeless"); //Size 9
    register("minecraft:tippedarrow",  RecipeTippedArrow.class,   SHAPELESS, "after:minecraft:shapeless"); //Size 9
    register("minecraft:fireworks",    RecipeFireworks.class,     SHAPELESS, "after:minecraft:shapeless"); //Size 10
    register("minecraft:armordyes",    RecipesArmorDyes.class,    SHAPELESS, "after:minecraft:shapeless"); //Size 10
    register("minecraft:mapcloning",   RecipesMapCloning.class,   SHAPELESS, "after:minecraft:shapeless"); //Size 10
    register("minecraft:pattern_dupe", RecipeDuplicatePattern.class, SHAPELESS, "after:minecraft:shapeless"); //Size 2
    register("minecraft:pattern_add",  RecipeAddPattern.class,       SHAPELESS, "after:minecraft:shapeless"); //Size 10

    register("forge:shapedore",     ShapedOreRecipe.class,    SHAPED,    "after:minecraft:shaped before:minecraft:shapeless");
    register("forge:shapelessore",  ShapelessOreRecipe.class, SHAPELESS, "after:minecraft:shapeless");
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:RecipeSorter.java

示例3: ShapedOreRecipe

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
ShapedOreRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements)
{
    output = recipe.getRecipeOutput();
    width = recipe.recipeWidth;
    height = recipe.recipeHeight;

    input = new Object[recipe.recipeItems.length];

    for(int i = 0; i < input.length; i++)
    {
        ItemStack ingredient = recipe.recipeItems[i];

        if(ingredient == null) continue;

        input[i] = recipe.recipeItems[i];

        for(Entry<ItemStack, String> replace : replacements.entrySet())
        {
            if(OreDictionary.itemMatches(replace.getKey(), ingredient, true))
            {
                input[i] = OreDictionary.getOres(replace.getValue());
                break;
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:ShapedOreRecipe.java

示例4: loadUsageRecipes

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
public void loadUsageRecipes(final ItemStack ingredient) {
    for (final IRecipe irecipe : EnderConstructorRecipesHandler.recipes) {
        ShapedRecipeHandler.CachedShapedRecipe recipe = null;
        if (irecipe instanceof ShapedRecipes) {
            recipe = new ShapedRecipeHandler.CachedShapedRecipe((ShapedRecipes)irecipe);
        }
        else if (irecipe instanceof ShapedOreRecipe) {
            recipe = this.forgeShapedRecipe((ShapedOreRecipe)irecipe);
        }
        if (recipe != null) {
            if (!recipe.contains((Collection)recipe.ingredients, ingredient.getItem())) {
                continue;
            }
            recipe.computeVisuals();
            if (!recipe.contains((Collection)recipe.ingredients, ingredient)) {
                continue;
            }
            recipe.setIngredientPermutation((Collection)recipe.ingredients, ingredient);
            this.arecipes.add(recipe);
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:23,代码来源:EnderConstructorHandler.java

示例5: loadCraftingRecipes

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
public void loadCraftingRecipes(final String outputId, final Object... results) {
    if (outputId.equals(this.getOverlayIdentifier())) {
        for (final IRecipe irecipe : EnderConstructorRecipesHandler.recipes) {
            ShapedRecipeHandler.CachedShapedRecipe recipe = null;
            if (irecipe instanceof ShapedRecipes) {
                recipe = new ShapedRecipeHandler.CachedShapedRecipe((ShapedRecipes)irecipe);
            }
            else if (irecipe instanceof ShapedOreRecipe) {
                recipe = this.forgeShapedRecipe((ShapedOreRecipe)irecipe);
            }
            if (recipe == null) {
                continue;
            }
            recipe.computeVisuals();
            this.arecipes.add(recipe);
        }
    }
    else if (outputId.equals("item")) {
        this.loadCraftingRecipes((ItemStack)results[0]);
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:22,代码来源:EnderConstructorHandler.java

示例6: loadCraftingRecipes

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
public void loadCraftingRecipes(final ItemStack result) {
    if (!result.hasTagCompound() || "".equals(result.getTagCompound().getString("mat"))) {
        return;
    }
    final MicroMaterialRegistry.IMicroMaterial m = MicroMaterialRegistry.getMaterial(result.getTagCompound().getString("mat"));
    if (m == null) {
        return;
    }
    this.scroll = false;
    this.currentMaterial = result.getTagCompound().getString("mat");
    this.currentBlock = m.getItem().copy();
    for (final ShapedRecipes irecipe : getCraftingRecipes()) {
        if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
            final MicroblockCachedRecipe recipe = new MicroblockCachedRecipe(irecipe);
            recipe.computeVisuals();
            this.arecipes.add(recipe);
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:20,代码来源:FMPMicroBlocksHandler.java

示例7: loadRecipes

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
public static ArrayList<ShapedRecipes> loadRecipes() {
    final ArrayList<ShapedRecipes> set = new ArrayList<ShapedRecipes>();
    FMPMicroBlockRecipeCreator.mat = MicroRecipe.findMaterial(FMPMicroBlockRecipeCreator.stone);
    if (FMPMicroBlockRecipeCreator.mat == -1) {
        return set;
    }
    FMPMicroBlockRecipeCreator.saw = new ItemStack(MicroblockProxy.sawDiamond());
    if (FMPMicroBlockRecipeCreator.saw == null) {
        return set;
    }
    loadThinningRecipes(set);
    loadSplittingRecipes(set);
    loadHollowRecipes(set);
    loadHollowFillingRecipes(set);
    loadGluingRecipes(set);
    return set;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:18,代码来源:FMPMicroBlockRecipeCreator.java

示例8: loadThinningRecipes

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
public static void loadThinningRecipes(final ArrayList<ShapedRecipes> recipes) {
    FMPMicroBlockRecipeCreator.craft.clear();
    FMPMicroBlockRecipeCreator.craft.setInventorySlotContents(0, 0, FMPMicroBlockRecipeCreator.saw);
    for (final int mclass : FMPMicroBlockRecipeCreator.validClasses) {
        for (final int msize : FMPMicroBlockRecipeCreator.validSizes2) {
            if (msize != 8 || mclass == 0) {
                final ItemStack a = MicroRecipe.create(1, mclass, msize, FMPMicroBlockRecipeCreator.mat);
                FMPMicroBlockRecipeCreator.craft.setInventorySlotContents(0, 1, a);
                final ItemStack b = MicroRecipe.getCraftingResult((InventoryCrafting)FMPMicroBlockRecipeCreator.craft);
                if (b != null) {
                    recipes.add(new ShapedRecipes(1, 2, new ItemStack[] { FMPMicroBlockRecipeCreator.saw, a }, b));
                }
            }
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:17,代码来源:FMPMicroBlockRecipeCreator.java

示例9: loadSplittingRecipes

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
public static void loadSplittingRecipes(final ArrayList<ShapedRecipes> recipes) {
    FMPMicroBlockRecipeCreator.craft.clear();
    FMPMicroBlockRecipeCreator.craft.setInventorySlotContents(0, 0, FMPMicroBlockRecipeCreator.saw);
    for (final int mclass : FMPMicroBlockRecipeCreator.validClasses) {
        for (final int msize : FMPMicroBlockRecipeCreator.validSizes2) {
            if (msize != 8 || mclass == 0) {
                final ItemStack a = MicroRecipe.create(1, mclass, msize, FMPMicroBlockRecipeCreator.mat);
                FMPMicroBlockRecipeCreator.craft.setInventorySlotContents(1, 0, a);
                final ItemStack b = MicroRecipe.getCraftingResult((InventoryCrafting)FMPMicroBlockRecipeCreator.craft);
                if (b != null) {
                    recipes.add(new ShapedRecipes(2, 1, new ItemStack[] { FMPMicroBlockRecipeCreator.saw, a }, b));
                }
            }
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:17,代码来源:FMPMicroBlockRecipeCreator.java

示例10: registerRecipe

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
public static void registerRecipe(final Class<? extends IRecipe> recipe) {
    if (ExtraUtils.registeredRecipes.contains(recipe)) {
        return;
    }
    if (!recipe.getName().startsWith("com.rwtema.")) {
        return;
    }
    ExtraUtils.registeredRecipes.add(recipe);
    LogHelper.fine("Registering " + recipe.getSimpleName() + " to RecipeSorter", new Object[0]);
    if (ShapedOreRecipe.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:forge:shapedore");
    }
    else if (ShapelessOreRecipe.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore");
    }
    else if (ShapedRecipes.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless");
    }
    else if (ShapelessRecipes.class.isAssignableFrom(recipe)) {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless before:minecraft:bookcloning");
    }
    else {
        RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore");
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:26,代码来源:ExtraUtils.java

示例11: matches

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
private static boolean matches(ShapedRecipes recipe, IInventory inventory, World par2World)
{
    for (int i = 0; i <= 3 - recipe.recipeWidth; ++i)
    {
        for (int j = 0; j <= 3 - recipe.recipeHeight; ++j)
        {
            if (CompressorRecipes.checkMatch(recipe, inventory, i, j, true))
            {
                return true;
            }

            if (CompressorRecipes.checkMatch(recipe, inventory, i, j, false))
            {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:21,代码来源:CompressorRecipes.java

示例12: loadCraftingRecipes

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:21,代码来源:ShapedRecipeHandler.java

示例13: loadUsageRecipes

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:20,代码来源:ShapedRecipeHandler.java

示例14: ShapedOreCrystalRecipe

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
ShapedOreCrystalRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements)
{
    output = recipe.getRecipeOutput();
    width = recipe.recipeWidth;
    height = recipe.recipeHeight;

    input = new Object[recipe.recipeItems.length];

    for(int i = 0; i < input.length; i++)
    {
        ItemStack ingred = recipe.recipeItems[i];

        if(ItemStackTools.isEmpty(ingred)) continue;

        input[i] = recipe.recipeItems[i];

        for(Entry<ItemStack, String> replace : replacements.entrySet())
        {
            if(OreDictionary.itemMatches(replace.getKey(), ingred, true))
            {
                input[i] = OreDictionary.getOres(replace.getValue());
                break;
            }
        }
    }
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:27,代码来源:ShapedOreCrystalRecipe.java

示例15: ShapedOreRecipe

import net.minecraft.item.crafting.ShapedRecipes; //导入依赖的package包/类
ShapedOreRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements)
{
    output = recipe.func_77571_b();
    width = recipe.field_77576_b;
    height = recipe.field_77577_c;

    input = new Object[recipe.field_77574_d.length];

    for(int i = 0; i < input.length; i++)
    {
        ItemStack ingred = recipe.field_77574_d[i];

        if(ingred == null) continue;

        input[i] = recipe.field_77574_d[i];

        for(Entry<ItemStack, String> replace : replacements.entrySet())
        {
            if(OreDictionary.itemMatches(replace.getKey(), ingred, true))
            {
                input[i] = OreDictionary.getOres(replace.getValue());
                break;
            }
        }
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:27,代码来源:ShapedOreRecipe.java


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