diff options
author | MauveCloud <mauvecloud@yahoo.com> | 2017-03-22 10:23:13 -0700 |
---|---|---|
committer | MauveCloud <mauvecloud@yahoo.com> | 2017-03-22 10:23:13 -0700 |
commit | e8c819e75fb5cc03eb798442a680b36a04f2a765 (patch) | |
tree | e1435dee357acfabf79ad937a9c90d68e817f653 /src/main/java/gregtech/api/util | |
parent | d7203bccbde715d006783615c4c05a646d58ccaa (diff) | |
parent | f4dae834dacbac9d765ad597681a53fc067da674 (diff) | |
download | GT5-Unofficial-e8c819e75fb5cc03eb798442a680b36a04f2a765.tar.gz GT5-Unofficial-e8c819e75fb5cc03eb798442a680b36a04f2a765.tar.bz2 GT5-Unofficial-e8c819e75fb5cc03eb798442a680b36a04f2a765.zip |
Merge remote-tracking branch 'refs/remotes/Blood-Asp/unstable' into unstable
Diffstat (limited to 'src/main/java/gregtech/api/util')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_Recipe.java | 24 |
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>(); |