aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech
diff options
context:
space:
mode:
authorElisis <gtandemmodding@gmail.com>2023-11-14 20:42:39 +1100
committerGitHub <noreply@github.com>2023-11-14 20:42:39 +1100
commitebd1748addf3c0bdd8d25c040ccaf530b390a766 (patch)
tree6b77138201dbe3f3d91fda4d7e5923c718bcd8aa /src/main/java/gregtech
parentaf3ef0e96b1522f1953e62164cf2bcd0a5291475 (diff)
downloadGT5-Unofficial-ebd1748addf3c0bdd8d25c040ccaf530b390a766.tar.gz
GT5-Unofficial-ebd1748addf3c0bdd8d25c040ccaf530b390a766.tar.bz2
GT5-Unofficial-ebd1748addf3c0bdd8d25c040ccaf530b390a766.zip
Allow a recipe's displayed NEI item outputs to be changed (#2367)
* Add GT_Recipe#getRepresentativeOutputs method * Spotless apply for branch nei-output-override for #2367 (#2368) spotlessApply Co-authored-by: GitHub GTNH Actions <> * Javadoc, move method, remove unnecessary import, Object to ItemStack * Actually fix merge * Spotless apply for branch nei-output-override for #2367 (#2369) spotlessApply Co-authored-by: GitHub GTNH Actions <> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech')
-rw-r--r--src/main/java/gregtech/api/util/GT_Recipe.java14
-rw-r--r--src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java7
2 files changed, 19 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java
index 61cd2134a3..7ae355b1e0 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -580,6 +580,20 @@ public class GT_Recipe implements Comparable<GT_Recipe> {
return GT_Utility.copyOrNull(mOutputs[aIndex]);
}
+ /***
+ * Dictates the ItemStacks displayed in the output slots of any NEI page handled by the default GT NEI handler.
+ * Override to make shown items differ from a GT_Recipe's item output array
+ *
+ * @see gregtech.nei.GT_NEI_DefaultHandler
+ * @param i Slot index
+ * @return ItemStack to be displayed in the slot
+ *
+ */
+ //
+ public ItemStack getRepresentativeOutput(int i) {
+ return getOutput(i);
+ }
+
public int getOutputChance(int aIndex) {
if (mChances == null) return 10000;
if (aIndex < 0 || aIndex >= mChances.length) return 10000;
diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
index a3ba09cb7d..f61bd7621f 100644
--- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
@@ -754,16 +754,19 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
.getItemHandler() == itemOutputsInventory) {
int i = widget.getMcSlot()
.getSlotIndex();
- if (aRecipe.mOutputs.length > i && aRecipe.mOutputs[i] != null) {
+
+ ItemStack output = aRecipe.getRepresentativeOutput(i);
+ if (output != null) {
mOutputs.add(
new FixedPositionedStack(
- aRecipe.mOutputs[i],
+ output,
GT_NEI_DefaultHandler.this.mRecipeMap.renderRealStackSizes,
widget.getPos().x + 1,
widget.getPos().y + 1,
aRecipe.getOutputChance(i),
GT_NEI_DefaultHandler.this.mRecipeMap.mNEIUnificateOutput));
}
+
} else if (widget.getMcSlot()
.getItemHandler() == specialSlotInventory) {
if (aRecipe.mSpecialItems != null) {