Added a sorting of recipes in NEI
This commit is contained in:
parent
7e83c04210
commit
288f44e347
2 changed files with 32 additions and 7 deletions
|
@ -33,7 +33,7 @@ import static gregtech.api.enums.GT_Values.*;
|
||||||
* <p/>
|
* <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.
|
* 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;
|
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.
|
* 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;
|
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 class GT_Recipe_AssemblyLine{
|
||||||
public static final ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = new ArrayList<GT_Recipe_AssemblyLine>();
|
public static final ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = new ArrayList<GT_Recipe_AssemblyLine>();
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GT_NEI_DefaultHandler
|
public class GT_NEI_DefaultHandler
|
||||||
|
@ -55,6 +54,12 @@ public class GT_NEI_DefaultHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<GT_Recipe> getSortedRecipes() {
|
||||||
|
List<GT_Recipe> result = new ArrayList<>(this.mRecipeMap.mRecipeList);
|
||||||
|
Collections.sort(result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static void drawText(int aX, int aY, String aString, int aColor) {
|
public static void drawText(int aX, int aY, String aString, int aColor) {
|
||||||
Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor);
|
Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +70,7 @@ public class GT_NEI_DefaultHandler
|
||||||
|
|
||||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||||
if (outputId.equals(getOverlayIdentifier())) {
|
if (outputId.equals(getOverlayIdentifier())) {
|
||||||
for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) {
|
for (GT_Recipe tRecipe : getSortedRecipes()) {
|
||||||
if (!tRecipe.mHidden) {
|
if (!tRecipe.mHidden) {
|
||||||
this.arecipes.add(new CachedDefaultRecipe(tRecipe));
|
this.arecipes.add(new CachedDefaultRecipe(tRecipe));
|
||||||
}
|
}
|
||||||
|
@ -95,7 +100,7 @@ public class GT_NEI_DefaultHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) {
|
for (GT_Recipe tRecipe : getSortedRecipes()) {
|
||||||
if (!tRecipe.mHidden) {
|
if (!tRecipe.mHidden) {
|
||||||
CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
|
CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
|
||||||
for (ItemStack tStack : tResults) {
|
for (ItemStack tStack : tResults) {
|
||||||
|
@ -129,7 +134,7 @@ public class GT_NEI_DefaultHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) {
|
for (GT_Recipe tRecipe : getSortedRecipes()) {
|
||||||
if (!tRecipe.mHidden) {
|
if (!tRecipe.mHidden) {
|
||||||
CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
|
CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
|
||||||
for (ItemStack tStack : tInputs) {
|
for (ItemStack tStack : tInputs) {
|
||||||
|
|
Loading…
Reference in a new issue