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