Search in sources :

Example 1 with RecipeInput

use of cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.RecipeInput in project FoodCraft-Reloaded by LasmGratel.

the class TileEntityDrinkMachine method startProgress.

@Override
public void startProgress() {
    DrinkRecipe recipe = RecipeManager.getInstance().getRecipeNullable(DrinkRecipe.class, new RecipeInput(itemStackHandler.getStackInSlot(0).getItem()));
    if (recipe != null) {
        FoodCraftReloaded.getLogger().debug("Drink machine: Found recipe " + recipe.getOutput().<FluidStack>first().getFluid().getName());
        fluidOutput = recipe.getOutput().first();
        output = recipe.getOutput().second();
        itemStackHandler.getStackInSlot(0).splitStack(1);
    }
}
Also used : RecipeInput(cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.RecipeInput) FluidStack(net.minecraftforge.fluids.FluidStack) DrinkRecipe(cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.DrinkRecipe)

Example 2 with RecipeInput

use of cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.RecipeInput in project FoodCraft-Reloaded by LasmGratel.

the class DrinkMachineTest method testRecipeIngredients.

@Test
public void testRecipeIngredients() {
    // Add null -> null recipe
    RecipeManager.getInstance().addRecipe(new DrinkRecipe(null, null));
    // Should be null recipe
    DrinkRecipe recipe = RecipeManager.getInstance().getRecipeNullable(DrinkRecipe.class, new RecipeInput((Item) null));
    // Should be presented
    Assert.assertNotNull(recipe);
    // Null input
    Assert.assertNull(recipe.getInput().first());
    // Null output
    Assert.assertNull(recipe.getOutput().first());
}
Also used : Item(net.minecraft.item.Item) RecipeInput(cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.RecipeInput) DrinkRecipe(cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.DrinkRecipe) Test(org.junit.Test)

Example 3 with RecipeInput

use of cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.RecipeInput in project FoodCraft-Reloaded by LasmGratel.

the class TileEntitySmeltingDrinkMachine method startProgress.

@Override
public void startProgress() {
    DrinkRecipe recipe = RecipeManager.getInstance().getRecipeNullable(DrinkRecipe.class, new RecipeInput(itemStackHandler.getStackInSlot(0).getItem()));
    if (recipe != null) {
        FoodCraftReloaded.getLogger().debug("Smelting drink machine: Found recipe " + recipe.getOutput().<FluidStack>first().getFluid().getName());
        fluidOutput = recipe.getOutput().first();
        output = recipe.getOutput().second();
        itemStackHandler.getStackInSlot(0).splitStack(1);
    }
}
Also used : RecipeInput(cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.RecipeInput) FluidStack(net.minecraftforge.fluids.FluidStack) DrinkRecipe(cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.DrinkRecipe)

Aggregations

DrinkRecipe (cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.DrinkRecipe)3 RecipeInput (cc.lasmgratel.foodcraftreloaded.minecraft.api.recipe.RecipeInput)3 FluidStack (net.minecraftforge.fluids.FluidStack)2 Item (net.minecraft.item.Item)1 Test (org.junit.Test)1