Search in sources :

Example 1 with MRItemStack

use of com.builtbroken.mc.lib.recipe.item.MRItemStack in project Engine by VoltzEngine-Project.

the class CrusherRecipeLoad method generateRecipes.

@Override
protected void generateRecipes(List<MRItemStack> recipes) {
    recipes.add(newRecipe(Blocks.cobblestone).addInputOption(Blocks.stone));
    recipes.add(newRecipe(new ItemStack(Blocks.cobblestone, 4)).addInputOption(Blocks.stonebrick));
    if (DefinedGenItems.RUBBLE.item != null) {
        for (GenMaterial mat : GenMaterial.values()) {
            if (mat != GenMaterial.UNKNOWN && !DefinedGenItems.RUBBLE.ignoreMaterials.contains(mat)) {
                List<ItemStack> oreStacks = OreDictionary.getOres("ore" + LanguageUtility.capitalizeFirst(mat.name().toLowerCase()));
                if (oreStacks != null && !oreStacks.isEmpty()) {
                    for (ItemStack stack : oreStacks) {
                        if (stack != null && stack.getItem() != null) {
                            recipes.add(newRecipe(DefinedGenItems.RUBBLE.stack(mat)).addInputOption(stack));
                        }
                    }
                }
            }
        }
    }
}
Also used : GenMaterial(com.builtbroken.mc.core.content.resources.GenMaterial) ItemStack(net.minecraft.item.ItemStack) MRItemStack(com.builtbroken.mc.lib.recipe.item.MRItemStack) MRLoaderItemStack(com.builtbroken.mc.lib.recipe.item.MRLoaderItemStack)

Example 2 with MRItemStack

use of com.builtbroken.mc.lib.recipe.item.MRItemStack in project Engine by VoltzEngine-Project.

the class GrinderRecipeLoad method generateRecipes.

@Override
protected void generateRecipes(List<MRItemStack> recipes) {
    recipes.add(newRecipe(Blocks.sand).addInputOption(Blocks.stone).addInputOption(Blocks.cobblestone));
    recipes.add(newRecipe(new ItemStack(Blocks.sand, 4)).addInputOption(Blocks.sandstone));
    //Generate ore dictionary recipes for impure dust
    if (DefinedGenItems.DUST_IMPURE.item != null) {
        for (GenMaterial mat : GenMaterial.values()) {
            if (mat != GenMaterial.UNKNOWN && !DefinedGenItems.DUST_IMPURE.ignoreMaterials.contains(mat)) {
                final String type = LanguageUtility.capitalizeFirst(mat.name().toLowerCase());
                //Ore -> Dust
                //TODO add output of tiny dust, and stone dust
                processOreRecipes(recipes, DefinedGenItems.DUST_IMPURE.stack(mat), "ore" + type);
                if (DefinedGenItems.RUBBLE.item != null) {
                    //TODO add output of tiny dust, and stone dust
                    recipes.add(newRecipe(DefinedGenItems.DUST_IMPURE.stack(mat, 2)).addInputOption(DefinedGenItems.RUBBLE.stack(mat)));
                }
            }
        }
    }
    if (DefinedGenItems.DUST.item != null) {
        for (GenMaterial mat : GenMaterial.values()) {
            if (mat != GenMaterial.UNKNOWN && !DefinedGenItems.DUST.ignoreMaterials.contains(mat)) {
                final String type = LanguageUtility.capitalizeFirst(mat.name().toLowerCase());
                //Ingot -> Dust
                processOreRecipes(recipes, DefinedGenItems.DUST.stack(mat), "ingot" + type);
                if (DefinedGenItems.PLATE.item != null) {
                    recipes.add(newRecipe(DefinedGenItems.DUST.stack(mat)).addInputOption(DefinedGenItems.PLATE.stack(mat)));
                }
                if (DefinedGenItems.ROD.item != null) {
                    recipes.add(newRecipe(DefinedGenItems.DUST.stack(mat)).addInputOption(DefinedGenItems.ROD.stack(mat)));
                }
                if (DefinedGenItems.GEAR.item != null) {
                    recipes.add(newRecipe(DefinedGenItems.DUST.stack(mat)).addInputOption(DefinedGenItems.GEAR.stack(mat)));
                }
                if (DefinedGenItems.AX_HEAD.item != null) {
                    recipes.add(newRecipe(DefinedGenItems.DUST.stack(mat, 3)).addInputOption(DefinedGenItems.AX_HEAD.stack(mat)));
                }
                if (DefinedGenItems.SHOVEL_HEAD.item != null) {
                    recipes.add(newRecipe(DefinedGenItems.DUST.stack(mat)).addInputOption(DefinedGenItems.SHOVEL_HEAD.stack(mat)));
                }
                if (DefinedGenItems.SWORD_BLADE.item != null) {
                    recipes.add(newRecipe(DefinedGenItems.DUST.stack(mat, 2)).addInputOption(DefinedGenItems.SWORD_BLADE.stack(mat)));
                }
                if (DefinedGenItems.PICK_HEAD.item != null) {
                    recipes.add(newRecipe(DefinedGenItems.DUST.stack(mat, 3)).addInputOption(DefinedGenItems.PICK_HEAD.stack(mat)));
                }
                if (DefinedGenItems.HOE_HEAD.item != null) {
                    recipes.add(newRecipe(DefinedGenItems.DUST.stack(mat, 2)).addInputOption(DefinedGenItems.HOE_HEAD.stack(mat)));
                }
            }
        }
    }
}
Also used : GenMaterial(com.builtbroken.mc.core.content.resources.GenMaterial) ItemStack(net.minecraft.item.ItemStack) MRItemStack(com.builtbroken.mc.lib.recipe.item.MRItemStack) MRLoaderItemStack(com.builtbroken.mc.lib.recipe.item.MRLoaderItemStack)

Example 3 with MRItemStack

use of com.builtbroken.mc.lib.recipe.item.MRItemStack in project Engine by VoltzEngine-Project.

the class TestMRHItemStack method testAddRecipe.

public void testAddRecipe() {
    RecipeRegisterResult result = handler.registerRecipe(new MRItemStack(MachineRecipeType.ITEM_CRUSHER.INTERNAL_NAME, Blocks.stone).addInputOption(Blocks.stone));
    assertEquals("Failed to register recipe", RecipeRegisterResult.REGISTERED, result);
}
Also used : RecipeRegisterResult(com.builtbroken.mc.api.recipe.RecipeRegisterResult) MRItemStack(com.builtbroken.mc.lib.recipe.item.MRItemStack)

Example 4 with MRItemStack

use of com.builtbroken.mc.lib.recipe.item.MRItemStack in project Engine by VoltzEngine-Project.

the class TestMRHItemStack method testGetRecipe.

public void testGetRecipe() {
    RecipeRegisterResult result = handler.registerRecipe(new MRItemStack(MachineRecipeType.ITEM_CRUSHER.INTERNAL_NAME, Blocks.bedrock).addInputOption(Blocks.bedrock));
    assertEquals("Failed to register recipe", RecipeRegisterResult.REGISTERED, result);
    ItemStack out = handler.getRecipe(new Object[] { new ItemStack(Blocks.bedrock) }, 0, 0);
    if (out == null) {
        Collection<IMachineRecipe> recipes = handler.getRecipes(new Object[] { new ItemStack(Blocks.bedrock) });
        if (recipes == null || recipes.size() == 0) {
            recipes = handler.getRecipes();
            if (recipes == null || recipes.size() == 0) {
                fail("No recipes listed for handler");
            }
            System.out.println("Recipes Contain: " + handler.recipes.containsKey(handler.getKeyFor(new Object[] { new ItemStack(Blocks.bedrock) })));
            for (IMachineRecipe recipe : recipes) {
                System.out.println("Machine Recipe: " + recipe + ", Should handler: " + recipe.shouldHandleRecipe(new Object[] { new ItemStack(Blocks.bedrock) }));
            }
            fail("Not recipes listed for input");
        }
        for (IMachineRecipe recipe : recipes) {
            System.out.println("Machine Recipe: " + recipe + ", Should handler: " + recipe.shouldHandleRecipe(new Object[] { new ItemStack(Blocks.bedrock) }));
        }
        fail("Output == null");
    }
    assertTrue("getRecipe should have returned bedrock", out.isItemEqual(new ItemStack(Blocks.bedrock)));
}
Also used : RecipeRegisterResult(com.builtbroken.mc.api.recipe.RecipeRegisterResult) MRItemStack(com.builtbroken.mc.lib.recipe.item.MRItemStack) MRHandlerItemStack(com.builtbroken.mc.lib.recipe.item.MRHandlerItemStack) ItemStack(net.minecraft.item.ItemStack) MRItemStack(com.builtbroken.mc.lib.recipe.item.MRItemStack) IMachineRecipe(com.builtbroken.mc.api.recipe.IMachineRecipe)

Aggregations

MRItemStack (com.builtbroken.mc.lib.recipe.item.MRItemStack)4 ItemStack (net.minecraft.item.ItemStack)3 RecipeRegisterResult (com.builtbroken.mc.api.recipe.RecipeRegisterResult)2 GenMaterial (com.builtbroken.mc.core.content.resources.GenMaterial)2 MRLoaderItemStack (com.builtbroken.mc.lib.recipe.item.MRLoaderItemStack)2 IMachineRecipe (com.builtbroken.mc.api.recipe.IMachineRecipe)1 MRHandlerItemStack (com.builtbroken.mc.lib.recipe.item.MRHandlerItemStack)1