From a1171e03fde7a870c8ba00bfef42171b884fa0e1 Mon Sep 17 00:00:00 2001 From: Technus Date: Fri, 16 Jun 2017 10:45:42 +0200 Subject: fix gui issues and add new lang to assline nei --- .../java/gregtech/nei/GT_NEI_AssLineHandler.java | 47 +++++++++++++++------- .../java/gregtech/nei/GT_NEI_DefaultHandler.java | 20 ++++----- 2 files changed, 42 insertions(+), 25 deletions(-) (limited to 'src/main/java/gregtech') diff --git a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java index c917bb9e71..a2fad03c6f 100644 --- a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java @@ -10,6 +10,7 @@ import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.GuiUsageRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; import cpw.mods.fml.common.event.FMLInterModComms; +import gregtech.GT_Mod; import gregtech.api.enums.GT_Values; import gregtech.api.enums.OrePrefixes; import gregtech.api.gui.GT_GUIContainer_BasicMachine; @@ -31,6 +32,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import static gregtech.api.util.GT_Utility.trans; + public class GT_NEI_AssLineHandler extends TemplateRecipeHandler { public static final int sOffsetX = 5; @@ -212,22 +215,36 @@ public class GT_NEI_AssLineHandler public void drawExtras(int aRecipeIndex) { int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - if (tEUt != 0) { - drawText(10, 73, "Total: " + tDuration * tEUt + " EU", -16777216); - drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); - if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 93, "Voltage: " + tEUt / this.mRecipeMap.mAmperage + " EU", -16777216); - drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); - } else { - drawText(10, 93, "Voltage: unspecified", -16777216); - drawText(10, 103, "Amperage: unspecified", -16777216); + String[] recipeDesc = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc(); + if (recipeDesc == null) { + if (tEUt != 0) { + drawText(10, 73, trans("152","Total: ") + tDuration * tEUt + " EU", -16777216); + drawText(10, 83, trans("153","Usage: ") + tEUt + " EU/t", -16777216); + if (this.mRecipeMap.mShowVoltageAmperageInNEI) { + drawText(10, 93, trans("154","Voltage: ") + tEUt / this.mRecipeMap.mAmperage + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + this.mRecipeMap.mAmperage, -16777216); + } else { + drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); + drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); + } + } + if (tDuration > 0) { + drawText(10, 113, trans("158","Time: ")+String.format("%.2f " + trans("161"," secs"), 0.05F * tDuration), -16777216); + } + int tSpecial = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; + if (tSpecial == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) { + drawText(10, 123, trans("159","Needs Low Gravity"), -16777216); + } else if (tSpecial == -200 && GT_Mod.gregtechproxy.mEnableCleanroom) { + drawText(10, 123, trans("160","Needs Cleanroom"), -16777216); + } else if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { + drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + tSpecial * this.mRecipeMap.mNEISpecialValueMultiplier + this.mRecipeMap.mNEISpecialValuePost, -16777216); + } + } else { + int i = 0; + for (String descLine : recipeDesc) { + drawText(10, 73 + 10 * i, descLine, -16777216); + i++; } - } - if (tDuration > 0) { - drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); - } - if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier + this.mRecipeMap.mNEISpecialValuePost, -16777216); } } diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java index 6371df5904..388128b378 100644 --- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java @@ -358,21 +358,21 @@ public class GT_NEI_DefaultHandler public class CachedDefaultRecipe extends TemplateRecipeHandler.CachedRecipe { public final GT_Recipe mRecipe; - public final List mOutputs = new ArrayList();//Constructor here! - public final List mInputs = new ArrayList();//Constructor here! + public final List mOutputs; + public final List mInputs; public CachedDefaultRecipe(GT_Recipe aRecipe) { super(); this.mRecipe = aRecipe; - //if (aRecipe.getInputPositionedStacks() != null && aRecipe.getOutputPositionedStacks() != null) { - // mInputs = aRecipe.getInputPositionedStacks(); - // mOutputs = aRecipe.getOutputPositionedStacks(); - // return; - //} - //TODO check THE code above and below was replaced with constructor above - //mOutputs = new ArrayList(); - //mInputs = new ArrayList(); + if (aRecipe.getInputPositionedStacks() != null && aRecipe.getOutputPositionedStacks() != null) { + mInputs = aRecipe.getInputPositionedStacks(); + mOutputs = aRecipe.getOutputPositionedStacks(); + return; + } + + mOutputs = new ArrayList<>(); + mInputs = new ArrayList<>(); int tStartIndex = 0; switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) { -- cgit