Retain order of provided wills in JEI + only display valid will containers

This commit is contained in:
Nick 2016-01-16 12:48:07 -08:00
parent 815faa2ced
commit c5b48ab59f
2 changed files with 23 additions and 7 deletions

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.compat.jei.forge; package WayofTime.bloodmagic.compat.jei.forge;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -90,7 +91,7 @@ public class TartaricForgeRecipeCategory implements IRecipeCategory
if (recipeWrapper instanceof TartaricForgeRecipeJEI) if (recipeWrapper instanceof TartaricForgeRecipeJEI)
{ {
TartaricForgeRecipeJEI recipe = (TartaricForgeRecipeJEI) recipeWrapper; TartaricForgeRecipeJEI recipe = (TartaricForgeRecipeJEI) recipeWrapper;
guiItemStacks.set(GEM_SLOT, (Set<ItemStack>) recipe.getInputs().get(1)); guiItemStacks.set(GEM_SLOT, (ArrayList<ItemStack>) recipe.getInputs().get(1));
craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs()); craftingGridHelper.setOutput(guiItemStacks, recipe.getOutputs());
craftingGridHelper.setInput(guiItemStacks, (List) recipe.getInputs().get(0), 2, 3); craftingGridHelper.setInput(guiItemStacks, (List) recipe.getInputs().get(0), 2, 3);
} }

View file

@ -18,17 +18,15 @@ public class TartaricForgeRecipeJEI extends BlankRecipeWrapper
@Getter @Getter
private TartaricForgeRecipe recipe; private TartaricForgeRecipe recipe;
@Getter @Getter
private Set<ItemStack> validGems = new HashSet<ItemStack>(); private ArrayList<ItemStack> validGems = new ArrayList<ItemStack>();
public TartaricForgeRecipeJEI(TartaricForgeRecipe recipe) public TartaricForgeRecipeJEI(TartaricForgeRecipe recipe)
{ {
this.recipe = recipe; this.recipe = recipe;
this.validGems.add(new ItemStack(ModItems.soulGem, 1, 0)); for (DefaultWill will : DefaultWill.values())
this.validGems.add(new ItemStack(ModItems.soulGem, 1, 1)); if (will.minSouls >= recipe.getMinimumSouls())
this.validGems.add(new ItemStack(ModItems.soulGem, 1, 2)); this.validGems.add(will.willStack);
this.validGems.add(new ItemStack(ModItems.soulGem, 1, 3));
this.validGems.add(new ItemStack(ModItems.monsterSoul));
} }
@Override @Override
@ -61,4 +59,21 @@ public class TartaricForgeRecipeJEI extends BlankRecipeWrapper
} }
return null; return null;
} }
public enum DefaultWill {
SOUL(new ItemStack(ModItems.monsterSoul, 1, 0), 64),
PETTY(new ItemStack(ModItems.soulGem, 1, 0), 64),
LESSER(new ItemStack(ModItems.soulGem, 1, 1), 256),
COMMON(new ItemStack(ModItems.soulGem, 1, 2), 1024),
GREATER(new ItemStack(ModItems.soulGem, 1, 3), 4096),
GRAND(new ItemStack(ModItems.soulGem, 1, 4), 16384);
public final ItemStack willStack;
public final double minSouls;
DefaultWill(ItemStack willStack, double minSouls) {
this.willStack = willStack;
this.minSouls = minSouls;
}
}
} }