Fix Alchemy Table JEI compat being fundamentally wrong (#1069)

(cherry picked from commit fedea85)
This commit is contained in:
Nicholas Ignoffo 2017-02-27 16:44:40 -08:00
parent 8360041da2
commit 4e7f0d12f9
2 changed files with 10 additions and 28 deletions

View file

@ -1,23 +1,21 @@
package WayofTime.bloodmagic.compat.jei.alchemyTable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import WayofTime.bloodmagic.api.registry.OrbRegistry;
import mezz.jei.api.gui.ICraftingGridHelper;
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.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import WayofTime.bloodmagic.util.helper.TextHelper;
public class AlchemyTableRecipeCategory implements IRecipeCategory
public class AlchemyTableRecipeCategory extends BlankRecipeCategory<AlchemyTableRecipeJEI>
{
private static final int OUTPUT_SLOT = 0;
private static final int ORB_SLOT = 1;
@ -57,21 +55,7 @@ public class AlchemyTableRecipeCategory implements IRecipeCategory
}
@Override
public void drawExtras(Minecraft minecraft)
{
}
@Nullable
@Override
public IDrawable getIcon()
{
return null;
}
@SuppressWarnings("unchecked")
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
public void setRecipe(IRecipeLayout recipeLayout, AlchemyTableRecipeJEI recipeWrapper, IIngredients ingredients)
{
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
@ -87,12 +71,8 @@ public class AlchemyTableRecipeCategory implements IRecipeCategory
}
}
if (recipeWrapper instanceof AlchemyTableRecipeJEI)
{
AlchemyTableRecipeJEI recipe = (AlchemyTableRecipeJEI) recipeWrapper;
guiItemStacks.set(ORB_SLOT, ingredients.getInputs(ItemStack.class).get(1));
craftingGridHelper.setOutput(guiItemStacks, ingredients.getOutputs(ItemStack.class).get(0));
craftingGridHelper.setInputs(guiItemStacks, ingredients.getInputs(ItemStack.class), 3, 2);
}
guiItemStacks.set(ORB_SLOT, OrbRegistry.getOrbsDownToTier(recipeWrapper.getRecipe().getTierRequired()));
guiItemStacks.set(OUTPUT_SLOT, ingredients.getOutputs(ItemStack.class).get(0));
craftingGridHelper.setInputs(guiItemStacks, ingredients.getInputs(ItemStack.class), 3, 2);
}
}

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.compat.jei.BloodMagicPlugin;
import com.google.common.collect.Lists;
import lombok.Getter;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
@ -25,7 +26,7 @@ public class AlchemyTableRecipeJEI extends BlankRecipeWrapper
public void getIngredients(IIngredients ingredients) {
List<List<ItemStack>> expanded = BloodMagicPlugin.jeiHelper.getStackHelper().expandRecipeItemStackInputs(recipe.getInput());
ingredients.setInputLists(ItemStack.class, expanded);
ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput(new ArrayList<ItemStack>()));
ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput(Lists.<ItemStack>newArrayList()));
}
@Override
@ -34,6 +35,7 @@ public class AlchemyTableRecipeJEI extends BlankRecipeWrapper
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()));
}