JEI Laser plugin.

This commit is contained in:
Flanks255 2022-12-30 18:24:21 -06:00
parent 90b1675764
commit 177370a6a5
4 changed files with 90 additions and 69 deletions

View file

@ -47,6 +47,10 @@ public class LaserRecipe implements IRecipe<IInventory> {
return itemIngredient.test(itemStack);
}
public Ingredient getInput() {
return itemIngredient;
}
//nah
@Override
public boolean matches(IInventory pInv, World pLevel) {

View file

@ -39,6 +39,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
IJeiHelpers helpers = registry.getJeiHelpers();
registry.addRecipeCategories(new FermentingCategory(helpers.getGuiHelper()));
registry.addRecipeCategories(new LaserRecipeCategory(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()));
}
@ -47,6 +48,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
public void registerRecipeCatalysts(IRecipeCatalystRegistration registry) {
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.blockFurnaceDouble.get()), VanillaRecipeCategoryUid.SMELTING);
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockGrinder.get()), CrusherRecipeCategory.NAME);
@ -63,6 +65,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
World level = Minecraft.getInstance().level;
registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.FERMENTING), FermentingCategory.ID);
registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.LASER), LaserRecipeCategory.ID);
//registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, BookletRecipeCategory.NAME);

View file

@ -0,0 +1,83 @@
/*
* This file ("ReconstructorRecipeCategory.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 de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
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.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TranslationTextComponent;
import javax.annotation.Nonnull;
import java.util.Arrays;
public class LaserRecipeCategory implements IRecipeCategory<LaserRecipe> {
public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "laser_jei");
private final IDrawableStatic background;
private final ItemStack RECONSTRUCTOR = new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem());
public LaserRecipeCategory(IGuiHelper helper) {
this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_atomic_reconstructor"), 0, 0, 96, 60).setTextureSize(256,256).build();
}
@Override
public ResourceLocation getUid() {
return ID;
}
@Override
public Class<? extends LaserRecipe> getRecipeClass() {
return LaserRecipe.class;
}
@Override
public String getTitle() {
return new TranslationTextComponent("container.actuallyadditions.reconstructor").getString();
}
@Override
public IDrawable getBackground() {
return this.background;
}
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void setIngredients(LaserRecipe laserRecipe, IIngredients ingredients) {
ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(laserRecipe.getInput().getItems()));
ingredients.setOutput(VanillaTypes.ITEM, laserRecipe.getResultItem());
}
@Override
public void setRecipe(@Nonnull IRecipeLayout layout, @Nonnull LaserRecipe laserRecipe, @Nonnull IIngredients iIngredients) {
layout.getItemStacks().init(0, true, 4, 18);
layout.getItemStacks().set(0, iIngredients.getInputs(VanillaTypes.ITEM).get(0));
layout.getItemStacks().init(1, false, 34, 19);
layout.getItemStacks().set(1, RECONSTRUCTOR);
layout.getItemStacks().init(2, false, 66, 18);
layout.getItemStacks().set(2, iIngredients.getOutputs(VanillaTypes.ITEM).get(0));
}
}

View file

@ -1,69 +0,0 @@
///*
// * This file ("ReconstructorRecipeCategory.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.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
//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.ingredients.VanillaTypes;
//import mezz.jei.api.recipe.IRecipeCategory;
//import net.minecraft.client.Minecraft;
//import net.minecraft.item.ItemStack;
//
//public class ReconstructorRecipeCategory implements IRecipeCategory<ReconstructorRecipeWrapper> {
//
// public static final String NAME = "actuallyadditions.reconstructor";
//
// private static final ItemStack RECONSTRUCTOR = new ItemStack(ActuallyBlocks.blockAtomicReconstructor);
// private final IDrawable background;
//
// public ReconstructorRecipeCategory(IGuiHelper helper) {
// this.background = helper.createDrawable(AssetUtil.getGuiLocation("gui_nei_atomic_reconstructor"), 0, 0, 96, 60);
// }
//
// @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 drawExtras(Minecraft minecraft) {
// AssetUtil.renderStackToGui(RECONSTRUCTOR, 34, 19, 1.0F);
// }
//
// @Override
// public void setRecipe(IRecipeLayout recipeLayout, ReconstructorRecipeWrapper wrapper, IIngredients ingredients) {
// recipeLayout.getItemStacks().init(0, true, 4, 18);
// recipeLayout.getItemStacks().set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0).get(0));
// recipeLayout.getItemStacks().init(1, false, 66, 18);
// recipeLayout.getItemStacks().set(1, ingredients.getOutputs(VanillaTypes.ITEM).get(0).get(0));
// }
//}