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

The following examples show how to use codechicken.nei.guihook.GuiContainerManager#shouldShowTooltip() . 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: TooltipHandler.java    From wailanbt with MIT License 6 votes vote down vote up
@Override
public List<String> handleItemTooltip(GuiContainer guiContainer, ItemStack itemStack, int i, int i2, List<String> strings) {
    if (guiContainer != null && GuiContainerManager.shouldShowTooltip(guiContainer) && itemStack != null) {
        NBTTagCompound n = itemStack.getTagCompound();
        if (n != null) {
            NBTHandler.flag = 2;
            NBTHandler.id = Item.itemRegistry.getNameForObject(itemStack.getItem());
            List<String> tips = NBTHandler.getTipsFromNBT(n, "tooltip");
            for (String tip:tips){
                strings.add(1, "\u00a77" + tip);
            }
            return strings;
        }
    }
    return strings;
}
 
Example 2
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 3
Source File: TemplateRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
    if (!canHandle(gui)) {
        return currenttip;
    }

    if (GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) {
        int[] offset = RecipeInfo.getGuiOffset(gui);
        currenttip = TemplateRecipeHandler.transferRectTooltip(gui, guiMap.get(gui.getClass()), offset[0], offset[1], currenttip);
    }
    return currenttip;
}
 
Example 4
Source File: TemplateRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
    if (GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) {
        Point offset = gui.getRecipePosition(recipe);
        currenttip = transferRectTooltip(gui, transferRects, offset.x, offset.y, currenttip);
    }
    return currenttip;
}
 
Example 5
Source File: TemplateRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
    if (!canHandle(gui))
        return currenttip;

    if (GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) {
        int[] offset = RecipeInfo.getGuiOffset(gui);
        currenttip = TemplateRecipeHandler.transferRectTooltip(gui, guiMap.get(gui.getClass()), offset[0], offset[1], currenttip);
    }
    return currenttip;
}
 
Example 6
Source File: TemplateRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
    if (GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) {
        Point offset = gui.getRecipePosition(recipe);
        currenttip = transferRectTooltip(gui, transferRects, offset.x, offset.y, currenttip);
    }
    return currenttip;
}
 
Example 7
Source File: TooltipHandler.java    From OmniOcular with Apache License 2.0 5 votes vote down vote up
@Override
public List<String> handleItemTooltip(GuiContainer guiContainer, ItemStack itemStack, int i, int i2, List<String> currenttip) {
    if (guiContainer != null && GuiContainerManager.shouldShowTooltip(guiContainer) && itemStack != null) {
        NBTTagCompound n = itemStack.getTagCompound();

        //accessor.getTileEntity().writeToNBT(n);
        if (n != null) {
            currenttip.addAll(1, JSHandler.getBody(ConfigHandler.tooltipPattern, n, Item.itemRegistry.getNameForObject(itemStack.getItem()), guiContainer.mc.thePlayer));

        }
    }
    return currenttip;
}
 
Example 8
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;
}