codechicken.nei.recipe.GuiRecipe Java Examples

The following examples show how to use codechicken.nei.recipe.GuiRecipe. 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: PneumaticCraftPlugins.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip, int recipe){
    //  super.handleTooltip(guiRecipe, currenttip, recipe);
    MultipleInputOutputRecipe r = (MultipleInputOutputRecipe)arecipes.get(recipe);
    if(GuiContainerManager.shouldShowTooltip(guiRecipe)) {
        Point mouse = GuiDraw.getMousePosition();
        Point offset = guiRecipe.getRecipePosition(recipe);
        Point relMouse = new Point(mouse.x - (guiRecipe.width - 176) / 2 - offset.x, mouse.y - (guiRecipe.height - 166) / 2 - offset.y);

        for(IGuiWidget widget : r.tooltipWidgets) {
            if(widget.getBounds().contains(relMouse)) {
                widget.addTooltip(mouse.x, mouse.y, currenttip, false);
            }
        }
        if(r.tempWidget != null) {
            if(r.tempWidget.getBounds().contains(relMouse)) {
                r.heatExchanger.setTemperature(r.tempWidget.getScales()[0]);
                r.tempWidget.addTooltip(mouse.x, mouse.y, currenttip, false);
            }
        }
    }
    return currenttip;
}
 
Example #2
Source File: RecipeHandlerBase.java    From NEI-Integration with MIT License 6 votes vote down vote up
protected boolean transferFluidTank(GuiRecipe guiRecipe, int recipe, boolean usage) {
    CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
    Point mousepos = GuiDraw.getMousePosition();
    Point offset = guiRecipe.getRecipePosition(recipe);
    Point relMouse = new Point(mousepos.x - (guiRecipe.width - 176) / 2 - offset.x, mousepos.y - (guiRecipe.height - 166) / 2 - offset.y);
    
    if (crecipe.getFluidTanks() != null) {
        for (PositionedFluidTank tank : crecipe.getFluidTanks()) {
            if (tank.position.contains(relMouse)) {
                return tank.transfer(usage);
            }
        }
    }
    
    return false;
}
 
Example #3
Source File: ItemPanel.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
public void mouseUp(int mousex, int mousey, int button) {
    ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
    if (hoverSlot != null && hoverSlot.slotIndex == mouseDownSlot && draggedStack == null) {
        ItemStack item = hoverSlot.item;
        if (NEIController.manager.window instanceof GuiRecipe || !NEIClientConfig.canCheatItem(item)) {
            if (button == 0)
                GuiCraftingRecipe.openRecipeGui("item", item);
            else if (button == 1)
                GuiUsageRecipe.openRecipeGui("item", item);

            draggedStack = null;
            mouseDownSlot = -1;
            return;
        }

        NEIClientUtils.cheatItem(item, button, -1);
    }

    mouseDownSlot = -1;
}
 
Example #4
Source File: RecipeHandlerLavaFabricator.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(129, 2, 8, 60).contains(relMouse)) {
        currenttip.add(energyPerOperation + " RF");
    }
    return currenttip;
}
 
Example #5
Source File: RecipeHandlerBase.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public boolean mouseClicked(GuiRecipe gui, int button, int recipe) {
    if (button == 0) {
        if (this.transferFluidTank(gui, recipe, false)) {
            return true;
        }
    } else if (button == 1) {
        if (this.transferFluidTank(gui, recipe, true)) {
            return true;
        }
    }
    return super.mouseClicked(gui, button, recipe);
}
 
Example #6
Source File: RecipeHandlerBase.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) {
    if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) {
        if (this.transferFluidTank(gui, recipe, false)) {
            return true;
        }
    } else if (keyCode == NEIClientConfig.getKeyBinding("gui.usage")) {
        if (this.transferFluidTank(gui, recipe, true)) {
            return true;
        }
    }
    return super.keyTyped(gui, keyChar, keyCode, recipe);
}
 
Example #7
Source File: RecipeHandlerBase.java    From NEI-Integration with MIT License 5 votes vote down vote up
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    if (crecipe.getFluidTanks() != null) {
        for (PositionedFluidTank tank : crecipe.getFluidTanks()) {
            if (tank.position.contains(relMouse)) {
                tank.handleTooltip(currenttip);
            }
        }
    }
    return currenttip;
}
 
Example #8
Source File: RecipeHandlerBase.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> handleItemTooltip(GuiRecipe guiRecipe, ItemStack itemStack, List<String> currenttip, int recipe) {
    super.handleItemTooltip(guiRecipe, itemStack, currenttip, recipe);
    CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
    Point mouse = GuiDraw.getMousePosition();
    Point offset = guiRecipe.getRecipePosition(recipe);
    Point relMouse = new Point(mouse.x - (guiRecipe.width - 176) / 2 - offset.x, mouse.y - (guiRecipe.height - 166) / 2 - offset.y);
    
    currenttip = this.provideItemTooltip(guiRecipe, itemStack, currenttip, crecipe, relMouse);
    return currenttip;
}
 
Example #9
Source File: RecipeHandlerBase.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip, int recipe) {
    super.handleTooltip(guiRecipe, currenttip, recipe);
    CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
    if (GuiContainerManager.shouldShowTooltip(guiRecipe)) {
        Point mouse = GuiDraw.getMousePosition();
        Point offset = guiRecipe.getRecipePosition(recipe);
        Point relMouse = new Point(mouse.x - (guiRecipe.width - 176) / 2 - offset.x, mouse.y - (guiRecipe.height - 166) / 2 - offset.y);
        
        currenttip = this.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    }
    return currenttip;
}
 
Example #10
Source File: RecipeHandlerFabricator.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideItemTooltip(GuiRecipe guiRecipe, ItemStack itemStack, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideItemTooltip(guiRecipe, itemStack, currenttip, crecipe, relMouse);
    
    if (new Rectangle(20, 9, 18, 18).contains(relMouse)) {
        for (MachineFabricator.Smelting smelting : MachineFabricator.RecipeManager.smeltings) {
            if (Utils.areStacksSameTypeCraftingSafe(smelting.getResource(), itemStack) && smelting.getProduct() != null) {
                currenttip.add(EnumChatFormatting.GRAY.toString() + Utils.translate("handler.forestry.fabricator.worth") + " " + smelting.getProduct().amount + " mB");
            }
        }
    }
    
    return currenttip;
}
 
Example #11
Source File: RecipeHandlerComposter.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(129, 2, 8, 60).contains(relMouse)) {
        currenttip.add(energyPerOperation + " RF");
    }
    return currenttip;
}
 
Example #12
Source File: RecipeHandlerLaserDrill.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(139, 2, 8, 60).contains(relMouse)) {
        currenttip.add(energyPerOperation + " RF");
    }
    return currenttip;
}
 
Example #13
Source File: RecipeHandlerBioReactor.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(139, 2, 8, 60).contains(relMouse)) {
        currenttip.add(Utils.translate("handler.bioreactor.efficiency"));
        currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.bioreactor.efficiency.1"));
        currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.bioreactor.efficiency.2"));
        currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.bioreactor.efficiency.3"));
    }
    return currenttip;
}
 
Example #14
Source File: RecipeHandlerMeatPacker.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(129, 2, 8, 60).contains(relMouse)) {
        currenttip.add(energyPerOperation + " RF");
    }
    return currenttip;
}
 
Example #15
Source File: RecipeHandlerSlaughterhouse.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(28, 24, 16, 16).contains(relMouse)) {
        currenttip.add(Utils.translate("handler.slaughterhouse.animals"));
        currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.slaughterhouse.animals.1"));
    } else if (new Rectangle(129, 2, 8, 60).contains(relMouse)) {
        currenttip.add(energyPerOperation + " RF");
    }
    return currenttip;
}
 
Example #16
Source File: RecipeHandlerSludgeBoiler.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(129, 2, 8, 60).contains(relMouse)) {
        currenttip.add(energyPerOperation + " RF");
    }
    return currenttip;
}
 
Example #17
Source File: RecipeHandlerGrinder.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(44, 24, 16, 16).contains(relMouse)) {
        currenttip.add(Utils.translate("handler.grinder.mobs"));
        currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.grinder.mobs.1"));
        currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.grinder.mobs.2"));
    } else if (new Rectangle(129, 2, 8, 60).contains(relMouse)) {
        currenttip.add(energyPerOperation + " RF");
    }
    return currenttip;
}
 
Example #18
Source File: RecipeHandlerHarvester.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(129, 2, 8, 60).contains(relMouse)) {
        currenttip.add(energyPerOperation + " RF");
    } else if (new Rectangle(48, 24, 16, 16).contains(relMouse)) {
        currenttip.add(Utils.translate("handler.harvester.harvestables"));
        currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.harvester.harvestables.1"));
    }
    return currenttip;
}
 
Example #19
Source File: RecipeHandlerSewer.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    super.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
    if (new Rectangle(48, 24, 16, 16).contains(relMouse)) {
        if (!((CachedSewerRecipe) crecipe).essenceRecipe) {
            currenttip.add(Utils.translate("handler.sewer.animals"));
            currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.sewer.animals.1"));
        } else {
            currenttip.add(Utils.translate("handler.sewer.xp"));
            currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.sewer.xp.1"));
        }
    }
    return currenttip;
}
 
Example #20
Source File: RecipeHandlerOreDictionary.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe, Point relMouse) {
    if (new Rectangle(68, 21, 24, 17).contains(relMouse)) {
        currenttip.add(EnumChatFormatting.GRAY + Utils.translate("handler.oreDictionary.warning"));
    }
    return currenttip;
}
 
Example #21
Source File: PositionedStackAdv.java    From NEI-Integration with MIT License 5 votes vote down vote up
public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip) {
    if (!this.tooltip.isEmpty()) {
        for (String tip : this.tooltip) {
            currenttip.add(tip);
        }
    }
    return currenttip;
}
 
Example #22
Source File: PneumaticCraftPlugins.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe){
    loadTankTransferRects(recipe);
    return super.keyTyped(gui, keyChar, keyCode, recipe);
}
 
Example #23
Source File: PneumaticCraftPlugins.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean mouseClicked(GuiRecipe gui, int button, int recipe){
    loadTankTransferRects(recipe);
    return super.mouseClicked(gui, button, recipe);
}