Alchemy Table now supports new recipe API
This commit is contained in:
parent
562e62725c
commit
106532061d
21 changed files with 167 additions and 309 deletions
|
@ -2,8 +2,12 @@ package WayofTime.bloodmagic.compat.jei;
|
|||
|
||||
import WayofTime.bloodmagic.api.impl.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
|
||||
import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeJEI;
|
||||
import WayofTime.bloodmagic.core.registry.AlchemyTableRecipeRegistry;
|
||||
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableRecipe;
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmourHandler;
|
||||
import WayofTime.bloodmagic.util.helper.ItemHelper.LivingUpgrades;
|
||||
|
@ -11,8 +15,6 @@ import WayofTime.bloodmagic.client.gui.GuiSoulForge;
|
|||
import WayofTime.bloodmagic.compat.jei.alchemyArray.AlchemyArrayCraftingCategory;
|
||||
import WayofTime.bloodmagic.compat.jei.alchemyArray.AlchemyArrayCraftingRecipeJEI;
|
||||
import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeCategory;
|
||||
import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeHandler;
|
||||
import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeMaker;
|
||||
import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeCategory;
|
||||
import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeJEI;
|
||||
import WayofTime.bloodmagic.compat.jei.armourDowngrade.ArmourDowngradeRecipeCategory;
|
||||
|
@ -42,20 +44,22 @@ public class BloodMagicJEIPlugin implements IModPlugin {
|
|||
|
||||
registry.addRecipeHandlers(
|
||||
new BindingRecipeHandler(),
|
||||
new AlchemyTableRecipeHandler(),
|
||||
new ArmourDowngradeRecipeHandler()
|
||||
);
|
||||
|
||||
registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAltarRecipes(), Constants.Compat.JEI_CATEGORY_ALTAR);
|
||||
registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getTartaricForgeRecipes(), Constants.Compat.JEI_CATEGORY_SOULFORGE);
|
||||
registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyArrayRecipes(), Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY);
|
||||
registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyRecipes(), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
|
||||
registry.addRecipes(AlchemyTableRecipeRegistry.getRecipeList(), Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
|
||||
|
||||
registry.handleRecipes(RecipeBloodAltar.class, AltarRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALTAR);
|
||||
registry.handleRecipes(RecipeTartaricForge.class, TartaricForgeRecipeJEI::new, Constants.Compat.JEI_CATEGORY_SOULFORGE);
|
||||
registry.handleRecipes(RecipeAlchemyArray.class, AlchemyArrayCraftingRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALCHEMYARRAY);
|
||||
registry.handleRecipes(RecipeAlchemyTable.class, AlchemyTableRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
|
||||
registry.handleRecipes(AlchemyTableRecipe.class, AlchemyTableRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE);
|
||||
|
||||
registry.addRecipes(BindingRecipeMaker.getRecipes());
|
||||
registry.addRecipes(AlchemyTableRecipeMaker.getRecipes());
|
||||
registry.addRecipes(ArmourDowngradeRecipeMaker.getRecipes());
|
||||
|
||||
registry.addIngredientInfo(new ItemStack(RegistrarBloodMagicItems.ALTAR_MAKER), ItemStack.class, "jei.bloodmagic.desc.altarBuilder");
|
||||
|
|
|
@ -10,13 +10,14 @@ import mezz.jei.api.gui.IDrawable;
|
|||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class AlchemyTableRecipeCategory extends BlankRecipeCategory<AlchemyTableRecipeJEI> {
|
||||
public class AlchemyTableRecipeCategory implements IRecipeCategory<AlchemyTableRecipeJEI> {
|
||||
|
||||
private static final int OUTPUT_SLOT = 0;
|
||||
private static final int ORB_SLOT = 1;
|
||||
private static final int INPUT_SLOT = 2;
|
||||
|
@ -24,8 +25,6 @@ public class AlchemyTableRecipeCategory extends BlankRecipeCategory<AlchemyTable
|
|||
@Nonnull
|
||||
private final IDrawable background = BloodMagicJEIPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/alchemyTable.png"), 0, 0, 118, 40);
|
||||
@Nonnull
|
||||
private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.alchemyTable");
|
||||
@Nonnull
|
||||
private final ICraftingGridHelper craftingGridHelper;
|
||||
|
||||
public AlchemyTableRecipeCategory() {
|
||||
|
@ -41,7 +40,7 @@ public class AlchemyTableRecipeCategory extends BlankRecipeCategory<AlchemyTable
|
|||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return localizedName;
|
||||
return TextHelper.localize("jei.bloodmagic.recipe.alchemyTable");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -64,7 +63,7 @@ public class AlchemyTableRecipeCategory extends BlankRecipeCategory<AlchemyTable
|
|||
}
|
||||
}
|
||||
|
||||
guiItemStacks.set(ORB_SLOT, OrbRegistry.getOrbsDownToTier(recipeWrapper.getRecipe().getTierRequired()));
|
||||
guiItemStacks.set(ORB_SLOT, OrbRegistry.getOrbsDownToTier(recipeWrapper.getTier()));
|
||||
guiItemStacks.set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
|
||||
craftingGridHelper.setInputs(guiItemStacks, ingredients.getInputs(ItemStack.class), 3, 2);
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
package WayofTime.bloodmagic.compat.jei.alchemyTable;
|
||||
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class AlchemyTableRecipeHandler implements IRecipeHandler<AlchemyTableRecipeJEI> {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<AlchemyTableRecipeJEI> getRecipeClass() {
|
||||
return AlchemyTableRecipeJEI.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull AlchemyTableRecipeJEI recipe) {
|
||||
return Constants.Compat.JEI_CATEGORY_ALCHEMYTABLE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull AlchemyTableRecipeJEI recipe) {
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull AlchemyTableRecipeJEI recipe) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,42 +1,60 @@
|
|||
package WayofTime.bloodmagic.compat.jei.alchemyTable;
|
||||
|
||||
import WayofTime.bloodmagic.recipe.AlchemyTableRecipe;
|
||||
import WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyTable;
|
||||
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableRecipe;
|
||||
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import com.google.common.collect.Lists;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AlchemyTableRecipeJEI extends BlankRecipeWrapper {
|
||||
private AlchemyTableRecipe recipe;
|
||||
public class AlchemyTableRecipeJEI implements IRecipeWrapper {
|
||||
|
||||
private final List input;
|
||||
private final ItemStack output;
|
||||
private final int tier;
|
||||
private final int syphon;
|
||||
private final int ticks;
|
||||
|
||||
public AlchemyTableRecipeJEI(AlchemyTableRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
this.input = recipe.getInput();
|
||||
this.output = recipe.getRecipeOutput(Lists.newArrayList());
|
||||
this.tier = recipe.getTierRequired();
|
||||
this.syphon = recipe.getLpDrained();
|
||||
this.ticks = recipe.getTicksRequired();
|
||||
}
|
||||
|
||||
public AlchemyTableRecipeJEI(RecipeAlchemyTable recipe) {
|
||||
this.input = recipe.getInput();
|
||||
this.output = recipe.getOutput();
|
||||
this.tier = recipe.getMinimumTier();
|
||||
this.syphon = recipe.getSyphon();
|
||||
this.ticks = recipe.getTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
List<List<ItemStack>> expanded = BloodMagicJEIPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
|
||||
List<List<ItemStack>> expanded = BloodMagicJEIPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(input);
|
||||
ingredients.setInputLists(ItemStack.class, expanded);
|
||||
ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput(Lists.<ItemStack>newArrayList()));
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTooltipStrings(int mouseX, int mouseY) {
|
||||
ArrayList<String> ret = new ArrayList<String>();
|
||||
if (mouseX >= 58 && mouseX <= 78 && mouseY >= 21 && mouseY <= 34) {
|
||||
ret.add(TextHelper.localize("tooltip.bloodmagic.tier", recipe.getTierRequired()));
|
||||
ret.add(TextHelper.localize("jei.bloodmagic.recipe.lpDrained", recipe.getLpDrained()));
|
||||
ret.add(TextHelper.localize("jei.bloodmagic.recipe.ticksRequired", recipe.getTicksRequired()));
|
||||
ret.add(TextHelper.localize("tooltip.bloodmagic.tier", tier));
|
||||
ret.add(TextHelper.localize("jei.bloodmagic.recipe.lpDrained", syphon));
|
||||
ret.add(TextHelper.localize("jei.bloodmagic.recipe.ticksRequired", ticks));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public AlchemyTableRecipe getRecipe() {
|
||||
return recipe;
|
||||
public int getTier() {
|
||||
return tier;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package WayofTime.bloodmagic.compat.jei.alchemyTable;
|
||||
|
||||
import WayofTime.bloodmagic.recipe.AlchemyTableRecipe;
|
||||
import WayofTime.bloodmagic.core.registry.AlchemyTableRecipeRegistry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AlchemyTableRecipeMaker {
|
||||
@Nonnull
|
||||
public static List<AlchemyTableRecipeJEI> getRecipes() {
|
||||
List<AlchemyTableRecipe> recipeList = AlchemyTableRecipeRegistry.getRecipeList();
|
||||
ArrayList<AlchemyTableRecipeJEI> recipes = new ArrayList<AlchemyTableRecipeJEI>();
|
||||
|
||||
for (AlchemyTableRecipe recipe : recipeList)
|
||||
recipes.add(new AlchemyTableRecipeJEI(recipe));
|
||||
|
||||
return recipes;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue