當前位置: 首頁>>代碼示例>>Java>>正文


Java ShapedOreRecipe類代碼示例

本文整理匯總了Java中net.minecraftforge.oredict.ShapedOreRecipe的典型用法代碼示例。如果您正苦於以下問題:Java ShapedOreRecipe類的具體用法?Java ShapedOreRecipe怎麽用?Java ShapedOreRecipe使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ShapedOreRecipe類屬於net.minecraftforge.oredict包,在下文中一共展示了ShapedOreRecipe類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: test_useUpItem

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
@Test
public void test_useUpItem()
{
    ShapedOreRecipe recipe = new DamageableShapedOreRecipe(new ResourceLocation("group"),
                                                           new int[] {60}, new ItemStack(Blocks.DIRT),
                                                           "A",
                                                           'A', new ItemStack(Items.WOODEN_SWORD));

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

    inv.setInventorySlotContents(0, new ItemStack(Items.WOODEN_SWORD));
    assertTrue(recipe.matches(inv, null));

    NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
    assertTrue(remaining.get(0).isEmpty());
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:24,代碼來源:DamageableShapedOreRecipeTest.java

示例2: RecipeUnstableCrafting

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
public RecipeUnstableCrafting(final ItemStack result, final Object... recipe) {
    super(result, recipe);
    this.checker = new ShapedOreRecipe(result, recipe);
    final Object[] input = super.getInput();
    final ArrayList<Object> ee3input = new ArrayList<Object>();
    for (final Object anInput : input) {
        boolean flag = true;
        if (anInput instanceof ArrayList) {
            final ArrayList<ItemStack> itemStacks = (ArrayList<ItemStack>)anInput;
            for (final ItemStack itemStack : itemStacks) {
                if (itemStack.getItem() == ExtraUtils.unstableIngot && itemStack.getItemDamage() == 2) {
                    itemStack.setTagCompound(RecipeUnstableCrafting.nbt);
                    ee3input.add(Items.diamond);
                    ee3input.add(Items.iron_ingot);
                    flag = false;
                    break;
                }
            }
        }
        if (flag) {
            ee3input.add(anInput);
        }
    }
    EE3Integration.addRecipe(this.getRecipeOutput().copy(), ee3input.toArray());
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:26,代碼來源:RecipeUnstableCrafting.java

示例3: loadUsageRecipes

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的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

示例4: loadCraftingRecipes

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的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

示例5: registerRecipe

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的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

示例6: loadCraftingRecipes

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的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

示例7: loadUsageRecipes

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的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

示例8: forgeShapedRecipe

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
public CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) {
    int width;
    int height;
    try {
        width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4);
        height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5);
    } catch (Exception e) {
        NEIClientConfig.logger.error("Error loading recipe", e);
        return null;
    }

    Object[] items = recipe.getInput();
    for (Object item : items)
        if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
            return null;

    return new CachedShapedRecipe(width, height, items, recipe.getRecipeOutput());
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:19,代碼來源:ShapedRecipeHandler.java

示例9: forgeShapedRecipe

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
public CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) {
    int width;
    int height;
    try {
        width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4);
        height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5);
    } catch (Exception e) {
        LogHelper.errorError("Error loading recipe", e);
        return null;
    }

    Object[] items = recipe.getInput();
    for (Object item : items) {
        if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
        {
            return null;
        }
    }

    return new CachedShapedRecipe(width, height, items, recipe.getRecipeOutput());
}
 
開發者ID:TheCBProject,項目名稱:NotEnoughItems,代碼行數:22,代碼來源:ShapedRecipeHandler.java

示例10: buildHandlerMap

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
private static void buildHandlerMap()
{
	// RecipesMapExtending extends ShapedRecipes, and causes a crash when attempting to uncraft a map
	HANDLERS.put(RecipesMapExtending.class, null);

	// vanilla Minecraft recipe handlers
	HANDLERS.put(ShapedRecipes.class, new ShapedRecipeHandler());
	HANDLERS.put(ShapelessRecipes.class, new ShapelessRecipeHandler());
	HANDLERS.put(RecipeFireworks.class, new FireworksRecipeHandler());
	HANDLERS.put(RecipeTippedArrow.class, new TippedArrowRecipeHandler());

	// Forge Ore Dictionary recipe handlers
	HANDLERS.put(ShapedOreRecipe.class, new ShapedOreRecipeHandler());
	HANDLERS.put(ShapelessOreRecipe.class, new ShapelessOreRecipeHandler());

	// cofh recipe handlers
	if (CoFHRecipeHandlers.CoverRecipeHandler.recipeClass != null) HANDLERS.put(CoFHRecipeHandlers.CoverRecipeHandler.recipeClass, new CoFHRecipeHandlers.CoverRecipeHandler());

	// industrialcraft 2 recipe handlers
	if (ShapedIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapedIC2RecipeHandler.recipeClass, new ShapedIC2RecipeHandler());
	if (ShapelessIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapelessIC2RecipeHandler.recipeClass, new ShapelessIC2RecipeHandler());

	// tinker's construct recipe handlers
	if (TinkersRecipeHandlers.TableRecipeHandler.recipeClass != null) HANDLERS.put(TinkersRecipeHandlers.TableRecipeHandler.recipeClass, new TinkersRecipeHandlers.TableRecipeHandler());
}
 
開發者ID:crazysnailboy,項目名稱:UncraftingTable,代碼行數:26,代碼來源:RecipeHandlers.java

示例11: registerUncraftingRecipes

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
private void registerUncraftingRecipes()
{
	// damaged anvil recipes
	UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "damaged_anvil_1"), new ItemStack(Blocks.ANVIL, 1, 1), new Object[] { "B B", " I ", "I I", 'B', "blockIron", 'I', "ingotIron" }));
	UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "damaged_anvil_2"), new ItemStack(Blocks.ANVIL, 1, 2), new Object[] { "B  ", " I ", "  I", 'B', "blockIron", 'I', "ingotIron" }));

	if (!Loader.isModLoaded("craftablehorsearmour"))
	{
		// horse armor recipes
		UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "iron_horse_armor"), Items.IRON_HORSE_ARMOR, new Object[] { "  I", "IWI", "III", 'I', "ingotIron", 'W', Item.getItemFromBlock(Blocks.WOOL) }));
		UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "golden_horse_armor"), Items.GOLDEN_HORSE_ARMOR, new Object[] { "  G", "GWG", "GGG", 'G', "ingotGold", 'W', new ItemStack(Item.getItemFromBlock(Blocks.WOOL), 1, 4) }));
		UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "diamond_horse_armor"), Items.DIAMOND_HORSE_ARMOR, new Object[] { "  D", "DWD", "DDD", 'D', "gemDiamond", 'W', new ItemStack(Item.getItemFromBlock(Blocks.WOOL), 1, 3) }));
		// saddle recipe
		UncraftingManager.addUncraftingRecipe(new ShapedOreRecipe(new ResourceLocation(ModUncrafting.MODID, "saddle"), Items.SADDLE, new Object[] { "LLL", "S S", "I I", 'L', "leather", 'S', Items.STRING, 'I', "ingotIron" }));
	}
}
 
開發者ID:crazysnailboy,項目名稱:UncraftingTable,代碼行數:17,代碼來源:CommonProxy.java

示例12: init

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
public static void init() {
	GameRegistry.addRecipe(new RecipeScrewDriver());

	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.LENS, 3), "AAA", 'A', "blockGlass"));
	GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.REFLECTIVE_ALLOY, 2), Items.IRON_INGOT, Items.GOLD_INGOT));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.ASSEMBLY_TABLE), "ABA", "A A", "AAA", 'A', "ingotIron", 'B', ModBlocks.LENS));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.MAGNIFIER), "ABA", "A A", "A A", 'A', "ingotIron", 'B', ModBlocks.LENS));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.SCREW_DRIVER), " AA", " BA", "B  ", 'A', "ingotIron", 'B', Items.STICK));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LASER_PEN), "  A", " BC", "D  ", 'A', Blocks.STONE_BUTTON, 'B', "dustRedstone", 'C', "ingotIron", 'D', "blockGlass"));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.REFLECTIVE_ALLOY_BLOCK), "AAA", "AAA", "AAA", 'A', ModItems.REFLECTIVE_ALLOY));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.GRENADE, 3), " A ", "ABA", " A ", 'A', ModItems.REFLECTIVE_ALLOY, 'B', Blocks.TNT));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.HELMET), "AAA", "A A", "   ", 'A', ModItems.REFLECTIVE_ALLOY));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.CHESTPLATE), "A A", "AAA", "AAA", 'A', ModItems.REFLECTIVE_ALLOY));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LEGGINGS), "AAA", "A A", "A A", 'A', ModItems.REFLECTIVE_ALLOY));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.BOOTS), "   ", "A A", "A A", 'A', ModItems.REFLECTIVE_ALLOY));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LIGHT_CARTRIDGE), " A ", "ABA", " A ", 'A', ModItems.REFLECTIVE_ALLOY, 'B', Blocks.GLASS_PANE));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.SPECTROMETER), "ABC", "DEF", "DDD", 'A', "dyeRed", 'B', "dyeGreen", 'C', "dyeBlue", 'D', "ingotIron", 'F', "paneGlass", 'E', LibOreDict.REFLECTIVE_ALLOY));
	GameRegistry.addShapelessRecipe(new ItemStack(ModItems.BOOK), ModItems.LASER_PEN, Items.BOOK);

	if (!ConfigValues.DISABLE_PHOTON_CANNON)
		GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.PHOTON_CANNON), " BA", "CDB", "EC ", 'A', ModBlocks.LENS, 'B', ModBlocks.MIRROR, 'C', ModItems.REFLECTIVE_ALLOY, 'D', ModBlocks.ELECTRON_EXCITER, 'E', ModBlocks.SENSOR));
}
 
開發者ID:TeamWizardry,項目名稱:TMT-Refraction,代碼行數:23,代碼來源:CraftingRecipes.java

示例13: registerPipeRecipe

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
public static void registerPipeRecipe(Item out, Item frame, Object sec1, Object sec2) {
	if (sec1 == null) {
		GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(out, 8), new Object [] {
				" G ", "GFG", " G ",
				'G', Blocks.glass_pane,
				'F', frame
		}));
	} else {
		GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(out, 8), new Object [] {
				"1G2", "GFG", "2G1",
				'G', Blocks.glass_pane,
				'F', frame,
				'1', sec1,
				'2', sec2 == null ? sec1 : sec2
		}));
		GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(out, 8), new Object [] {
				"2G1", "GFG", "1G2",
				'G', Blocks.glass_pane,
				'F', frame,
				'1', sec1,
				'2', sec2 == null ? sec1 : sec2
		}));
	}
}
 
開發者ID:Shurgent,項目名稱:TFCTech,代碼行數:25,代碼來源:TFCTechBCTransport.java

示例14: setup

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
static void setup() {
    if (is_setup) return;
    is_setup = true;
    reg(ItemStack.class, new WriteItemStack());
    reg(Item.class, new WriteItem());
    reg(Block.class, new WriteBlock());
    reg(String.class, new WriteStringOreDictionary());
    reg(Number.class, new WriteObjectToString());
    reg(NBTBase.class, new WriteObjectToString());
    reg(FluidStack.class, new WriteFluidStack());
    reg(Fluid.class, new WriteFluid());
    reg(Collection.class, new WriteCollection());
    // IRecipe: "embedded IRecipe"; haven't seen it crop up tho
    reg(ShapedOreRecipe.class, new WriteShapedOreRecipe());
    reg(ShapedRecipes.class, new WriteShapedRecipe());
    reg(ShapelessOreRecipe.class, new WriteShapelessOreRecipe());
    reg(ShapelessRecipes.class, new WriteShapelessRecipe());
    reg(Map.Entry.class, new WriteEntry());

    IObjectWriter.adapter.register(new ArrayAdapter());
    IObjectWriter.adapter.setFallbackAdapter(new GenericAdapter<Object, IObjectWriter>(Object.class, new ReflectionWriter()));
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:23,代碼來源:StandardObjectWriters.java

示例15: loadCraftingRecipes

import net.minecraftforge.oredict.ShapedOreRecipe; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:TheCBProject,項目名稱:NotEnoughItems,代碼行數:23,代碼來源:ShapedRecipeHandler.java


注:本文中的net.minecraftforge.oredict.ShapedOreRecipe類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。