diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/EmpowererRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/EmpowererRecipeCategory.java new file mode 100644 index 000000000..beae11afb --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/EmpowererRecipeCategory.java @@ -0,0 +1,97 @@ +/* + * This file ("EmpowererRecipeCategory.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2017 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.jei; + +import java.util.ArrayList; +import java.util.Arrays; + +import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; +import de.ellpeck.actuallyadditions.mod.util.AssetUtil; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class EmpowererRecipeCategory implements IRecipeCategory { + + public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "empowerer_jei"); + + private final IDrawableStatic background; + + public EmpowererRecipeCategory(IGuiHelper helper) { + this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_empowerer"), 0, 0, 135, 80).setTextureSize(256,256).build(); + } + + @Override + public ResourceLocation getUid() { + return ID; + } + + @Override + public Class getRecipeClass() { + return EmpowererRecipe.class; + } + + @Override + public String getTitle() { + return I18n.get("container.actuallyadditions.empowerer"); + } + + @Override + public IDrawable getBackground() { + return background; + } + + @Override + public IDrawable getIcon() { + return null; + } + + @Override + public void setIngredients(EmpowererRecipe empowererRecipe, IIngredients ingredients) { + ArrayList input = new ArrayList<>(); + input.addAll(Arrays.asList(empowererRecipe.getInput().getItems())); + input.addAll(Arrays.asList(empowererRecipe.getStandOne().getItems())); + input.addAll(Arrays.asList(empowererRecipe.getStandTwo().getItems())); + input.addAll(Arrays.asList(empowererRecipe.getStandThree().getItems())); + input.addAll(Arrays.asList(empowererRecipe.getStandFour().getItems())); + ingredients.setInputs(VanillaTypes.ITEM, input); + ingredients.setOutput(VanillaTypes.ITEM, empowererRecipe.getOutput()); + } + + @Override + public void setRecipe(IRecipeLayout recipeLayout, EmpowererRecipe recipe, IIngredients ingredients) { + recipeLayout.getItemStacks().init(0, true, 31, 31); + recipeLayout.getItemStacks().set(0, Arrays.asList(recipe.getInput().getItems())); + + recipeLayout.getItemStacks().init(1, true, 1, 31); + recipeLayout.getItemStacks().set(1, Arrays.asList(recipe.getStandOne().getItems())); + + recipeLayout.getItemStacks().init(2, true, 31, 1); + recipeLayout.getItemStacks().set(2, Arrays.asList(recipe.getStandTwo().getItems())); + + recipeLayout.getItemStacks().init(3, true, 61, 31); + recipeLayout.getItemStacks().set(3, Arrays.asList(recipe.getStandThree().getItems())); + + recipeLayout.getItemStacks().init(4, true, 31, 61); + recipeLayout.getItemStacks().set(4, Arrays.asList(recipe.getStandFour().getItems())); + + recipeLayout.getItemStacks().init(5, false, 112, 31); + recipeLayout.getItemStacks().set(5, recipe.getResultItem()); + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java index 93a4a4f6a..98caf9a80 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java @@ -40,6 +40,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin { registry.addRecipeCategories(new FermentingCategory(helpers.getGuiHelper())); registry.addRecipeCategories(new LaserRecipeCategory(helpers.getGuiHelper())); + registry.addRecipeCategories(new EmpowererRecipeCategory(helpers.getGuiHelper())); //registry.addRecipeCategories(new CoffeeMachineRecipeCategory(helpers.getGuiHelper()), new CompostRecipeCategory(helpers.getGuiHelper()), new CrusherRecipeCategory(helpers.getGuiHelper()), new ReconstructorRecipeCategory(helpers.getGuiHelper()), new EmpowererRecipeCategory(helpers.getGuiHelper()), new BookletRecipeCategory(helpers.getGuiHelper())); } @@ -49,6 +50,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin { registry.addRecipeCatalyst(new ItemStack(ActuallyItems.CRAFTER_ON_A_STICK.get()), VanillaRecipeCategoryUid.CRAFTING); registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.FERMENTING_BARREL.getItem()), FermentingCategory.ID); registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem()), LaserRecipeCategory.ID); + registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.EMPOWERER.getItem()), EmpowererRecipeCategory.ID); // registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockFurnaceDouble.get()), VanillaRecipeCategoryUid.SMELTING); // registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockGrinder.get()), CrusherRecipeCategory.NAME); @@ -66,14 +68,12 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin { registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.FERMENTING), FermentingCategory.ID); registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.LASER), LaserRecipeCategory.ID); + registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING), EmpowererRecipeCategory.ID); //registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, BookletRecipeCategory.NAME); //registry.addRecipes(ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS, CoffeeMachineRecipeCategory.NAME); //registry.addRecipes(ActuallyAdditionsAPI.CRUSHER_RECIPES, CrusherRecipeCategory.NAME); - //registry.addRecipes(ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES, ReconstructorRecipeCategory.NAME); - //registry.addRecipes(ActuallyAdditionsAPI.EMPOWERER_RECIPES, EmpowererRecipeCategory.NAME); - //registry.addRecipes(ActuallyAdditionsAPI.COMPOST_RECIPES, CompostRecipeCategory.NAME); } // @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeCategory.java deleted file mode 100644 index db405f906..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeCategory.java +++ /dev/null @@ -1,74 +0,0 @@ -///* -// * This file ("EmpowererRecipeCategory.java") is part of the Actually Additions mod for Minecraft. -// * It is created and owned by Ellpeck and distributed -// * under the Actually Additions License to be found at -// * http://ellpeck.de/actaddlicense -// * View the source code at https://github.com/Ellpeck/ActuallyAdditions -// * -// * © 2015-2017 Ellpeck -// */ -// -//package de.ellpeck.actuallyadditions.mod.jei.empowerer; -// -//import java.util.Arrays; -// -//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; -//import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -//import de.ellpeck.actuallyadditions.mod.util.StringUtil; -//import mezz.jei.api.IGuiHelper; -//import mezz.jei.api.gui.IDrawable; -//import mezz.jei.api.gui.IRecipeLayout; -//import mezz.jei.api.ingredients.IIngredients; -//import mezz.jei.api.recipe.IRecipeCategory; -// -//public class EmpowererRecipeCategory implements IRecipeCategory { -// -// public static final String NAME = "actuallyadditions.empowerer"; -// -// private final IDrawable background; -// -// public EmpowererRecipeCategory(IGuiHelper helper) { -// this.background = helper.createDrawable(AssetUtil.getGuiLocation("gui_nei_empowerer"), 0, 0, 135, 80); -// } -// -// @Override -// public String getUid() { -// return NAME; -// } -// -// @Override -// public String getTitle() { -// return StringUtil.localize("container.nei." + NAME + ".name"); -// } -// -// @Override -// public String getModName() { -// return ActuallyAdditions.NAME; -// } -// -// @Override -// public IDrawable getBackground() { -// return this.background; -// } -// -// @Override -// public void setRecipe(IRecipeLayout recipeLayout, EmpowererRecipeWrapper wrapper, IIngredients ingredients) { -// recipeLayout.getItemStacks().init(0, true, 31, 31); -// recipeLayout.getItemStacks().set(0, Arrays.asList(wrapper.theRecipe.getInput().getMatchingStacks())); -// -// recipeLayout.getItemStacks().init(1, true, 1, 31); -// recipeLayout.getItemStacks().set(1, Arrays.asList(wrapper.theRecipe.getStandOne().getMatchingStacks())); -// -// recipeLayout.getItemStacks().init(2, true, 31, 1); -// recipeLayout.getItemStacks().set(2, Arrays.asList(wrapper.theRecipe.getStandTwo().getMatchingStacks())); -// -// recipeLayout.getItemStacks().init(3, true, 61, 31); -// recipeLayout.getItemStacks().set(3, Arrays.asList(wrapper.theRecipe.getStandThree().getMatchingStacks())); -// -// recipeLayout.getItemStacks().init(4, true, 31, 61); -// recipeLayout.getItemStacks().set(4, Arrays.asList(wrapper.theRecipe.getStandFour().getMatchingStacks())); -// -// recipeLayout.getItemStacks().init(5, false, 112, 31); -// recipeLayout.getItemStacks().set(5, wrapper.theRecipe.getOutput()); -// } -//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java deleted file mode 100644 index 3f59b7c08..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java +++ /dev/null @@ -1,70 +0,0 @@ -///* -// * This file ("EmpowererRecipeWrapper.java") is part of the Actually Additions mod for Minecraft. -// * It is created and owned by Ellpeck and distributed -// * under the Actually Additions License to be found at -// * http://ellpeck.de/actaddlicense -// * View the source code at https://github.com/Ellpeck/ActuallyAdditions -// * -// * © 2015-2017 Ellpeck -// */ -// -//package de.ellpeck.actuallyadditions.mod.jei.empowerer; -// -//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; -//import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe; -//import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; -//import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton; -//import mezz.jei.api.ingredients.IIngredients; -//import mezz.jei.api.ingredients.VanillaTypes; -//import net.minecraft.item.ItemStack; -// -//import java.util.ArrayList; -//import java.util.List; -// -//public class EmpowererRecipeWrapper extends RecipeWrapperWithButton { -// -// public final EmpowererRecipe theRecipe; -// -// public EmpowererRecipeWrapper(EmpowererRecipe recipe) { -// this.theRecipe = recipe; -// } -// -// @Override -// public void getIngredients(IIngredients ingredients) { -// List inputs = new ArrayList<>(); -// for (ItemStack s : this.theRecipe.getInput().getMatchingStacks()) { -// inputs.add(s); -// } -// for (ItemStack s : this.theRecipe.getStandOne().getMatchingStacks()) { -// inputs.add(s); -// } -// for (ItemStack s : this.theRecipe.getStandTwo().getMatchingStacks()) { -// inputs.add(s); -// } -// for (ItemStack s : this.theRecipe.getStandThree().getMatchingStacks()) { -// inputs.add(s); -// } -// for (ItemStack s : this.theRecipe.getStandFour().getMatchingStacks()) { -// inputs.add(s); -// } -// -// ingredients.setInputs(VanillaTypes.ITEM, inputs); -// ingredients.setOutput(VanillaTypes.ITEM, this.theRecipe.getOutput()); -// } -// -// @Override -// public int getButtonX() { -// return 2; -// } -// -// @Override -// public int getButtonY() { -// return 2; -// } -// -// @Override -// public IBookletPage getPage() { -// return BookletUtils.findFirstPageForStack(new ItemStack(ActuallyBlocks.blockEmpowerer)); -// } -//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java deleted file mode 100644 index 1bdd27f60..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java +++ /dev/null @@ -1,98 +0,0 @@ -///* -// * This file ("ReconstructorRecipeWrapper.java") is part of the Actually Additions mod for Minecraft. -// * It is created and owned by Ellpeck and distributed -// * under the Actually Additions License to be found at -// * http://ellpeck.de/actaddlicense -// * View the source code at https://github.com/Ellpeck/ActuallyAdditions -// * -// * © 2015-2017 Ellpeck -// */ -// -//package de.ellpeck.actuallyadditions.mod.jei.reconstructor; -// -//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; -//import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; -//import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; -//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; -//import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton; -//import de.ellpeck.actuallyadditions.mod.recipe.EnchBookConversion; -//import mezz.jei.api.ingredients.IIngredients; -//import mezz.jei.api.ingredients.VanillaTypes; -//import mezz.jei.api.recipe.IRecipeWrapperFactory; -//import net.minecraft.client.Minecraft; -//import net.minecraft.client.resources.I18n; -//import net.minecraft.init.Items; -//import net.minecraft.item.ItemStack; -//import net.minecraft.nbt.CompoundNBT; -//import net.minecraft.nbt.ListNBT; -//import net.minecraft.nbt.NBTTagString; -// -//import java.util.Arrays; -// -//public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton { -// -// public static final IRecipeWrapperFactory FACTORY = (recipe) -> { -// if (recipe instanceof EnchBookConversion) { -// return new EnchBookWrapper((EnchBookConversion) recipe); -// } -// return new ReconstructorRecipeWrapper(recipe); -// }; -// -// public final LensConversionRecipe theRecipe; -// -// public ReconstructorRecipeWrapper(LensConversionRecipe recipe) { -// this.theRecipe = recipe; -// } -// -// @Override -// public void getIngredients(IIngredients ingredients) { -// ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(this.theRecipe.getInput().getMatchingStacks())); -// ingredients.setOutput(VanillaTypes.ITEM, this.theRecipe.getOutput()); -// } -// -// @Override -// public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { -// minecraft.fontRenderer.drawString(this.theRecipe.getEnergyUsed() + " " + I18n.format("actuallyadditions.cf"), 55, 0, 0xFFFFFF, true); -// super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); -// } -// -// @Override -// public int getButtonX() { -// return 3; -// } -// -// @Override -// public int getButtonY() { -// return 40; -// } -// -// @Override -// public IBookletPage getPage() { -// return BookletUtils.findFirstPageForStack(new ItemStack(ActuallyBlocks.blockAtomicReconstructor)); -// } -// -// public static class EnchBookWrapper extends ReconstructorRecipeWrapper { -// -// private static final ItemStack BOOK = new ItemStack(Items.ENCHANTED_BOOK); -// private static final ItemStack OUT = new ItemStack(Items.ENCHANTED_BOOK); -// -// static { -// OUT.setStackDisplayName("Split Book"); -// CompoundNBT t = OUT.getTagCompound().getCompoundTag("display"); -// ListNBT l = new ListNBT(); -// l.appendTag(new NBTTagString("Book will be split based on enchantments!")); -// t.setTag("Lore", l); -// } -// -// public EnchBookWrapper(EnchBookConversion recipe) { -// super(recipe); -// } -// -// @Override -// public void getIngredients(IIngredients ingredients) { -// ingredients.setInput(VanillaTypes.ITEM, BOOK); -// ingredients.setOutput(VanillaTypes.ITEM, OUT); -// } -// -// } -//}