aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorConnor-Colenso <52056774+Connor-Colenso@users.noreply.github.com>2022-06-10 10:15:08 +0100
committerGitHub <noreply@github.com>2022-06-10 11:15:08 +0200
commita894c865281c0d8875600dbe6125231421424ad5 (patch)
tree7fbe19c93dbfcf12c84fd35ee5f30fb10b26092b /src/main
parent6ced738344fbf1b2bfccc2b753cf52c4d720e408 (diff)
downloadGT5-Unofficial-a894c865281c0d8875600dbe6125231421424ad5.tar.gz
GT5-Unofficial-a894c865281c0d8875600dbe6125231421424ad5.tar.bz2
GT5-Unofficial-a894c865281c0d8875600dbe6125231421424ad5.zip
Adjust NEI recipe pages (#1077)
* Add config support for changes. * Change ticks config to default OFF. * Usage -> Voltage for some cases. Also fix language translations. * Remove comment. * Remove redundant null check. * Bring back null checks (crashes). Move config to client. Adjust priorities so that if OC is detected it will display usage instead of voltage. * Remove null checks again (but for realsies this time). * Add language localisation. * Update language localisation. Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/gregtech/api/util/GT_LanguageManager.java3
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java1
-rw-r--r--src/main/java/gregtech/common/power/Power.java6
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_PreLoad.java30
-rw-r--r--src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java77
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang7
6 files changed, 74 insertions, 50 deletions
diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java
index b71fc7ca2b..b134f3c726 100644
--- a/src/main/java/gregtech/api/util/GT_LanguageManager.java
+++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java
@@ -364,7 +364,8 @@ public class GT_LanguageManager {
addStringLocalization("Interaction_DESCRIPTION_Index_221", "Item threshold");
addStringLocalization("Interaction_DESCRIPTION_Index_222", "Fluid threshold");
addStringLocalization("Interaction_DESCRIPTION_Index_223", "Single recipe locking enabled. Will lock to next recipe.");
- addStringLocalization("Interaction_DESCRIPTION_Index_500", "Fitting: Loose - More Flow");
+ addStringLocalization("Interaction_DESCRIPTION_Index_224", " ticks");
+ addStringLocalization("Interaction_DESCRIPTION_Index_500", "Fitting: Loose - More Flow");
addStringLocalization("Interaction_DESCRIPTION_Index_501", "Fitting: Tight - More Efficiency");
addStringLocalization("Item_DESCRIPTION_Index_000", "Stored Heat: %s");
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index 9420a106ea..8491ea328c 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -153,6 +153,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean mIncreaseDungeonLoot = true;
public boolean mAxeWhenAdventure = true;
public boolean mSurvivalIntoAdventure = false;
+ public boolean mNEIRecipeSecondMode = true;
public boolean mNerfedWoodPlank = true;
public boolean mNerfedVanillaTools = true;
public boolean mHardRock = false;
diff --git a/src/main/java/gregtech/common/power/Power.java b/src/main/java/gregtech/common/power/Power.java
index e0526c14aa..eac33e7997 100644
--- a/src/main/java/gregtech/common/power/Power.java
+++ b/src/main/java/gregtech/common/power/Power.java
@@ -34,10 +34,14 @@ public abstract class Power {
return 0.05d * getDurationTicks();
}
- public String getDurationString() {
+ public String getDurationStringSeconds() {
return GT_Utility.formatNumbers(getDurationSeconds()) + GT_Utility.trans("161", " secs");
}
+ public String getDurationStringTicks() {
+ return GT_Utility.formatNumbers(getDurationTicks()) + GT_Utility.trans("224", " ticks");
+ }
+
public abstract String getTotalPowerString();
public abstract String getPowerUsageString();
diff --git a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
index 4fb7ec54a3..d6b490fc9b 100644
--- a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
+++ b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
@@ -238,12 +238,12 @@ public class GT_PreLoad {
List<String> mMTTags = new ArrayList<>();
oreTags.stream()
- .filter(test -> StringUtils.startsWithAny(test, preS))
- .forEach(test -> {
- mMTTags.add(test);
- if (GT_Values.D1)
- GT_FML_LOGGER.info("oretag: " + test);
- });
+ .filter(test -> StringUtils.startsWithAny(test, preS))
+ .forEach(test -> {
+ mMTTags.add(test);
+ if (GT_Values.D1)
+ GT_FML_LOGGER.info("oretag: " + test);
+ });
GT_FML_LOGGER.info("reenableMetaItems");
@@ -490,8 +490,8 @@ public class GT_PreLoad {
GT_Mod.gregtechproxy.mGraniteHavestLevel = GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3);
GT_Mod.gregtechproxy.mMaxHarvestLevel = Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel", 7));
Materials.getMaterialsMap().values().parallelStream().filter(tMaterial -> tMaterial != null && tMaterial.mToolQuality > 0 && tMaterial.mMetaItemSubID < GT_Mod.gregtechproxy.mHarvestLevel.length && tMaterial.mMetaItemSubID >= 0).forEach(
- tMaterial -> GT_Mod.gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName, tMaterial.mToolQuality)
- );
+ tMaterial -> GT_Mod.gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName, tMaterial.mToolQuality)
+ );
}
if (tMainConfig.get("general", "hardermobspawners", true).getBoolean(true)) {
@@ -519,12 +519,12 @@ public class GT_PreLoad {
public static void loadClientConfig() {
String SBdye0 = "ColorModulation.";
Arrays.stream(Dyes.values()).filter(tDye -> (tDye != Dyes._NULL) && (tDye.mIndex < 0)).forEach(tDye -> {
- String SBdye1 = SBdye0 + tDye;
- tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "R", tDye.mOriginalRGBa[0]))));
- tDye.mRGBa[1] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "G", tDye.mOriginalRGBa[1]))));
- tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "B", tDye.mOriginalRGBa[2]))));
- }
- );
+ String SBdye1 = SBdye0 + tDye;
+ tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "R", tDye.mOriginalRGBa[0]))));
+ tDye.mRGBa[1] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "G", tDye.mOriginalRGBa[1]))));
+ tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "B", tDye.mOriginalRGBa[2]))));
+ }
+ );
GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion = GregTech_API.sClientDataFile.get("render", "TileAmbientOcclusion", true);
GT_Mod.gregtechproxy.mRenderGlowTextures = GregTech_API.sClientDataFile.get("render", "GlowTextures", true);
GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped = GregTech_API.sClientDataFile.get("render", "RenderFlippedMachinesFlipped", true);
@@ -535,6 +535,8 @@ public class GT_PreLoad {
GT_Mod.gregtechproxy.mCoverTabsFlipped = GregTech_API.sClientDataFile.get("interface", "FlipCoverTabs", false);
GT_Mod.gregtechproxy.mTooltipVerbosity = GregTech_API.sClientDataFile.get("interface", "TooltipVerbosity", 2);
GT_Mod.gregtechproxy.mTooltipShiftVerbosity = GregTech_API.sClientDataFile.get("interface", "TooltipShiftVerbosity", 3);
+ GT_Mod.gregtechproxy.mNEIRecipeSecondMode = GregTech_API.sClientDataFile.get("features", "NEI_recipe_second_mode", true);
+
final String[] Circuits = GregTech_API.sClientDataFile.get("interface", "CircuitsOrder" );
GT_Mod.gregtechproxy.mCircuitsOrder.clear();
for (int i = 0; i < Circuits.length; i++) {
diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
index b83c59eb20..39b0c9e3bb 100644
--- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
@@ -14,17 +14,14 @@ import codechicken.nei.recipe.IUsageHandler;
import codechicken.nei.recipe.RecipeCatalysts;
import codechicken.nei.recipe.TemplateRecipeHandler;
import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.gui.GT_GUIContainer;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.objects.ItemData;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
+import gregtech.api.util.*;
import gregtech.common.power.EUPower;
import gregtech.common.power.Power;
import gregtech.common.power.UnspecifiedEUPower;
@@ -64,7 +61,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
private NEIHandlerAbsoluteTooltip mRecipeNameTooltip;
private static final int RECIPE_NAME_WIDTH = 140;
- /**
+ /**
* Static version of {@link TemplateRecipeHandler#cycleticks}.
* Can be referenced from cached recipes.
*/
@@ -96,10 +93,10 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
List<CachedDefaultRecipe> cache;
if (cacheHolder.getCachedRecipesVersion() != GT_Mod.gregtechproxy.getReloadCount() || (cache = cacheHolder.getCachedRecipes()) == null) {
cache = mRecipeMap.mRecipeList.stream() // do not use parallel stream. This is already parallelized by NEI
- .filter(r -> !r.mHidden)
- .sorted()
- .map(CachedDefaultRecipe::new)
- .collect(Collectors.toList());
+ .filter(r -> !r.mHidden)
+ .sorted()
+ .map(CachedDefaultRecipe::new)
+ .collect(Collectors.toList());
// while the NEI parallelize handlers, for each individual handler it still uses sequential execution model
// so we do not need any synchronization here
// even if it does break, at worst case it's just recreating the cache multiple times, which should be fine
@@ -314,7 +311,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
for (PositionedStack tStack : tRecipe.mInputs) {
if (aStack == tStack.item) {
if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) ||
- (tStack.item.stackSize != 0)) {
+ (tStack.item.stackSize != 0)) {
break;
}
currenttip.add(GT_Utility.trans("151", "Does not get consumed in the process"));
@@ -356,23 +353,41 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
mPower = getPowerFromRecipeMap();
}
mPower.computePowerUsageAndDuration(recipe.mEUt, recipe.mDuration);
+
+ int lineCounter = 0;
if (mPower.getEuPerTick() > 0) {
- drawPowerUsageLines();
+ drawLine(lineCounter, GT_Utility.trans("152", "Total: ") + mPower.getTotalPowerString());
+ lineCounter++;
+
+ if (mPower.getAmperageString().equals("unspecified") || mPower.getPowerUsageString().contains("(OC)")){
+ drawLine(lineCounter, GT_Utility.trans("153", "Usage: ") + mPower.getPowerUsageString());
+ lineCounter++;
+ } else if (mPower.getAmperageString().equals("1")) {
+ drawLine(lineCounter, GT_Utility.trans("154", "Voltage: ") + mPower.getVoltageString());
+ lineCounter++;
+ } else {
+ drawLine(lineCounter, GT_Utility.trans("153", "Usage: ") + mPower.getPowerUsageString());
+ lineCounter++;
+ drawLine(lineCounter, GT_Utility.trans("154", "Voltage: ") + mPower.getVoltageString());
+ lineCounter++;
+ drawLine(lineCounter, GT_Utility.trans("155", "Amperage: ") + mPower.getAmperageString());
+ lineCounter++;
+ }
+
}
if (mPower.getDurationTicks() > 0) {
- drawLine(4, GT_Utility.trans("158", "Time: ") + mPower.getDurationString());
+ if(GT_Mod.gregtechproxy.mNEIRecipeSecondMode) {
+ drawLine(lineCounter, GT_Utility.trans("158", "Time: ") + mPower.getDurationStringSeconds());
+ lineCounter++;
+ } else {
+ drawLine(lineCounter, GT_Utility.trans("158", "Time: ") + mPower.getDurationStringTicks());
+ lineCounter++;
+ }
}
if (this.mRecipeMap.mNEIName.equals("gt.recipe.fusionreactor")) {
- drawOptionalLine(5, getSpecialInfo(recipe.mSpecialValue) + " " + formatSpecialValueFusion(recipe.mSpecialValue, recipe.mEUt));
+ drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue) + " " + formatSpecialValueFusion(recipe.mSpecialValue, recipe.mEUt));
}
- drawOptionalLine(5, getSpecialInfo(recipe.mSpecialValue));
- }
-
- private void drawPowerUsageLines() {
- drawLine(0, GT_Utility.trans("152", "Total: ") + mPower.getTotalPowerString());
- drawLine(1, GT_Utility.trans("153", "Usage: ") + mPower.getPowerUsageString());
- drawOptionalLine(2, mPower.getVoltageString(), GT_Utility.trans("154", "Voltage: "));
- drawOptionalLine(3, mPower.getAmperageString(), GT_Utility.trans("155", "Amperage: "));
+ drawOptionalLine(lineCounter, getSpecialInfo(recipe.mSpecialValue));
}
private void drawOverrideDescription(String[] recipeDesc) {
@@ -403,13 +418,13 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
private boolean hasSpecialValueFormat() {
return (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre))
- || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost));
+ || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost));
}
private String formatSpecialValue(int SpecialValue) {
return this.mRecipeMap.mNEISpecialValuePre + GT_Utility.formatNumbers(
- (long) SpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)
- + this.mRecipeMap.mNEISpecialValuePost;
+ (long) SpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)
+ + this.mRecipeMap.mNEISpecialValuePost;
}
private String formatSpecialValueFusion(int SpecialValue, int Voltage) {
@@ -436,13 +451,13 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
private void drawOptionalLine(int lineNumber, String line, String prefix) {
- if (line != null) {
+ if (!"unspecified".equals(line)) {
drawLine(lineNumber, prefix + line);
}
}
private void drawOptionalLine(int lineNumber, String line) {
- if (line != null) {
+ if (!"unspecified".equals(line)) {
drawLine(lineNumber, line);
}
}
@@ -452,7 +467,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
public static class GT_RectHandler
- implements IContainerInputHandler, IContainerTooltipHandler {
+ implements IContainerInputHandler, IContainerTooltipHandler {
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
if (canHandle(gui)) {
@@ -471,8 +486,8 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
private Point getMousePos(GuiContainer gui, int mousex, int mousey) {
Point point = new Point(
- mousex - ((GT_GUIContainer) gui).getLeft() - getGuiOffset(gui)[0],
- mousey - ((GT_GUIContainer) gui).getTop() - getGuiOffset(gui)[1]);
+ mousex - ((GT_GUIContainer) gui).getLeft() - getGuiOffset(gui)[0],
+ mousey - ((GT_GUIContainer) gui).getTop() - getGuiOffset(gui)[1]);
return point;
}
@@ -602,7 +617,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
public class CachedDefaultRecipe
- extends TemplateRecipeHandler.CachedRecipe {
+ extends TemplateRecipeHandler.CachedRecipe {
public final GT_Recipe mRecipe;
public final List<PositionedStack> mOutputs;
public final List<PositionedStack> mInputs;
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index 8aab9fcb80..39e9feb3c5 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -127,8 +127,8 @@ GT5U.machines.stalled_stuttering.tooltip.3=§7the recipe to complete it.
GT5U.machines.stalled_stuttering.tooltip.extended=§7Progress was lost, but not
GT5U.machines.stalled_stuttering.tooltip.extended.1=§7the recipe's output.
GT5U.machines.stalled_vent.tooltip=§4Stalled: Cannot vent steam!
-GT5U.machines.stalled_vent.tooltip.1=§7Right-click with a wrench to
-GT5U.machines.stalled_vent.tooltip.2=§7point this machine's steam
+GT5U.machines.stalled_vent.tooltip.1=§7Right-click with a wrench to
+GT5U.machines.stalled_vent.tooltip.2=§7point this machine's steam
GT5U.machines.stalled_vent.tooltip.3=§7vent towards an empty space.
GT5U.machines.stalled_vent.tooltip.extended=§7Progress was lost, but not
GT5U.machines.stalled_vent.tooltip.extended.1=§7the recipe's output.
@@ -202,6 +202,7 @@ GT5U.config.render.RenderFlippedMachinesFlipped=Render flipped machines with fli
GT5U.config.render.RenderIndicatorsOnHatch=Render indicator on hatch
GT5U.config.render.RenderPollutionFog=Render pollution fog
GT5U.config.render.TileAmbientOcclusion=Enable Ambient Occlusion
+GT5U.config.feature.NEI_recipe_second_mode=Show NEI recipes using seconds (as opposed to ticks).
// Cover tabs
GT5U.interface.coverTabs.down=Bottom
@@ -807,7 +808,7 @@ gregtech.areaLethargic=Lethargic
gregtech.areaExploratory=Exploratory
gregtech.speedUnproductive=Unproductive
gregtech.speedAccelerated=Accelerated
-gregtech.lifeBlink=Blink
+gregtech.lifeBlink=Blink
gregtech.lifeEon=Eon
entity.gregtech.GT_Entity_Arrow.name= a GregTech arrow