Java Code Examples for codechicken.nei.guihook.GuiContainerManager#getStackMouseOver()

The following examples show how to use codechicken.nei.guihook.GuiContainerManager#getStackMouseOver() . 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: RecipeItemInputHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
    ItemStack stackover = GuiContainerManager.getStackMouseOver(gui);
    if (stackover == null || !(gui instanceof GuiRecipe)) {
        return false;
    }

    if (button == 0) {
        return GuiCraftingRecipe.openRecipeGui("item", stackover.copy());
    }

    if (button == 1) {
        return GuiUsageRecipe.openRecipeGui("item", stackover.copy());
    }

    return false;
}
 
Example 2
Source File: FireworkRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
    currenttip = super.handleTooltip(gui, currenttip, recipe);
    Point mousepos = GuiDraw.getMousePosition();
    Point relMouse = new Point(mousepos.x - gui.guiLeft, mousepos.y - gui.guiTop);
    Point recipepos = gui.getRecipePosition(recipe);
    if (currenttip.isEmpty() && GuiContainerManager.getStackMouseOver(gui) == null && new Rectangle(recipepos.x, recipepos.y, 166, 55).contains(relMouse)) {
        currenttip.add(NEIClientUtils.translate("recipe.firework.tooltip" + ((CachedFireworkRecipe) arecipes.get(recipe)).recipeType));
    }
    return currenttip;
}
 
Example 3
Source File: RecipeItemInputHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode)
{
    ItemStack stackover = GuiContainerManager.getStackMouseOver(gui);
    if(stackover == null)
        return false;
            
    if(keyCode == NEIClientConfig.getKeyBinding("gui.usage") || (keyCode == NEIClientConfig.getKeyBinding("gui.recipe") && NEIClientUtils.shiftKey()))
        return GuiUsageRecipe.openRecipeGui("item", stackover.copy());
    
    if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe"))
        return GuiCraftingRecipe.openRecipeGui("item", stackover.copy());
    
    return false;
}
 
Example 4
Source File: RecipeItemInputHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button)
{
    ItemStack stackover = GuiContainerManager.getStackMouseOver(gui);
    if(stackover == null || !(gui instanceof GuiRecipe))
        return false;
    
    if(button == 0)
        return GuiCraftingRecipe.openRecipeGui("item", stackover.copy());

    if(button == 1)
        return GuiUsageRecipe.openRecipeGui("item", stackover.copy());
    
    return false;
}
 
Example 5
Source File: FireworkRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
    currenttip = super.handleTooltip(gui, currenttip, recipe);
    Point mousepos = GuiDraw.getMousePosition();
    Point relMouse = new Point(mousepos.x - gui.guiLeft, mousepos.y - gui.guiTop);
    Point recipepos = gui.getRecipePosition(recipe);
    if (currenttip.isEmpty() && GuiContainerManager.getStackMouseOver(gui) == null &&
            new Rectangle(recipepos.x, recipepos.y, 166, 55).contains(relMouse))
        currenttip.add(NEIClientUtils.translate(
                "recipe.firework.tooltip" + ((CachedFireworkRecipe) arecipes.get(recipe)).recipeType));
    return currenttip;
}