2020-01-21 21:04:44 +01:00
|
|
|
package de.ellpeck.naturesaura.compat.jei;
|
2018-10-18 18:00:21 +02:00
|
|
|
|
|
|
|
import de.ellpeck.naturesaura.NaturesAura;
|
|
|
|
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
2021-01-14 23:15:02 +01:00
|
|
|
import de.ellpeck.naturesaura.recipes.AltarRecipe;
|
2022-06-27 15:24:04 +02:00
|
|
|
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
2020-01-21 21:04:44 +01:00
|
|
|
import mezz.jei.api.gui.drawable.IDrawable;
|
|
|
|
import mezz.jei.api.helpers.IGuiHelper;
|
2022-06-27 15:24:04 +02:00
|
|
|
import mezz.jei.api.recipe.IFocusGroup;
|
|
|
|
import mezz.jei.api.recipe.RecipeIngredientRole;
|
|
|
|
import mezz.jei.api.recipe.RecipeType;
|
2020-01-21 21:04:44 +01:00
|
|
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
2021-12-19 17:14:56 +01:00
|
|
|
import net.minecraft.network.chat.Component;
|
|
|
|
import net.minecraft.resources.ResourceLocation;
|
|
|
|
import net.minecraft.world.item.ItemStack;
|
|
|
|
import net.minecraft.world.item.crafting.Ingredient;
|
2018-10-18 18:00:21 +02:00
|
|
|
|
2018-11-20 11:44:07 +01:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Collections;
|
|
|
|
|
2020-01-21 21:04:44 +01:00
|
|
|
public class AltarCategory implements IRecipeCategory<AltarRecipe> {
|
2018-10-18 18:00:21 +02:00
|
|
|
|
|
|
|
private final IDrawable background;
|
|
|
|
private final ItemStack altar = new ItemStack(ModBlocks.NATURE_ALTAR);
|
|
|
|
|
|
|
|
public AltarCategory(IGuiHelper helper) {
|
2020-02-25 22:57:10 +01:00
|
|
|
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/altar.png"), 0, 0, 103, 57);
|
2018-10-18 18:00:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-06-27 15:24:04 +02:00
|
|
|
public RecipeType<AltarRecipe> getRecipeType() {
|
2018-10-18 18:00:21 +02:00
|
|
|
return JEINaturesAuraPlugin.ALTAR;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-19 17:14:56 +01:00
|
|
|
public Component getTitle() {
|
2022-06-27 15:24:04 +02:00
|
|
|
return Component.translatable("container." + JEINaturesAuraPlugin.ALTAR + ".name");
|
2018-10-18 18:00:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IDrawable getBackground() {
|
|
|
|
return this.background;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-01-21 21:04:44 +01:00
|
|
|
public IDrawable getIcon() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-06-27 15:24:04 +02:00
|
|
|
public void setRecipe(IRecipeLayoutBuilder builder, AltarRecipe recipe, IFocusGroup focuses) {
|
|
|
|
builder.addSlot(RecipeIngredientRole.INPUT, 0, 18).addItemStacks(Arrays.asList(recipe.input.getItems()));
|
|
|
|
builder.addSlot(RecipeIngredientRole.OUTPUT, 80, 18).addItemStack(recipe.output);
|
|
|
|
builder.addSlot(RecipeIngredientRole.CATALYST, 26, 18).addItemStacks(recipe.catalyst == Ingredient.EMPTY ? Collections.singletonList(this.altar) : Arrays.asList(recipe.catalyst.getItems()));
|
|
|
|
builder.addSlot(RecipeIngredientRole.CATALYST, 51, 18).addItemStack(recipe.requiredType != null ? recipe.getDimensionBottle() : ItemStack.EMPTY);
|
2018-10-18 18:00:21 +02:00
|
|
|
}
|
|
|
|
}
|