Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This mod element is always locked. Enter your code in the methods below.
- * If you don't need some of these methods, you can remove them as they
- * are overrides of the base class JeitestModElements.ModElement.
- *
- * You can register new events in this class too.
- *
- * As this class is loaded into mod element list, it NEEDS to extend
- * ModElement class. If you remove this extend statement or remove the
- * constructor, the compilation will fail.
- *
- * If you want to make a plain independent class, create it in
- * "Workspace" -> "Source" menu.
- *
- * If you change workspace package, modid or prefix, you will need
- * to manually adapt this file to these changes or remake it.
- */
- package net.mcreator.jeitest;
- import mezz.jei.api.IModPlugin;
- import mezz.jei.api.constants.VanillaTypes;
- import mezz.jei.api.gui.IRecipeLayout;
- import mezz.jei.api.gui.drawable.IDrawable;
- import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
- import mezz.jei.api.helpers.IGuiHelper;
- import mezz.jei.api.helpers.IJeiHelpers;
- import mezz.jei.api.ingredients.IIngredients;
- import mezz.jei.api.recipe.category.IRecipeCategory;
- import mezz.jei.api.registration.IRecipeCatalystRegistration;
- import mezz.jei.api.registration.IRecipeCategoryRegistration;
- import mezz.jei.api.registration.IRecipeRegistration;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.Items;
- import net.minecraft.util.ResourceLocation;
- import net.mcreator.jeitest.block.InfuseBenchBlock;
- import java.util.ArrayList;
- import java.util.List;
- @mezz.jei.api.JeiPlugin
- public class MyJeiPlugin implements IModPlugin {
- public static IJeiHelpers jeiHelper;
- @Override
- public ResourceLocation getPluginUid() {
- return new ResourceLocation("jeitest","default");
- }
- @Override
- public void registerCategories(IRecipeCategoryRegistration registration) {
- jeiHelper = registration.getJeiHelpers();
- registration.addRecipeCategories(new InfuseJeiCategory(jeiHelper.getGuiHelper()));
- }
- @Override
- public void registerRecipes(IRecipeRegistration registration) {
- registration.addRecipes(generateInfuseRecipes(), InfuseJeiCategory.Uid);
- }
- private List<InfuseJeiCategory.InfuseRecipeWrapper> generateInfuseRecipes() {
- List<InfuseJeiCategory.InfuseRecipeWrapper> recipes = new ArrayList<>();
- recipes.add(new InfuseJeiCategory.InfuseRecipeWrapper(new ItemStack(Items.DIRT), new ItemStack(Items.DIAMOND)));
- return recipes;
- }
- @Override
- public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) {
- registration.addRecipeCatalyst(new ItemStack(InfuseBenchBlock.block), InfuseJeiCategory.Uid);
- }
- public static class InfuseJeiCategory implements IRecipeCategory<InfuseJeiCategory.InfuseRecipeWrapper>
- {
- private static ResourceLocation Uid = new ResourceLocation("jeitest", "infusebench");
- private static final int input1 = 0;
- private static final int output1 = 1;
- private final String title;
- private final IDrawable background;
- private final IDrawable icon;
- public InfuseJeiCategory(IGuiHelper guiHelper)
- {
- this.title = "Infusion Bench";
- this.background = guiHelper.createDrawable(new ResourceLocation("jeitest", "textures/infuse_bench_gui.png"), 0, 0, 176, 116);
- this.icon = guiHelper.createDrawable(new ResourceLocation("jeitest", "textures/blocks/jeitestbench.png"), 0, 0, 16, 16);
- }
- @Override
- public ResourceLocation getUid() {
- return Uid;
- }
- @Override
- public Class<? extends InfuseRecipeWrapper> getRecipeClass() {
- return InfuseJeiCategory.InfuseRecipeWrapper.class;
- }
- @Override
- public String getTitle() {
- return title;
- }
- @Override
- public IDrawable getBackground() {
- return background;
- }
- @Override
- public IDrawable getIcon() {
- return null;
- }
- @Override
- public void setIngredients(InfuseRecipeWrapper infuseRecipeWrapper, IIngredients iIngredients) {
- iIngredients.setInput(VanillaTypes.ITEM, infuseRecipeWrapper.getStack0());
- iIngredients.setOutput(VanillaTypes.ITEM, infuseRecipeWrapper.getStack1());
- }
- @Override
- public void setRecipe(IRecipeLayout iRecipeLayout, InfuseRecipeWrapper infuseRecipeWrapper, IIngredients iIngredients) {
- IGuiItemStackGroup stacks = iRecipeLayout.getItemStacks();
- stacks.init(input1, true, 37, 32);
- stacks.init(output1, false, 118, 28);
- stacks.set(0, iIngredients.getInputs(VanillaTypes.ITEM).get(0));
- stacks.set(1, iIngredients.getOutputs(VanillaTypes.ITEM).get(0));
- }
- public static class InfuseRecipeWrapper {
- private ItemStack item0;
- private ItemStack item1;
- public InfuseRecipeWrapper(ItemStack item0, ItemStack item1) {
- this.item0 = item0;
- this.item1 = item1;
- }
- public ItemStack getStack0() {
- return item0;
- }
- public ItemStack getStack1() {
- return item1;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment