aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtneioreplugin/plugin/PluginBase.java
blob: 065046f74ba13f155f9708799e516e42a95bcdf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package gtneioreplugin.plugin;

import java.awt.Rectangle;

import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting;

import codechicken.lib.gui.GuiDraw;
import codechicken.nei.recipe.TemplateRecipeHandler;

public abstract class PluginBase extends TemplateRecipeHandler {

    @Override
    public int recipiesPerPage() {
        return 1;
    }

    @Override
    public String getRecipeName() {
        return null;
    }

    @Override
    public String getGuiTexture() {
        return "gtneioreplugin:textures/gui/nei/guiBase.png";
    }

    @Override
    public void loadTransferRects() {
        int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"));
        transferRects.add(
            new RecipeTransferRect(new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId()));
    }

    public abstract String getOutputId();

    public int getGuiWidth() {
        return 166;
    }

    /**
     * Draw the "see all recipes" transfer label
     */
    protected void drawSeeAllRecipesLabel() {
        GuiDraw.drawStringR(
            EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"),
            getGuiWidth() - 3,
            5,
            0x404040,
            false);
    }
}