Update JEI compat for Forge and Altar

This commit is contained in:
Nicholas Ignoffo 2018-02-07 21:45:40 -08:00
parent 2d3f86aaf8
commit 9f6a4983a6
16 changed files with 80 additions and 217 deletions

View file

@ -1,5 +1,8 @@
package WayofTime.bloodmagic.compat.jei;
import WayofTime.bloodmagic.api.impl.BloodMagicAPI;
import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
import WayofTime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import WayofTime.bloodmagic.apibutnotreally.livingArmour.LivingArmourHandler;
import WayofTime.bloodmagic.apibutnotreally.util.helper.ItemHelper.LivingUpgrades;
@ -9,10 +12,10 @@ import WayofTime.bloodmagic.compat.jei.alchemyArray.AlchemyArrayCraftingRecipeHa
import WayofTime.bloodmagic.compat.jei.alchemyArray.AlchemyArrayCraftingRecipeMaker;
import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeCategory;
import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeHandler;
import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeJEI;
import WayofTime.bloodmagic.compat.jei.alchemyTable.AlchemyTableRecipeMaker;
import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeCategory;
import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeHandler;
import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeMaker;
import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeJEI;
import WayofTime.bloodmagic.compat.jei.armourDowngrade.ArmourDowngradeRecipeCategory;
import WayofTime.bloodmagic.compat.jei.armourDowngrade.ArmourDowngradeRecipeHandler;
import WayofTime.bloodmagic.compat.jei.armourDowngrade.ArmourDowngradeRecipeMaker;
@ -20,8 +23,7 @@ import WayofTime.bloodmagic.compat.jei.binding.BindingRecipeCategory;
import WayofTime.bloodmagic.compat.jei.binding.BindingRecipeHandler;
import WayofTime.bloodmagic.compat.jei.binding.BindingRecipeMaker;
import WayofTime.bloodmagic.compat.jei.forge.TartaricForgeRecipeCategory;
import WayofTime.bloodmagic.compat.jei.forge.TartaricForgeRecipeHandler;
import WayofTime.bloodmagic.compat.jei.forge.TartaricForgeRecipeMaker;
import WayofTime.bloodmagic.compat.jei.forge.TartaricForgeRecipeJEI;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import mezz.jei.api.*;
@ -32,7 +34,7 @@ import javax.annotation.Nonnull;
import java.util.Map;
@JEIPlugin
public class BloodMagicPlugin extends BlankModPlugin {
public class BloodMagicJEIPlugin extends BlankModPlugin {
public static IJeiHelpers jeiHelper;
@Override
@ -40,18 +42,20 @@ public class BloodMagicPlugin extends BlankModPlugin {
jeiHelper = registry.getJeiHelpers();
registry.addRecipeHandlers(
new AltarRecipeHandler(),
new BindingRecipeHandler(),
new AlchemyArrayCraftingRecipeHandler(),
new TartaricForgeRecipeHandler(),
new AlchemyTableRecipeHandler(),
new ArmourDowngradeRecipeHandler()
);
registry.addRecipes(AltarRecipeMaker.getRecipes());
registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAltarRecipes(), Constants.Compat.JEI_CATEGORY_ALTAR);
registry.addRecipes(BloodMagicAPI.INSTANCE.getRecipeRegistrar().getTartaricForgeRecipes(), Constants.Compat.JEI_CATEGORY_SOULFORGE);
registry.handleRecipes(RecipeBloodAltar.class, AltarRecipeJEI::new, Constants.Compat.JEI_CATEGORY_ALTAR);
registry.handleRecipes(RecipeTartaricForge.class, TartaricForgeRecipeJEI::new, Constants.Compat.JEI_CATEGORY_SOULFORGE);
registry.addRecipes(BindingRecipeMaker.getRecipes());
registry.addRecipes(AlchemyArrayCraftingRecipeMaker.getRecipes());
registry.addRecipes(TartaricForgeRecipeMaker.getRecipes());
registry.addRecipes(AlchemyTableRecipeMaker.getRecipes());
registry.addRecipes(ArmourDowngradeRecipeMaker.getRecipes());

View file

@ -2,7 +2,7 @@ package WayofTime.bloodmagic.compat.jei.alchemyArray;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
import WayofTime.bloodmagic.util.helper.TextHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout;
@ -22,7 +22,7 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory {
private static final int OUTPUT_SLOT = 2;
@Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/binding.png"), 0, 0, 100, 30);
private final IDrawable background = BloodMagicJEIPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/binding.png"), 0, 0, 100, 30);
@Nonnull
private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.alchemyArrayCrafting");

View file

@ -3,7 +3,7 @@ package WayofTime.bloodmagic.compat.jei.alchemyTable;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import WayofTime.bloodmagic.apibutnotreally.registry.OrbRegistry;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
import WayofTime.bloodmagic.util.helper.TextHelper;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable;
@ -22,14 +22,14 @@ public class AlchemyTableRecipeCategory extends BlankRecipeCategory<AlchemyTable
private static final int INPUT_SLOT = 2;
@Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/alchemyTable.png"), 0, 0, 118, 40);
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() {
craftingGridHelper = BloodMagicPlugin.jeiHelper.getGuiHelper().createCraftingGridHelper(INPUT_SLOT, OUTPUT_SLOT);
craftingGridHelper = BloodMagicJEIPlugin.jeiHelper.getGuiHelper().createCraftingGridHelper(INPUT_SLOT, OUTPUT_SLOT);
}
@Nonnull

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.compat.jei.alchemyTable;
import WayofTime.bloodmagic.apibutnotreally.recipe.AlchemyTableRecipe;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.Lists;
import mezz.jei.api.ingredients.IIngredients;
@ -20,7 +20,7 @@ public class AlchemyTableRecipeJEI extends BlankRecipeWrapper {
@Override
public void getIngredients(IIngredients ingredients) {
List<List<ItemStack>> expanded = BloodMagicPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
List<List<ItemStack>> expanded = BloodMagicJEIPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
ingredients.setInputLists(ItemStack.class, expanded);
ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput(Lists.<ItemStack>newArrayList()));
}

View file

@ -2,13 +2,12 @@ package WayofTime.bloodmagic.compat.jei.altar;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
import WayofTime.bloodmagic.util.helper.TextHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@ -16,14 +15,12 @@ import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class AltarRecipeCategory implements IRecipeCategory {
public class AltarRecipeCategory implements IRecipeCategory<AltarRecipeJEI> {
private static final int INPUT_SLOT = 0;
private static final int OUTPUT_SLOT = 1;
@Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/altar.png"), 3, 4, 155, 65);
@Nonnull
private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.altar");
private final IDrawable background = BloodMagicJEIPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/altar.png"), 3, 4, 155, 65);
@Nonnull
@Override
@ -34,7 +31,7 @@ public class AltarRecipeCategory implements IRecipeCategory {
@Nonnull
@Override
public String getTitle() {
return localizedName;
return TextHelper.localize("jei.bloodmagic.recipe.altar");
}
@Nonnull
@ -55,16 +52,15 @@ public class AltarRecipeCategory implements IRecipeCategory {
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull AltarRecipeJEI recipeWrapper, @Nonnull IIngredients ingredients) {
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 31, 0);
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 125, 30);
if (recipeWrapper instanceof AltarRecipeJEI) {
recipeLayout.getItemStacks().set(INPUT_SLOT, ingredients.getInputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
}
recipeLayout.getItemStacks().set(INPUT_SLOT, ingredients.getInputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
}
@Nonnull
@Override
public String getModName() {
return BloodMagic.NAME;

View file

@ -1,31 +0,0 @@
package WayofTime.bloodmagic.compat.jei.altar;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import javax.annotation.Nonnull;
public class AltarRecipeHandler implements IRecipeHandler<AltarRecipeJEI> {
@Nonnull
@Override
public Class<AltarRecipeJEI> getRecipeClass() {
return AltarRecipeJEI.class;
}
@Override
public String getRecipeCategoryUid(@Nonnull AltarRecipeJEI recipe) {
return Constants.Compat.JEI_CATEGORY_ALTAR;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull AltarRecipeJEI recipe) {
return recipe;
}
@Override
public boolean isRecipeValid(@Nonnull AltarRecipeJEI recipe) {
return true;
}
}

View file

@ -1,16 +1,17 @@
package WayofTime.bloodmagic.compat.jei.altar;
import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
import WayofTime.bloodmagic.util.helper.NumeralHelper;
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.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import javax.annotation.Nonnull;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
public class AltarRecipeJEI implements IRecipeWrapper {
@ -23,13 +24,13 @@ public class AltarRecipeJEI implements IRecipeWrapper {
private final int consumptionRate;
private final int drainRate;
public AltarRecipeJEI(@Nonnull List<ItemStack> input, @Nonnull ItemStack output, int tier, int requiredLP, int consumptionRate, int drainRate) {
this.input = input;
this.output = output;
public AltarRecipeJEI(RecipeBloodAltar recipe) {
this.input = NonNullList.from(ItemStack.EMPTY, recipe.getInput().getMatchingStacks());
this.output = recipe.getOutput();
this.infoString = new String[]{TextHelper.localize("jei.bloodmagic.recipe.requiredTier", NumeralHelper.toRoman(tier)), TextHelper.localize("jei.bloodmagic.recipe.requiredLP", requiredLP)};
this.consumptionRate = consumptionRate;
this.drainRate = drainRate;
this.infoString = new String[]{TextHelper.localize("jei.bloodmagic.recipe.requiredTier", NumeralHelper.toRoman(recipe.getMinimumTier().toInt())), TextHelper.localize("jei.bloodmagic.recipe.requiredLP", recipe.getSyphon())};
this.consumptionRate = recipe.getConsumeRate();
this.drainRate = recipe.getDrainRate();
}
@Override
@ -41,12 +42,12 @@ public class AltarRecipeJEI implements IRecipeWrapper {
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
ArrayList<String> ret = new ArrayList<String>();
List<String> tooltip = Lists.newArrayList();
if (mouseX >= 13 && mouseX <= 64 && mouseY >= 27 && mouseY <= 58) {
ret.add(TextHelper.localize("jei.bloodmagic.recipe.consumptionRate", consumptionRate));
ret.add(TextHelper.localize("jei.bloodmagic.recipe.drainRate", drainRate));
tooltip.add(TextHelper.localize("jei.bloodmagic.recipe.consumptionRate", consumptionRate));
tooltip.add(TextHelper.localize("jei.bloodmagic.recipe.drainRate", drainRate));
}
return ret;
return tooltip;
}
@Override

View file

@ -1,45 +0,0 @@
package WayofTime.bloodmagic.compat.jei.altar;
import WayofTime.bloodmagic.apibutnotreally.ItemStackWrapper;
import WayofTime.bloodmagic.apibutnotreally.orb.IBloodOrb;
import WayofTime.bloodmagic.apibutnotreally.registry.AltarRecipeRegistry;
import WayofTime.bloodmagic.block.BlockLifeEssence;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class AltarRecipeMaker {
@Nonnull
public static List<AltarRecipeJEI> getRecipes() {
Map<List<ItemStackWrapper>, AltarRecipeRegistry.AltarRecipe> altarMap = AltarRecipeRegistry.getRecipes();
ArrayList<AltarRecipeJEI> recipes = new ArrayList<AltarRecipeJEI>();
for (Map.Entry<List<ItemStackWrapper>, AltarRecipeRegistry.AltarRecipe> itemStackAltarRecipeEntry : altarMap.entrySet()) {
// Make sure input is not a Blood Orb. If it is, the recipe is for a filling orb, and we don't want that.
if (!(itemStackAltarRecipeEntry.getKey().get(0).toStack().getItem() instanceof IBloodOrb)) {
List<ItemStack> input = ItemStackWrapper.toStackList(itemStackAltarRecipeEntry.getValue().getInput());
ItemStack output = itemStackAltarRecipeEntry.getValue().getOutput();
int requiredTier = itemStackAltarRecipeEntry.getValue().getMinTier().toInt();
int requiredLP = itemStackAltarRecipeEntry.getValue().getSyphon();
int consumptionRate = itemStackAltarRecipeEntry.getValue().getConsumeRate();
int drainRate = itemStackAltarRecipeEntry.getValue().getDrainRate();
if (output.getItem() == ForgeModContainer.getInstance().universalBucket && requiredLP == 1000)
output = FluidUtil.getFilledBucket(new FluidStack(BlockLifeEssence.getLifeEssence(), Fluid.BUCKET_VOLUME));
AltarRecipeJEI recipe = new AltarRecipeJEI(input, output, requiredTier, requiredLP, consumptionRate, drainRate);
recipes.add(recipe);
}
}
return recipes;
}
}

View file

@ -2,7 +2,7 @@ package WayofTime.bloodmagic.compat.jei.armourDowngrade;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
import WayofTime.bloodmagic.util.helper.TextHelper;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable;
@ -24,14 +24,14 @@ public class ArmourDowngradeRecipeCategory implements IRecipeCategory {
private static final int INPUT_SLOT = 2;
@Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/alchemyTable.png"), 0, 0, 118, 40);
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.armourDowngrade");
@Nonnull
private final ICraftingGridHelper craftingGridHelper;
public ArmourDowngradeRecipeCategory() {
craftingGridHelper = BloodMagicPlugin.jeiHelper.getGuiHelper().createCraftingGridHelper(INPUT_SLOT, OUTPUT_SLOT);
craftingGridHelper = BloodMagicJEIPlugin.jeiHelper.getGuiHelper().createCraftingGridHelper(INPUT_SLOT, OUTPUT_SLOT);
}
@Nonnull

View file

@ -2,7 +2,7 @@ package WayofTime.bloodmagic.compat.jei.armourDowngrade;
import WayofTime.bloodmagic.apibutnotreally.recipe.LivingArmourDowngradeRecipe;
import WayofTime.bloodmagic.apibutnotreally.util.helper.ItemHelper.LivingUpgrades;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import com.google.common.collect.Lists;
import mezz.jei.api.ingredients.IIngredients;
@ -20,7 +20,7 @@ public class ArmourDowngradeRecipeJEI extends BlankRecipeWrapper {
@Override
public void getIngredients(IIngredients ingredients) {
List<List<ItemStack>> expanded = BloodMagicPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
List<List<ItemStack>> expanded = BloodMagicJEIPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
expanded.add(Lists.newArrayList(recipe.getKey()));
ingredients.setInputLists(ItemStack.class, expanded);
ItemStack upgradeStack = new ItemStack(RegistrarBloodMagicItems.UPGRADE_TOME);

View file

@ -2,7 +2,7 @@ package WayofTime.bloodmagic.compat.jei.binding;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
import WayofTime.bloodmagic.util.helper.TextHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout;
@ -22,7 +22,7 @@ public class BindingRecipeCategory implements IRecipeCategory {
private static final int OUTPUT_SLOT = 2;
@Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/binding.png"), 0, 0, 100, 30);
private final IDrawable background = BloodMagicJEIPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/binding.png"), 0, 0, 100, 30);
@Nonnull
private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.binding");

View file

@ -2,7 +2,7 @@ package WayofTime.bloodmagic.compat.jei.forge;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
import WayofTime.bloodmagic.util.helper.TextHelper;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.gui.IDrawable;
@ -10,7 +10,6 @@ import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@ -19,20 +18,18 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class TartaricForgeRecipeCategory implements IRecipeCategory {
public class TartaricForgeRecipeCategory implements IRecipeCategory<TartaricForgeRecipeJEI> {
private static final int OUTPUT_SLOT = 0;
private static final int GEM_SLOT = 1;
private static final int INPUT_SLOT = 2;
@Nonnull
private final IDrawable background = BloodMagicPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/soulForge.png"), 0, 0, 100, 40);
@Nonnull
private final String localizedName = TextHelper.localize("jei.bloodmagic.recipe.soulForge");
private final IDrawable background = BloodMagicJEIPlugin.jeiHelper.getGuiHelper().createDrawable(new ResourceLocation(Constants.Mod.DOMAIN + "gui/jei/soulForge.png"), 0, 0, 100, 40);
@Nonnull
private final ICraftingGridHelper craftingGridHelper;
public TartaricForgeRecipeCategory() {
craftingGridHelper = BloodMagicPlugin.jeiHelper.getGuiHelper().createCraftingGridHelper(INPUT_SLOT, OUTPUT_SLOT);
craftingGridHelper = BloodMagicJEIPlugin.jeiHelper.getGuiHelper().createCraftingGridHelper(INPUT_SLOT, OUTPUT_SLOT);
}
@Nonnull
@ -44,7 +41,7 @@ public class TartaricForgeRecipeCategory implements IRecipeCategory {
@Nonnull
@Override
public String getTitle() {
return localizedName;
return TextHelper.localize("jei.bloodmagic.recipe.soulForge");
}
@Nonnull
@ -65,7 +62,7 @@ public class TartaricForgeRecipeCategory implements IRecipeCategory {
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull TartaricForgeRecipeJEI recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(OUTPUT_SLOT, false, 73, 13);
@ -79,18 +76,15 @@ public class TartaricForgeRecipeCategory implements IRecipeCategory {
}
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
List<List<ItemStack>> outputs = ingredients.getOutputs(ItemStack.class);
if (recipeWrapper instanceof TartaricForgeRecipeJEI) {
TartaricForgeRecipeJEI recipe = (TartaricForgeRecipeJEI) recipeWrapper;
guiItemStacks.set(GEM_SLOT, ingredients.getInputs(ItemStack.class).get(ingredients.getInputs(ItemStack.class).size() - 1));
inputs.remove(ingredients.getInputs(ItemStack.class).size() - 1);
guiItemStacks.set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
guiItemStacks.set(INPUT_SLOT, ingredients.getInputs(ItemStack.class).get(0));
craftingGridHelper.setInputs(guiItemStacks, inputs);
}
guiItemStacks.set(GEM_SLOT, ingredients.getInputs(ItemStack.class).get(ingredients.getInputs(ItemStack.class).size() - 1));
inputs.remove(ingredients.getInputs(ItemStack.class).size() - 1);
guiItemStacks.set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
guiItemStacks.set(INPUT_SLOT, ingredients.getInputs(ItemStack.class).get(0));
craftingGridHelper.setInputs(guiItemStacks, inputs);
}
@Nonnull
@Override
public String getModName() {
return BloodMagic.NAME;

View file

@ -1,31 +0,0 @@
package WayofTime.bloodmagic.compat.jei.forge;
import WayofTime.bloodmagic.apibutnotreally.Constants;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import javax.annotation.Nonnull;
public class TartaricForgeRecipeHandler implements IRecipeHandler<TartaricForgeRecipeJEI> {
@Nonnull
@Override
public Class<TartaricForgeRecipeJEI> getRecipeClass() {
return TartaricForgeRecipeJEI.class;
}
@Override
public String getRecipeCategoryUid(@Nonnull TartaricForgeRecipeJEI recipe) {
return Constants.Compat.JEI_CATEGORY_SOULFORGE;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull TartaricForgeRecipeJEI recipe) {
return recipe;
}
@Override
public boolean isRecipeValid(@Nonnull TartaricForgeRecipeJEI recipe) {
return true;
}
}

View file

@ -1,22 +1,22 @@
package WayofTime.bloodmagic.compat.jei.forge;
import WayofTime.bloodmagic.apibutnotreally.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.api.impl.recipe.RecipeTartaricForge;
import WayofTime.bloodmagic.compat.jei.BloodMagicJEIPlugin;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
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 javax.annotation.Nullable;
import java.util.ArrayList;
import javax.annotation.Nonnull;
import java.util.List;
public class TartaricForgeRecipeJEI extends BlankRecipeWrapper {
private TartaricForgeRecipe recipe;
private List<ItemStack> validGems = new ArrayList<ItemStack>();
public class TartaricForgeRecipeJEI implements IRecipeWrapper {
private RecipeTartaricForge recipe;
private List<ItemStack> validGems = Lists.newArrayList();
public TartaricForgeRecipeJEI(TartaricForgeRecipe recipe) {
public TartaricForgeRecipeJEI(RecipeTartaricForge recipe) {
this.recipe = recipe;
for (DefaultWill will : DefaultWill.values())
@ -25,33 +25,28 @@ public class TartaricForgeRecipeJEI extends BlankRecipeWrapper {
}
@Override
public void getIngredients(IIngredients ingredients) {
List<List<ItemStack>> expandedInputs = BloodMagicPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
public void getIngredients(@Nonnull IIngredients ingredients) {
List<List<ItemStack>> expandedInputs = BloodMagicJEIPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
expandedInputs.add(validGems);
ingredients.setInputLists(ItemStack.class, expandedInputs);
ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput());
ingredients.setOutput(ItemStack.class, recipe.getOutput());
}
@Nullable
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
ArrayList<String> ret = new ArrayList<String>();
List<String> tooltip = Lists.newArrayList();
if (mouseX >= 40 && mouseX <= 60 && mouseY >= 21 && mouseY <= 34) {
ret.add(TextHelper.localize("jei.bloodmagic.recipe.minimumSouls", recipe.getMinimumSouls()));
ret.add(TextHelper.localize("jei.bloodmagic.recipe.soulsDrained", recipe.getSoulsDrained()));
return ret;
tooltip.add(TextHelper.localize("jei.bloodmagic.recipe.minimumSouls", recipe.getMinimumSouls()));
tooltip.add(TextHelper.localize("jei.bloodmagic.recipe.soulsDrained", recipe.getSoulDrain()));
}
return null;
return tooltip;
}
public TartaricForgeRecipe getRecipe() {
public RecipeTartaricForge getRecipe() {
return recipe;
}
public List<ItemStack> getValidGems() {
return validGems;
}
public enum DefaultWill {
SOUL(new ItemStack(RegistrarBloodMagicItems.MONSTER_SOUL, 1, 0), 64),
PETTY(new ItemStack(RegistrarBloodMagicItems.SOUL_GEM, 1, 0), 64),

View file

@ -1,21 +0,0 @@
package WayofTime.bloodmagic.compat.jei.forge;
import WayofTime.bloodmagic.apibutnotreally.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.apibutnotreally.registry.TartaricForgeRecipeRegistry;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class TartaricForgeRecipeMaker {
@Nonnull
public static List<TartaricForgeRecipeJEI> getRecipes() {
List<TartaricForgeRecipe> recipeList = TartaricForgeRecipeRegistry.getRecipeList();
ArrayList<TartaricForgeRecipeJEI> recipes = new ArrayList<TartaricForgeRecipeJEI>();
for (TartaricForgeRecipe recipe : recipeList)
recipes.add(new TartaricForgeRecipeJEI(recipe));
return recipes;
}
}

View file

@ -9,7 +9,8 @@ import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.api.WailaPlugin;
@WailaPlugin
public class WailaPluginBloodMagic implements IWailaPlugin {
public class BloodMagicHwylaPlugin implements IWailaPlugin {
@Override
public void register(IWailaRegistrar registrar) {
registrar.registerBodyProvider(new DataProviderBloodAltar(), BlockAltar.class);