From 3c7af07285fbdbd038d0aa324ca8fa566ceb343d Mon Sep 17 00:00:00 2001 From: miozune Date: Sat, 30 Jul 2022 10:26:51 +0900 Subject: Expose some of the NEI methods and fields to addons (#1159) * Expose NEI description y offset so that large GUI from addons can fit in * more protected * more protected --- src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java index 69ea959adc..35b0c49a2a 100644 --- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java @@ -60,7 +60,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { private static final int M = 1000000; private static final ConcurrentMap CACHE = new ConcurrentHashMap<>(); - private Power mPower; + protected Power mPower; private String mRecipeName; // Name of the handler displayed on top private NEIHandlerAbsoluteTooltip mRecipeNameTooltip; private static final int RECIPE_NAME_WIDTH = 140; @@ -435,7 +435,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { } } - private String getSpecialInfo(int specialValue) { + protected String getSpecialInfo(int specialValue) { String specialInfo = null; if (specialValue == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) { specialInfo = GT_Utility.trans("159", "Needs Low Gravity"); @@ -458,7 +458,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost)); } - private String formatSpecialValue(int SpecialValue) { + protected String formatSpecialValue(int SpecialValue) { return this.mRecipeMap.mNEISpecialValuePre + GT_Utility.formatNumbers( (long) SpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost; @@ -487,7 +487,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { return "(MK " + tier + ")"; } - private boolean drawOptionalLine(int lineNumber, String line, String prefix) { + protected boolean drawOptionalLine(int lineNumber, String line, String prefix) { if (!(line == null || "unspecified".equals(line))) { drawLine(lineNumber, prefix + line); return true; @@ -495,7 +495,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { return false; } - private boolean drawOptionalLine(int lineNumber, String line) { + protected boolean drawOptionalLine(int lineNumber, String line) { if (!(line == null || "unspecified".equals(line))) { drawLine(lineNumber, line); return true; @@ -503,8 +503,12 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { return false; } - private void drawLine(int lineNumber, String line) { - drawText(10, 73 + lineNumber * 10, line, 0xFF000000); + protected void drawLine(int lineNumber, String line) { + drawText(10, getDescriptionYOffset() + lineNumber * 10, line, 0xFF000000); + } + + protected int getDescriptionYOffset() { + return 73; } public static class GT_RectHandler -- cgit