Search in sources :

Example 6 with EnergyIngredient

use of crazypants.enderio.base.integration.jei.energy.EnergyIngredient in project EnderIO by SleepyTrousers.

the class SagMillRecipeCategory method setRecipe.

@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull SagRecipe recipeWrapper, @Nonnull IIngredients ingredients) {
    IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
    guiItemStacks.addTooltipCallback(this);
    IGuiIngredientGroup<EnergyIngredient> group = recipeLayout.getIngredientsGroup(EnergyIngredient.class);
    guiItemStacks.init(0, true, 79 - xOff, 11 - yOff);
    guiItemStacks.init(1, false, 48 - xOff, 58 - yOff);
    guiItemStacks.init(2, false, 69 - xOff, 58 - yOff);
    guiItemStacks.init(3, false, 90 - xOff, 58 - yOff);
    guiItemStacks.init(4, false, 111 - xOff, 58 - yOff);
    guiItemStacks.init(5, true, 121 - xOff, 22 - yOff);
    group.init(6, true, EnergyIngredientRenderer.INSTANCE, 134 - xOff, 58 - yOff, 60, 10, 0, 0);
    guiItemStacks.addTooltipCallback(new ITooltipCallback<ItemStack>() {

        @Override
        public void onTooltip(int slotIndex, boolean input, @Nonnull ItemStack ingredient, @Nonnull List<String> tooltip) {
            switch(slotIndex) {
                case 1:
                case 2:
                case 3:
                case 4:
                    if (slotIndex <= recipeWrapper.getRecipe().getOutputs().length) {
                        RecipeOutput output = recipeWrapper.getRecipe().getOutputs()[slotIndex - 1];
                        float chance = output.getChance();
                        if (chance > 0 && chance < 1) {
                            int chanceInt = (int) (chance * 100);
                            Object[] objects = { chanceInt };
                            tooltip.add(TextFormatting.GRAY + MessageFormat.format(Lang.JEI_SAGMILL_CHANCE.get(), objects));
                        }
                    }
                    return;
                case 5:
                    if (ballsTT.shouldHandleItem(ingredient)) {
                        ballsTT.addDetailedEntries(ingredient, Minecraft.getMinecraft().player, tooltip, true);
                    }
                    return;
                default:
                    return;
            }
        }
    });
    guiItemStacks.set(ingredients);
    group.set(ingredients);
}
Also used : EnergyIngredient(crazypants.enderio.base.integration.jei.energy.EnergyIngredient) RecipeOutput(crazypants.enderio.base.recipe.RecipeOutput) IGuiItemStackGroup(mezz.jei.api.gui.IGuiItemStackGroup) ItemStack(net.minecraft.item.ItemStack)

Example 7 with EnergyIngredient

use of crazypants.enderio.base.integration.jei.energy.EnergyIngredient in project EnderIO by SleepyTrousers.

the class AlloyRecipeCategory method setRecipe.

@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull AlloyRecipeCategory.AlloyRecipe recipeWrapper, @Nonnull IIngredients ingredients) {
    IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
    IGuiIngredientGroup<EnergyIngredient> group = recipeLayout.getIngredientsGroup(EnergyIngredient.class);
    guiItemStacks.init(0, true, 53 - xOff, 16 - yOff);
    guiItemStacks.init(1, true, 78 - xOff, 6 - yOff);
    guiItemStacks.init(2, true, 102 - xOff, 16 - yOff);
    guiItemStacks.init(3, false, 78 - xOff, 57 - yOff);
    group.init(4, true, EnergyIngredientRenderer.INSTANCE, 108 - xOff, 55 - yOff, 50, 10, 0, 0);
    List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
    for (int index = 0; index < inputs.size(); index++) {
        List<ItemStack> input = inputs.get(index);
        if (input != null) {
            guiItemStacks.set(index, input);
        }
    }
    List<List<ItemStack>> outputs = ingredients.getOutputs(ItemStack.class);
    guiItemStacks.set(3, outputs.get(0));
    group.set(ingredients);
}
Also used : EnergyIngredient(crazypants.enderio.base.integration.jei.energy.EnergyIngredient) IGuiItemStackGroup(mezz.jei.api.gui.IGuiItemStackGroup) ArrayList(java.util.ArrayList) List(java.util.List) ItemStack(net.minecraft.item.ItemStack)

Example 8 with EnergyIngredient

use of crazypants.enderio.base.integration.jei.energy.EnergyIngredient in project EnderIO by SleepyTrousers.

the class SliceAndSpliceRecipeCategory method setRecipe.

@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull SliceAndSpliceRecipeCategory.SliceAndSpliceRecipe recipeWrapper, @Nonnull IIngredients ingredients) {
    IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
    guiItemStacks.init(0, false, 53 - xOff, 15 - yOff);
    guiItemStacks.init(1, false, 71 - xOff, 15 - yOff);
    guiItemStacks.init(2, true, 43 - xOff, 39 - yOff);
    guiItemStacks.init(3, true, 61 - xOff, 39 - yOff);
    guiItemStacks.init(4, true, 79 - xOff, 39 - yOff);
    guiItemStacks.init(5, true, 43 - xOff, 57 - yOff);
    guiItemStacks.init(6, true, 61 - xOff, 57 - yOff);
    guiItemStacks.init(7, true, 79 - xOff, 57 - yOff);
    guiItemStacks.init(8, false, 133 - xOff, 48 - yOff);
    guiItemStacks.set(0, getAxes());
    guiItemStacks.set(1, getShears());
    List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
    int slot = 2;
    for (List<ItemStack> input : inputs) {
        if (input != null) {
            guiItemStacks.set(slot, input);
        }
        ++slot;
    }
    ItemStack output = ingredients.getOutputs(ItemStack.class).get(0).get(0);
    if (!output.isEmpty()) {
        guiItemStacks.set(8, output);
    }
    IGuiIngredientGroup<EnergyIngredient> group = recipeLayout.getIngredientsGroup(EnergyIngredient.class);
    group.init(9, true, EnergyIngredientRenderer.INSTANCE, 108 - xOff - 1, 72 - yOff - 1, 50, 10, 0, 0);
    group.set(ingredients);
}
Also used : EnergyIngredient(crazypants.enderio.base.integration.jei.energy.EnergyIngredient) IGuiItemStackGroup(mezz.jei.api.gui.IGuiItemStackGroup) ArrayList(java.util.ArrayList) List(java.util.List) ItemStack(net.minecraft.item.ItemStack)

Example 9 with EnergyIngredient

use of crazypants.enderio.base.integration.jei.energy.EnergyIngredient in project EnderIO by SleepyTrousers.

the class SolarPanelRecipeCategory method setRecipe.

@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull SolarPanelRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
    IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
    IGuiIngredientGroup<EnergyIngredient> group = recipeLayout.getIngredientsGroup(EnergyIngredient.class);
    // center of text minus half-width of stack
    int offset = 40 / 2 - 16 / 2;
    guiItemStacks.init(0, true, 0 * 40 + offset, 45);
    guiItemStacks.init(1, true, 1 * 40 + offset, 45);
    guiItemStacks.init(2, true, 2 * 40 + offset, 45);
    guiItemStacks.init(3, true, 3 * 40 + offset, 45);
    group.init(4, false, EnergyIngredientRenderer.INSTANCE, 0 * 40, 80, 40, 10, 0, 0);
    group.init(5, false, EnergyIngredientRenderer.INSTANCE, 1 * 40, 80, 40, 10, 0, 0);
    group.init(6, false, EnergyIngredientRenderer.INSTANCE, 2 * 40, 80, 40, 10, 0, 0);
    group.init(7, false, EnergyIngredientRenderer.INSTANCE, 3 * 40, 80, 40, 10, 0, 0);
    guiItemStacks.set(ingredients);
    group.set(ingredients);
}
Also used : EnergyIngredient(crazypants.enderio.base.integration.jei.energy.EnergyIngredient) IGuiItemStackGroup(mezz.jei.api.gui.IGuiItemStackGroup)

Example 10 with EnergyIngredient

use of crazypants.enderio.base.integration.jei.energy.EnergyIngredient in project EnderIO by SleepyTrousers.

the class StirlingRecipeCategory method setRecipe.

@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull StirlingRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
    IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
    IGuiIngredientGroup<EnergyIngredient> group = recipeLayout.getIngredientsGroup(EnergyIngredient.class);
    guiItemStacks.init(0, true, 79 - xOff, 33 - yOff);
    group.init(1, false, EnergyIngredientRenderer.INSTANCE, 37 - xOff, 21 - yOff, 40, 10, 0, 0);
    group.init(2, false, EnergyIngredientRenderer.INSTANCE, 54 + 47 - xOff, 21 - yOff, 40, 10, 0, 0);
    group.init(3, false, EnergyIngredientRenderer.INSTANCE, 30 - xOff, 67 - yOff, 52, 10, 0, 0);
    group.init(4, false, EnergyIngredientRenderer.INSTANCE, 54 + 44 - xOff, 67 - yOff, 60, 10, 0, 0);
    guiItemStacks.set(ingredients);
    group.set(ingredients);
}
Also used : EnergyIngredient(crazypants.enderio.base.integration.jei.energy.EnergyIngredient) IGuiItemStackGroup(mezz.jei.api.gui.IGuiItemStackGroup)

Aggregations

EnergyIngredient (crazypants.enderio.base.integration.jei.energy.EnergyIngredient)13 IGuiItemStackGroup (mezz.jei.api.gui.IGuiItemStackGroup)10 ItemStack (net.minecraft.item.ItemStack)6 ArrayList (java.util.ArrayList)5 IGuiFluidStackGroup (mezz.jei.api.gui.IGuiFluidStackGroup)4 List (java.util.List)3 RecipeOutput (crazypants.enderio.base.recipe.RecipeOutput)2 NNList (com.enderio.core.common.util.NNList)1 ResultStack (crazypants.enderio.base.recipe.IMachineRecipe.ResultStack)1 CapturedMob (crazypants.enderio.util.CapturedMob)1 IBlockState (net.minecraft.block.state.IBlockState)1 FluidStack (net.minecraftforge.fluids.FluidStack)1