diff options
author | miozune <miozune@gmail.com> | 2022-07-16 06:57:41 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-15 22:57:41 +0100 |
commit | 68bddf6abb4587ce5934c50271cd9e751b43555a (patch) | |
tree | 3a0917265a574285b38120c310cc58f449f20628 /src/main/java/gregtech/nei | |
parent | dbd0e98223f34787e557b7d4357d3480955db4d9 (diff) | |
download | GT5-Unofficial-68bddf6abb4587ce5934c50271cd9e751b43555a.tar.gz GT5-Unofficial-68bddf6abb4587ce5934c50271cd9e751b43555a.tar.bz2 GT5-Unofficial-68bddf6abb4587ce5934c50271cd9e751b43555a.zip |
Add recipe owner display (#1135)
Diffstat (limited to 'src/main/java/gregtech/nei')
-rw-r--r-- | src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java | 26 | ||||
-rw-r--r-- | src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java | 33 |
2 files changed, 50 insertions, 9 deletions
diff --git a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java index a550993b07..d98aa99ae7 100644 --- a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java @@ -24,6 +24,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import org.lwjgl.opengl.GL11; @@ -236,9 +237,10 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler { @Override public void drawExtras(int aRecipeIndex) { - int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - String[] recipeDesc = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc(); + GT_Recipe recipe = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe; + int tEUt = recipe.mEUt; + int tDuration = recipe.mDuration; + String[] recipeDesc = recipe.getNeiDesc(); if (recipeDesc == null) { if (tEUt != 0) { drawText(10, 73, trans("152","Total: ") + GT_Utility.formatNumbers((long) tDuration * tEUt) + " EU", 0xFF000000); @@ -261,14 +263,32 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler { drawText(10, 113, trans("158","Time: ") + GT_Utility.formatNumbers(0.05d * tDuration) + trans("161"," secs"), 0xFF000000); } int tSpecial = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; + boolean specialDrew = false; if (tSpecial == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) { drawText(10, 123, trans("159","Needs Low Gravity"), 0xFF000000); + specialDrew = true; } else if (tSpecial == -200 && GT_Mod.gregtechproxy.mEnableCleanroom) { drawText(10, 123, trans("160","Needs Cleanroom"), 0xFF000000); + specialDrew = true; } else if (tSpecial == -201) { drawText(10, 123, trans("206","Scan for Assembly Line"), 0xFF000000); + specialDrew = true; } else if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + GT_Utility.formatNumbers(tSpecial * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, 0xFF000000); + specialDrew = true; + } + int y = 123 + (specialDrew ? 10 : 0); + if (GT_Mod.gregtechproxy.mNEIRecipeOwner && recipe.owner != null) { + drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("225", "Recipe by: ") + recipe.owner.getName(), 0xFF000000); + y += 10; + } + if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace && recipe.stackTraces != null) { + drawText(10, y, "stackTrace:", 0xFF000000); + y += 10; + for (StackTraceElement stackTrace : recipe.stackTraces) { + drawText(10, y, stackTrace.toString(), 0xFF000000); + y += 10; + } } } else { int i = 0; diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java index 49382bd859..554c724889 100644 --- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java @@ -34,6 +34,7 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.Range; import org.lwjgl.opengl.GL11; @@ -395,9 +396,25 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { } } if (this.mRecipeMap.mNEIName.equals("gt.recipe.fusionreactor") || this.mRecipeMap.mNEIName.equals("gt.recipe.complexfusionreactor")) { - drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue) + " " + formatSpecialValueFusion(recipe.mSpecialValue, recipe.mEUt)); + if (drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue) + " " + formatSpecialValueFusion(recipe.mSpecialValue, recipe.mEUt))) { + lineCounter++; + } + } + if (drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue))) { + lineCounter++; + } + if (GT_Mod.gregtechproxy.mNEIRecipeOwner && recipe.owner != null) { + drawLine(lineCounter, EnumChatFormatting.ITALIC + GT_Utility.trans("225", "Recipe by: ") + recipe.owner.getName()); + lineCounter++; + } + if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace && recipe.stackTraces != null) { + drawLine(lineCounter, "stackTrace:"); + lineCounter++; + for (StackTraceElement stackTrace : recipe.stackTraces) { + drawLine(lineCounter, stackTrace.toString()); + lineCounter++; + } } - drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue)); } private void drawOverrideDescription(String[] recipeDesc) { @@ -460,16 +477,20 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { return "(MK " + tier + ")"; } - private void drawOptionalLine(int lineNumber, String line, String prefix) { - if (!"unspecified".equals(line)) { + private boolean drawOptionalLine(int lineNumber, String line, String prefix) { + if (!(line == null || "unspecified".equals(line))) { drawLine(lineNumber, prefix + line); + return true; } + return false; } - private void drawOptionalLine(int lineNumber, String line) { - if (!"unspecified".equals(line)) { + private boolean drawOptionalLine(int lineNumber, String line) { + if (!(line == null || "unspecified".equals(line))) { drawLine(lineNumber, line); + return true; } + return false; } private void drawLine(int lineNumber, String line) { |