Update JEI compat

This commit is contained in:
Nick 2015-12-02 00:55:52 -08:00
parent 7dd170e5ad
commit f35cef51bb
6 changed files with 38 additions and 12 deletions

View file

@ -40,7 +40,7 @@ repositories {
}
dependencies {
deobfCompile "mezz.jei:jei_1.8.8:2.0.5.6"
deobfCompile "mezz.jei:jei_1.8.8:2.1.0.7"
}
minecraft {

View file

@ -60,4 +60,8 @@ public class Constants {
public static final String VERSION = "@VERSION@";
public static final String DEPEND = "";
}
public static class Compat {
public static final String JEI_CATEGORY_ALTAR = Mod.MODID + ":altar";
}
}

View file

@ -6,7 +6,9 @@ import WayofTime.bloodmagic.compat.jei.altar.AltarRecipeMaker;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeTransferHelper;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -19,6 +21,7 @@ public class BloodMagicPlugin implements IModPlugin {
}
@Override
@Nonnull
public Iterable<? extends IRecipeCategory> getRecipeCategories() {
return Arrays.asList(
new AltarRecipeCategory()
@ -26,13 +29,22 @@ public class BloodMagicPlugin implements IModPlugin {
}
@Override
@Nonnull
public Iterable<? extends IRecipeHandler> getRecipeHandlers() {
return Arrays.asList(
new AltarRecipeHandler()
);
}
@Nonnull
public Iterable<? extends IRecipeTransferHelper> getRecipeTransferHelpers() {
return Arrays.asList(
);
}
@Override
@Nonnull
public Iterable<Object> getRecipes() {
List<Object> recipes = new ArrayList<Object>();

View file

@ -4,8 +4,7 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.util.helper.TextHelper;
import mezz.jei.api.JEIManager;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiFluidTanks;
import mezz.jei.api.gui.IGuiItemStacks;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.ResourceLocation;
@ -22,6 +21,12 @@ public class AltarRecipeCategory implements IRecipeCategory {
@Nonnull
private final String localizedName = TextHelper.localize("jei.BloodMagic.recipe.altar");
@Nonnull
@Override
public String getUid() {
return Constants.Compat.JEI_CATEGORY_ALTAR;
}
@Nonnull
@Override
public String getTitle() {
@ -35,18 +40,18 @@ public class AltarRecipeCategory implements IRecipeCategory {
}
@Override
public void init(@Nonnull IGuiItemStacks guiItemStacks, @Nonnull IGuiFluidTanks guiFluidTanks) {
guiItemStacks.init(INPUT_SLOT, 31, 0);
guiItemStacks.init(OUTPUT_SLOT, 125, 30);
public void init(@Nonnull IRecipeLayout recipeLayout) {
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 31, 0);
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 125, 30);
}
@Override
@SuppressWarnings("unchecked")
public void setRecipe(@Nonnull IGuiItemStacks guiItemStacks, @Nonnull IGuiFluidTanks guiFluidTanks, @Nonnull IRecipeWrapper recipeWrapper) {
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (recipeWrapper instanceof AltarRecipeJEI) {
AltarRecipeJEI altarRecipeWrapper = (AltarRecipeJEI) recipeWrapper;
guiItemStacks.set(INPUT_SLOT, altarRecipeWrapper.getInputs());
guiItemStacks.set(OUTPUT_SLOT, altarRecipeWrapper.getOutputs());
recipeLayout.getItemStacks().set(INPUT_SLOT, altarRecipeWrapper.getInputs());
recipeLayout.getItemStacks().set(OUTPUT_SLOT, altarRecipeWrapper.getOutputs());
}
}
}

View file

@ -1,6 +1,6 @@
package WayofTime.bloodmagic.compat.jei.altar;
import mezz.jei.api.recipe.IRecipeCategory;
import WayofTime.bloodmagic.api.Constants;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
@ -16,8 +16,8 @@ public class AltarRecipeHandler implements IRecipeHandler<AltarRecipeJEI> {
@Nonnull
@Override
public Class<? extends IRecipeCategory> getRecipeCategoryClass() {
return AltarRecipeCategory.class;
public String getRecipeCategoryUid() {
return Constants.Compat.JEI_CATEGORY_ALTAR;
}
@Nonnull

View file

@ -27,6 +27,11 @@ public class AltarRecipeJEI extends BloodMagicRecipeWrapper {
this.infoString = new String[]{TextHelper.localize("jei.BloodMagic.recipe.requiredTier", tier), TextHelper.localize("jei.BloodMagic.recipe.requiredLP", requiredLP)};
}
@Override
public boolean usesOreDictionaryComparison() {
return false;
}
@Override
public List getInputs() {
return Collections.singletonList(input);