mezz.jei.api.recipe.IFocus Java Examples
The following examples show how to use
mezz.jei.api.recipe.IFocus.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HammerRecipeCategory.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public void setRecipe(IRecipeLayout recipeLayout, HammerRecipe recipeWrapper) { // Block recipeLayout.getItemStacks().init(0, true, 74, 9); recipeLayout.getItemStacks().set(0, (ItemStack) recipeWrapper.getInputs().get(0)); IFocus<?> focus = recipeLayout.getFocus(); hasHighlight = focus.getMode() == IFocus.Mode.OUTPUT; int slotIndex = 1; for (int i = 0; i < recipeWrapper.getOutputs().size(); i++) { final int slotX = 2 + (i % 9 * 18); final int slotY = 36 + (i / 9 * 18); ItemStack outputStack = (ItemStack) recipeWrapper.getOutputs().get(i); recipeLayout.getItemStacks().init(slotIndex + i, false, slotX, slotY); recipeLayout.getItemStacks().set(slotIndex + i, outputStack); ItemStack focusStack = (ItemStack) focus.getValue(); if (focus.getMode() == IFocus.Mode.OUTPUT && focusStack != null && focusStack.getItem() == outputStack.getItem() && focusStack.getItemDamage() == outputStack.getItemDamage()) { highlightX = slotX; highlightY = slotY; } } recipeLayout.getItemStacks().addTooltipCallback(new HammerTooltipCallback(recipeWrapper)); }
Example #2
Source File: FluidTransformRecipeCategory.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public void setRecipe(IRecipeLayout recipeLayout, FluidTransformRecipe recipeWrapper) { recipeLayout.getItemStacks().init(0, true, 74, 9); recipeLayout.getItemStacks().init(1, true, 47, 9); recipeLayout.getItemStacks().init(2, true, 74, 36); recipeLayout.getItemStacks().init(3, false, 101, 9); boolean noCycle = false; List<ItemStack> focusStack = null; IFocus<?> focus = recipeLayout.getFocus(); if(focus.getMode() == IFocus.Mode.INPUT && focus.getValue() instanceof ItemStack) { ItemStack stack = (ItemStack) focus.getValue(); for(ItemStack inputStack : recipeWrapper.getInputs().subList(1, recipeWrapper.getInputs().size())) { if(stack.isItemEqual(inputStack)) { noCycle = true; focusStack = ImmutableList.of(inputStack); } } } recipeLayout.getItemStacks().set(0, new ItemStack(ENBlocks.barrelStone, 1, 0)); recipeLayout.getItemStacks().set(1, recipeWrapper.getInputs().get(0)); recipeLayout.getItemStacks().set(2, noCycle ? focusStack : ImmutableList.copyOf(recipeWrapper.getInputs().subList(1, recipeWrapper.getInputs().size()))); recipeLayout.getItemStacks().set(3, recipeWrapper.getOutputs().get(0)); }
Example #3
Source File: CompostRecipeCategory.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public void setRecipe(IRecipeLayout layout, CompostRecipe recipe) { // Block layout.getItemStacks().init(0, false, 74, 9); layout.getItemStacks().set(0, (ItemStack) recipe.getOutputs().get(0)); IFocus<?> focus = layout.getFocus(); boolean mightHaveHighlight = focus.getMode() == IFocus.Mode.INPUT; hasHighlight = false; ItemStack focusStack = (ItemStack) focus.getValue(); int slotIndex = 1; for (int i = 0; i < recipe.getInputs().size(); i++) { final int slotX = 2 + (i % 9 * 18); final int slotY = 36 + (i / 9 * 18); ItemStack inputStack = (ItemStack) recipe.getInputs().get(i); layout.getItemStacks().init(slotIndex + i, true, slotX, slotY); layout.getItemStacks().set(slotIndex + i, inputStack); if (mightHaveHighlight && ItemStack.areItemsEqual(focusStack, inputStack)) { highlightX = slotX; highlightY = slotY; hasHighlight = true; mightHaveHighlight = false; } } layout.getItemStacks().addTooltipCallback(new CompostTooltipCallback()); }
Example #4
Source File: JEIProxy.java From NotEnoughItems with MIT License | 5 votes |
@Override public void openRecipeGui(ItemStack stack) { RecipeRegistry registry = Internal.getRuntime().getRecipeRegistry(); IFocus<ItemStack> focus = registry.createFocus(Mode.OUTPUT, stack); if (registry.getRecipeCategories(focus).isEmpty()) { return; } Internal.getRuntime().getRecipesGui().show(focus); }
Example #5
Source File: JEIProxy.java From NotEnoughItems with MIT License | 5 votes |
@Override public void openUsageGui(ItemStack stack) { RecipeRegistry registry = Internal.getRuntime().getRecipeRegistry(); IFocus<ItemStack> focus = registry.createFocus(Mode.INPUT, stack); if (registry.getRecipeCategories(focus).isEmpty()) { return; } Internal.getRuntime().getRecipesGui().show(focus); }