Search in sources :

Example 1 with IMachineRecipe

use of com.builtbroken.mc.api.recipe.IMachineRecipe 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

IMachineRecipe (com.builtbroken.mc.api.recipe.IMachineRecipe)1 RecipeRegisterResult (com.builtbroken.mc.api.recipe.RecipeRegisterResult)1 MRHandlerItemStack (com.builtbroken.mc.lib.recipe.item.MRHandlerItemStack)1 MRItemStack (com.builtbroken.mc.lib.recipe.item.MRItemStack)1 ItemStack (net.minecraft.item.ItemStack)1