aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GT_Recipe.java
diff options
context:
space:
mode:
authorTechlone <techlone.mc@gmail.com>2017-03-16 00:24:41 +0500
committerTechlone <techlone.mc@gmail.com>2017-03-16 00:24:41 +0500
commit288f44e347097c75933909d5155d47fb66d4c8f6 (patch)
tree0a3ac4a5949f4ee28603f0126a367cd4602c9c90 /src/main/java/gregtech/api/util/GT_Recipe.java
parent7e83c04210d507146248fc6f7d7cb6e7f6605824 (diff)
downloadGT5-Unofficial-288f44e347097c75933909d5155d47fb66d4c8f6.tar.gz
GT5-Unofficial-288f44e347097c75933909d5155d47fb66d4c8f6.tar.bz2
GT5-Unofficial-288f44e347097c75933909d5155d47fb66d4c8f6.zip
Added a sorting of recipes in NEI
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java')
-rw-r--r--src/main/java/gregtech/api/util/GT_Recipe.java24
1 files changed, 22 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 d509e6afe3..30874b2897 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -33,7 +33,7 @@ import static gregtech.api.enums.GT_Values.*;
* <p/>
* I know this File causes some Errors, because of missing Main Functions, but if you just need to compile Stuff, then remove said erroreous Functions.
*/
-public class GT_Recipe {
+public class GT_Recipe implements Comparable<GT_Recipe> {
public static volatile int VERSION = 509;
/**
* If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, please add a new Recipe, because of the HashMaps.
@@ -412,7 +412,27 @@ public class GT_Recipe {
return true;
}
-
+ @Override
+ public int compareTo(GT_Recipe recipe) {
+ // first lowest tier recipes
+ // then fastest
+ // then with lowest special value
+ // then dry recipes
+ // then with fewer inputs
+ if (this.mEUt != recipe.mEUt) {
+ return this.mEUt - recipe.mEUt;
+ } else if (this.mDuration != recipe.mDuration) {
+ return this.mDuration - recipe.mDuration;
+ } else if (this.mSpecialValue != recipe.mSpecialValue) {
+ return this.mSpecialValue - recipe.mSpecialValue;
+ } else if (this.mFluidInputs.length != recipe.mFluidInputs.length) {
+ return this.mFluidInputs.length - recipe.mFluidInputs.length;
+ } else if (this.mInputs.length != recipe.mInputs.length) {
+ return this.mInputs.length - recipe.mInputs.length;
+ }
+ return 0;
+ }
+
public static class GT_Recipe_AssemblyLine{
public static final ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = new ArrayList<GT_Recipe_AssemblyLine>();