Empowerer Plugin

This commit is contained in:
Flanks255 2022-12-30 19:06:33 -06:00
parent 177370a6a5
commit d62d833178
5 changed files with 100 additions and 245 deletions

View file

@ -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<EmpowererRecipe> {
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<? extends EmpowererRecipe> 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<ItemStack> 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());
}
}

View file

@ -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

View file

@ -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<EmpowererRecipeWrapper> {
//
// 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());
// }
//}

View file

@ -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<ItemStack> 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));
// }
//}

View file

@ -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<LensConversionRecipe> 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);
// }
//
// }
//}