Search in sources :

Example 1 with RecipeRegisterResult

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

use of com.builtbroken.mc.api.recipe.RecipeRegisterResult in project Engine by VoltzEngine-Project.

the class MachineRecipeLoader method init.

@Override
public void init() {
    List<I> recipes = new ArrayList();
    generateRecipes(recipes);
    for (I recipe : recipes) {
        RecipeRegisterResult result = MachineRecipeType.getHandler(type).registerRecipe(recipe);
        if (result != RecipeRegisterResult.REGISTERED) {
            Engine.instance.logger().error("" + this.getClass().getSimpleName() + " failed to register recipe " + recipe + "  ErrorCode:" + result);
        }
    }
}
Also used : RecipeRegisterResult(com.builtbroken.mc.api.recipe.RecipeRegisterResult) ArrayList(java.util.ArrayList)

Example 3 with RecipeRegisterResult

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

RecipeRegisterResult (com.builtbroken.mc.api.recipe.RecipeRegisterResult)3 MRItemStack (com.builtbroken.mc.lib.recipe.item.MRItemStack)2 IMachineRecipe (com.builtbroken.mc.api.recipe.IMachineRecipe)1 MRHandlerItemStack (com.builtbroken.mc.lib.recipe.item.MRHandlerItemStack)1 ArrayList (java.util.ArrayList)1 ItemStack (net.minecraft.item.ItemStack)1