aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
diff options
context:
space:
mode:
authorGlodBlock <1356392126@qq.com>2021-09-26 22:36:32 +0800
committerGlodBlock <1356392126@qq.com>2021-09-26 22:36:32 +0800
commit92433a5b85bb2fcca541ac25ca4033fac24f841e (patch)
tree90f26b34d5059eb9858d9c82aabbd5373638acfa /src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
parentc82b604a02d6d5aab7e63ca5ea9337ae6552f513 (diff)
parentbb392ea9d1e837e849a05507e72b63c4bca3f5b2 (diff)
downloadGT5-Unofficial-92433a5b85bb2fcca541ac25ca4033fac24f841e.tar.gz
GT5-Unofficial-92433a5b85bb2fcca541ac25ca4033fac24f841e.tar.bz2
GT5-Unofficial-92433a5b85bb2fcca541ac25ca4033fac24f841e.zip
Merge branch 'experimental' of https://github.com/GTNewHorizons/GT5-Unofficial into fix-crack-recipe-check
Diffstat (limited to 'src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java')
-rw-r--r--src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java124
1 files changed, 64 insertions, 60 deletions
diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
index 802fcdbc6e..337c82e67f 100644
--- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
@@ -12,8 +12,10 @@ 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.ItemList;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.gui.GT_GUIContainer_BasicMachine;
+import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.ItemData;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Log;
@@ -98,13 +100,14 @@ public class GT_NEI_DefaultHandler extends TemplateRecipeHandler {
}
}
FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true);
+ FluidStack tFluidStack;
if (tFluid != null) {
+ tFluidStack = tFluid;
tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false));
- for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
- if (tData.fluid.isFluidEqual(tFluid)) {
- tResults.add(GT_Utility.copyOrNull(tData.filledContainer));
- }
- }
+ }
+ else tFluidStack = GT_Utility.getFluidFromDisplayStack(aResult);
+ if (tFluidStack != null) {
+ tResults.addAll(GT_Utility.getContainersFromFluid(tFluidStack));
}
for (GT_Recipe tRecipe : getSortedRecipes()) {
if (!tRecipe.mHidden) {
@@ -132,13 +135,14 @@ public class GT_NEI_DefaultHandler extends TemplateRecipeHandler {
}
}
FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true);
+ FluidStack tFluidStack;
if (tFluid != null) {
+ tFluidStack = tFluid;
tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false));
- for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
- if (tData.fluid.isFluidEqual(tFluid)) {
- tInputs.add(GT_Utility.copyOrNull(tData.filledContainer));
- }
- }
+ }
+ else tFluidStack = GT_Utility.getFluidFromDisplayStack(aInput);
+ if (tFluidStack != null) {
+ tInputs.addAll(GT_Utility.getContainersFromFluid(tFluidStack));
}
for (GT_Recipe tRecipe : getSortedRecipes()) {
if (!tRecipe.mHidden) {
@@ -210,16 +214,16 @@ public class GT_NEI_DefaultHandler extends TemplateRecipeHandler {
return currenttip;
}
- @Override
+ @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();
- if (recipeDesc == null) {
- if (tEUt != 0) {
- drawText(10, 73, trans("152","Total: ") + GT_Utility.formatNumbers((long) tDuration * tEUt) + " EU", 0xFF000000);
- drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers(tEUt) + " EU/t", 0xFF000000);
- if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
+ 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();
+ if (recipeDesc == null) {
+ if (tEUt != 0) {
+ drawText(10, 73, trans("152","Total: ") + GT_Utility.formatNumbers((long) tDuration * tEUt) + " EU", 0xFF000000);
+ drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers(tEUt) + " EU/t", 0xFF000000);
+ if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
int voltage = tEUt / this.mRecipeMap.mAmperage;
byte tier = GT_Utility.getTier(voltage);
if (tier < 0 || tier >= 16) {
@@ -229,19 +233,19 @@ public class GT_NEI_DefaultHandler extends TemplateRecipeHandler {
drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU (" + GT_Values.VN[tier] + ")", 0xFF000000);
}
drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(this.mRecipeMap.mAmperage), 0xFF000000);
- } else {
- drawText(10, 93, trans("156","Voltage: unspecified"), 0xFF000000);
- drawText(10, 103, trans("157","Amperage: unspecified"), 0xFF000000);
- }
- }
- if (tDuration > 0) {
- 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;
- if (tSpecial == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) {
- drawText(10, 123, trans("159","Needs Low Gravity"), 0xFF000000);
- } else if (tSpecial == -200 && GT_Mod.gregtechproxy.mEnableCleanroom) {
- drawText(10, 123, trans("160","Needs Cleanroom"), 0xFF000000);
+ } else {
+ drawText(10, 93, trans("156","Voltage: unspecified"), 0xFF000000);
+ drawText(10, 103, trans("157","Amperage: unspecified"), 0xFF000000);
+ }
+ }
+ if (tDuration > 0) {
+ 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;
+ if (tSpecial == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) {
+ drawText(10, 123, trans("159","Needs Low Gravity"), 0xFF000000);
+ } else if (tSpecial == -200 && GT_Mod.gregtechproxy.mEnableCleanroom) {
+ drawText(10, 123, trans("160","Needs Cleanroom"), 0xFF000000);
} else if (tSpecial == -201) {
drawText(10, 123, trans("206","Scan for Assembly Line"), 0xFF000000);
} else if (tSpecial == -300 && GT_Mod.gregtechproxy.mEnableCleanroom) {
@@ -249,16 +253,16 @@ public class GT_NEI_DefaultHandler extends TemplateRecipeHandler {
} else if (tSpecial == -400) {
drawText(10, 123, trans("216","Deprecated Recipe"), 0xFF000000);
} 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);
- }
- } else {
- int i = 0;
- for (String descLine : recipeDesc) {
- drawText(10, 73 + 10 * i, descLine, 0xFF000000);
- i++;
- }
- }
- }
+ drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + GT_Utility.formatNumbers(tSpecial * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, 0xFF000000);
+ }
+ } else {
+ int i = 0;
+ for (String descLine : recipeDesc) {
+ drawText(10, 73 + 10 * i, descLine, 0xFF000000);
+ i++;
+ }
+ }
+ }
public static class GT_RectHandler
implements IContainerInputHandler, IContainerTooltipHandler {
@@ -282,8 +286,8 @@ public class GT_NEI_DefaultHandler extends TemplateRecipeHandler {
public boolean canHandle(GuiContainer gui) {
return (gui instanceof GT_GUIContainer_BasicMachine && GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI))
- || (gui instanceof GT_GUIContainer_FusionReactor && GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))
- || (gui instanceof GT_GUIContainer_PrimitiveBlastFurnace && GT_Utility.isStringValid(((GT_GUIContainer_PrimitiveBlastFurnace) gui).mNEI));
+ || (gui instanceof GT_GUIContainer_FusionReactor && GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))
+ || (gui instanceof GT_GUIContainer_PrimitiveBlastFurnace && GT_Utility.isStringValid(((GT_GUIContainer_PrimitiveBlastFurnace) gui).mNEI));
}
@Override
@@ -409,33 +413,33 @@ public class GT_NEI_DefaultHandler extends TemplateRecipeHandler {
public CachedDefaultRecipe(GT_Recipe aRecipe) {
super();
this.mRecipe = aRecipe;
- List<PositionedStack> maybeIn;
- List<PositionedStack> maybeOut;
-
- try {
+ List<PositionedStack> maybeIn;
+ List<PositionedStack> maybeOut;
+
+ try {
maybeIn = aRecipe.getInputPositionedStacks();
} catch(NullPointerException npe) {
- maybeIn = null;
- GT_Log.err.println("CachedDefaultRecipe - Invalid InputPositionedStacks " + aRecipe.toString());
+ maybeIn = null;
+ GT_Log.err.println("CachedDefaultRecipe - Invalid InputPositionedStacks " + aRecipe.toString());
npe.printStackTrace(GT_Log.err);
}
- try {
+ try {
maybeOut = aRecipe.getOutputPositionedStacks();
} catch (NullPointerException npe) {
- maybeOut = null;
+ maybeOut = null;
GT_Log.err.println("CachedDefaultRecipe - Invalid OutputPositionedStacks " + aRecipe.toString());
npe.printStackTrace(GT_Log.err);
}
-
+
if ( maybeIn != null && maybeOut != null) {
- mInputs = maybeIn;
- mOutputs = maybeOut;
- return;
+ mInputs = maybeIn;
+ mOutputs = maybeOut;
+ return;
}
mOutputs = new ArrayList<>();
mInputs = new ArrayList<>();
-
+
int tStartIndex = 0;
switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) {
case 0:
@@ -884,9 +888,9 @@ public class GT_NEI_DefaultHandler extends TemplateRecipeHandler {
public List<PositionedStack> getOtherStacks() {
return this.mOutputs;
}
- }
-
+ }
+
public String trans(String aKey, String aEnglish){
- return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false);
+ return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false);
}
}