aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
authorMaxim <maxim235@gmx.de>2023-02-16 10:14:49 +0100
committerGitHub <noreply@github.com>2023-02-16 10:14:49 +0100
commit3b834d6cebae287cd9bbeddd4f157338da6e1ea5 (patch)
tree84b429a27e1adf0674569160e40e4c916a1d93c3 /src/main/java/gregtech/api
parente1ba22d7de9388dffb0ea7d99add79b95f94aa6a (diff)
downloadGT5-Unofficial-3b834d6cebae287cd9bbeddd4f157338da6e1ea5.tar.gz
GT5-Unofficial-3b834d6cebae287cd9bbeddd4f157338da6e1ea5.tar.bz2
GT5-Unofficial-3b834d6cebae287cd9bbeddd4f157338da6e1ea5.zip
Fusion NEI support (#1742)
* Added optional special value to Power and getter for power into IMTE * Added FusionPower to properly display available fusion recipes and OC * spotlessApply (#1743) Co-authored-by: GitHub GTNH Actions <> * Moved compare flag to recipe map * Missed a new constructor * Added user request * Addressed reviews * Typo * Update src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java Co-authored-by: miozune <miozune@gmail.com> * Removed wrong bracket from git online commit --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: miozune <miozune@gmail.com>
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java8
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java3
-rw-r--r--src/main/java/gregtech/api/util/GT_Recipe.java14
3 files changed, 23 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java
index 66c85be547..849b82565e 100644
--- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java
+++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java
@@ -33,6 +33,7 @@ import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_Util;
+import gregtech.common.power.Power;
/**
* Warning, this Interface has just been made to be able to add multiple kinds of MetaTileEntities (Cables, Pipes,
@@ -354,6 +355,13 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand
String getSpecialVoltageToolTip();
/**
+ * @return Power object used for displaying in NEI
+ */
+ default Power getPower() {
+ return null;
+ }
+
+ /**
* Icon of the Texture. If this returns null then it falls back to getTextureIndex.
*
* @param aSide is the Side of the Block
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
index 501e78ccec..62d6868286 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
@@ -751,7 +751,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
/**
* Calcualtes overclocked ness using long integers
- *
+ *
* @param aEUt - recipe EUt
* @param aDuration - recipe Duration
*/
@@ -1238,6 +1238,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
}
}
+ @Override
public Power getPower() {
return mPower;
}
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java
index 524976adc9..824d97a382 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -1636,7 +1636,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> {
" EU",
true,
true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT)
- .setUsualFluidInputCount(2).setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE);
+ .useComparatorForNEI(true).setUsualFluidInputCount(2)
+ .setNEISpecialInfoFormatter(FusionSpecialValueFormatter.INSTANCE);
public static final GT_Recipe_Map sComplexFusionRecipes = new GT_Recipe_Map_ComplexFusion(
new HashSet<>(50),
"gt.recipe.complexfusionreactor",
@@ -2617,6 +2618,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> {
private INEISpecialInfoFormatter neiSpecialInfoFormatter;
/**
+ * Flag if a comparator should be used to search the recipe in NEI (which is defined in {@link Power}). Else
+ * only the voltage will be used to find recipes
+ */
+ public boolean useComparatorForNEI;
+
+ /**
* Initialises a new type of Recipe Handler.
*
* @param aRecipeList a List you specify as Recipe List. Usually just an ArrayList with a
@@ -2700,6 +2707,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> {
return this;
}
+ public GT_Recipe_Map useComparatorForNEI(boolean use) {
+ this.useComparatorForNEI = use;
+ return this;
+ }
+
public GT_Recipe_Map useModularUI(boolean use) {
this.useModularUI = use;
return this;