mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Added JEI plugin for canola press recipes.
This commit is contained in:
parent
7ae6231a38
commit
0632253a3b
3 changed files with 75 additions and 5 deletions
|
@ -36,6 +36,10 @@ public class PressingRecipe implements Recipe<Container> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Ingredient getInput() {
|
||||||
|
return this.input;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack assemble(Container pInv, RegistryAccess pRegistryAccess) {
|
public ItemStack assemble(Container pInv, RegistryAccess pRegistryAccess) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
|
|
|
@ -12,11 +12,7 @@ package de.ellpeck.actuallyadditions.mod.jei;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
import de.ellpeck.actuallyadditions.mod.crafting.*;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.CoffeeIngredientRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
|
@ -24,6 +20,7 @@ import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineCategory;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeCategory;
|
import de.ellpeck.actuallyadditions.mod.jei.empowerer.EmpowererRecipeCategory;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.fermenting.FermentingCategory;
|
import de.ellpeck.actuallyadditions.mod.jei.fermenting.FermentingCategory;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.laser.LaserRecipeCategory;
|
import de.ellpeck.actuallyadditions.mod.jei.laser.LaserRecipeCategory;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.jei.pressing.PressingCategory;
|
||||||
import mezz.jei.api.IModPlugin;
|
import mezz.jei.api.IModPlugin;
|
||||||
import mezz.jei.api.JeiPlugin;
|
import mezz.jei.api.JeiPlugin;
|
||||||
import mezz.jei.api.constants.RecipeTypes;
|
import mezz.jei.api.constants.RecipeTypes;
|
||||||
|
@ -48,6 +45,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final RecipeType<FermentingRecipe> FERMENTING = RecipeType.create(ActuallyAdditions.MODID, "fermenting", FermentingRecipe.class);
|
public static final RecipeType<FermentingRecipe> FERMENTING = RecipeType.create(ActuallyAdditions.MODID, "fermenting", FermentingRecipe.class);
|
||||||
|
public static final RecipeType<PressingRecipe> PRESSING = RecipeType.create(ActuallyAdditions.MODID, "pressing", PressingRecipe.class);
|
||||||
public static final RecipeType<LaserRecipe> LASER = RecipeType.create(ActuallyAdditions.MODID, "laser", LaserRecipe.class);
|
public static final RecipeType<LaserRecipe> LASER = RecipeType.create(ActuallyAdditions.MODID, "laser", LaserRecipe.class);
|
||||||
public static final RecipeType<EmpowererRecipe> EMPOWERER = RecipeType.create(ActuallyAdditions.MODID, "empowerer", EmpowererRecipe.class);
|
public static final RecipeType<EmpowererRecipe> EMPOWERER = RecipeType.create(ActuallyAdditions.MODID, "empowerer", EmpowererRecipe.class);
|
||||||
public static final RecipeType<CoffeeIngredientRecipe> COFFEE_MACHINE = RecipeType.create(ActuallyAdditions.MODID, "coffee_machine", CoffeeIngredientRecipe.class);
|
public static final RecipeType<CoffeeIngredientRecipe> COFFEE_MACHINE = RecipeType.create(ActuallyAdditions.MODID, "coffee_machine", CoffeeIngredientRecipe.class);
|
||||||
|
@ -60,6 +58,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
|
||||||
registry.addRecipeCategories(new LaserRecipeCategory(helpers.getGuiHelper()));
|
registry.addRecipeCategories(new LaserRecipeCategory(helpers.getGuiHelper()));
|
||||||
registry.addRecipeCategories(new EmpowererRecipeCategory(helpers.getGuiHelper()));
|
registry.addRecipeCategories(new EmpowererRecipeCategory(helpers.getGuiHelper()));
|
||||||
registry.addRecipeCategories(new CoffeeMachineCategory(helpers.getGuiHelper()));
|
registry.addRecipeCategories(new CoffeeMachineCategory(helpers.getGuiHelper()));
|
||||||
|
registry.addRecipeCategories(new PressingCategory(helpers.getGuiHelper()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,6 +69,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
|
||||||
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem()), LASER);
|
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem()), LASER);
|
||||||
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.EMPOWERER.getItem()), EMPOWERER);
|
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.EMPOWERER.getItem()), EMPOWERER);
|
||||||
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.COFFEE_MACHINE.getItem()), COFFEE_MACHINE);
|
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.COFFEE_MACHINE.getItem()), COFFEE_MACHINE);
|
||||||
|
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.CANOLA_PRESS.getItem()), PRESSING);
|
||||||
|
|
||||||
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockGrinder.get()), CrusherRecipeCategory.NAME);
|
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockGrinder.get()), CrusherRecipeCategory.NAME);
|
||||||
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockGrinderDouble.get()), CrusherRecipeCategory.NAME);
|
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockGrinderDouble.get()), CrusherRecipeCategory.NAME);
|
||||||
|
@ -87,6 +87,7 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
|
||||||
registry.addRecipes(LASER, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.LASER.get()).stream().map(RecipeHolder::value).toList());
|
registry.addRecipes(LASER, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.LASER.get()).stream().map(RecipeHolder::value).toList());
|
||||||
registry.addRecipes(EMPOWERER, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING.get()).stream().map(RecipeHolder::value).toList());
|
registry.addRecipes(EMPOWERER, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING.get()).stream().map(RecipeHolder::value).toList());
|
||||||
registry.addRecipes(COFFEE_MACHINE, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.COFFEE_INGREDIENT.get()).stream().map(RecipeHolder::value).toList());
|
registry.addRecipes(COFFEE_MACHINE, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.COFFEE_INGREDIENT.get()).stream().map(RecipeHolder::value).toList());
|
||||||
|
registry.addRecipes(PRESSING, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.PRESSING.get()).stream().map(RecipeHolder::value).toList());
|
||||||
//registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, BookletRecipeCategory.NAME);
|
//registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, BookletRecipeCategory.NAME);
|
||||||
//registry.addRecipes(ActuallyAdditionsAPI.CRUSHER_RECIPES, CrusherRecipeCategory.NAME);
|
//registry.addRecipes(ActuallyAdditionsAPI.CRUSHER_RECIPES, CrusherRecipeCategory.NAME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.jei.pressing;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.jei.JEIActuallyAdditionsPlugin;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
|
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
||||||
|
import mezz.jei.api.gui.drawable.IDrawable;
|
||||||
|
import mezz.jei.api.gui.drawable.IDrawableStatic;
|
||||||
|
import mezz.jei.api.helpers.IGuiHelper;
|
||||||
|
import mezz.jei.api.recipe.IFocusGroup;
|
||||||
|
import mezz.jei.api.recipe.RecipeIngredientRole;
|
||||||
|
import mezz.jei.api.recipe.RecipeType;
|
||||||
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
public class PressingCategory implements IRecipeCategory<PressingRecipe> {
|
||||||
|
|
||||||
|
private final IDrawableStatic background;
|
||||||
|
private final IDrawableStatic fluidBackground;
|
||||||
|
|
||||||
|
public PressingCategory(IGuiHelper guiHelper) {
|
||||||
|
background = guiHelper.drawableBuilder(new ResourceLocation(ActuallyAdditions.MODID, "textures/gui/gui_canola_press.png"), 41, 4, 93, 85).setTextureSize(256,256).build();
|
||||||
|
fluidBackground = guiHelper.drawableBuilder(AssetUtil.GUI_INVENTORY_LOCATION, 0, 171, 18, 85).build();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public RecipeType<PressingRecipe> getRecipeType() {
|
||||||
|
return JEIActuallyAdditionsPlugin.PRESSING;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getTitle() {
|
||||||
|
return Component.literal("Pressing Recipe");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IDrawable getBackground() {
|
||||||
|
return background;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IDrawable getIcon() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRecipe(IRecipeLayoutBuilder builder, PressingRecipe recipe, IFocusGroup iFocusGroup) {
|
||||||
|
Ingredient input = recipe.getInput();
|
||||||
|
FluidStack output = recipe.getOutput();
|
||||||
|
|
||||||
|
builder.addSlot(RecipeIngredientRole.INPUT, 40, 6)
|
||||||
|
.addIngredients(input);
|
||||||
|
|
||||||
|
int height = (int)(83D / 1000 * output.getAmount());
|
||||||
|
int offset = 83 - height;
|
||||||
|
|
||||||
|
builder.addSlot(RecipeIngredientRole.OUTPUT, 75, 1 + offset)
|
||||||
|
.addFluidStack(output.getFluid(), output.getAmount())
|
||||||
|
.setFluidRenderer(output.getAmount(), false, 16, height)
|
||||||
|
.setBackground(fluidBackground, -1, -1 - offset);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue