NaturesAura/src/main/java/de/ellpeck/naturesaura/compat/jei/AnimalSpawnerCategory.java

63 lines
1.9 KiB
Java
Raw Normal View History

2020-01-21 21:04:44 +01:00
package de.ellpeck.naturesaura.compat.jei;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
import mezz.jei.api.gui.IRecipeLayout;
2020-01-21 21:04:44 +01:00
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.IIngredients;
2020-01-21 21:04:44 +01:00
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
import java.util.Arrays;
2020-01-21 21:04:44 +01:00
public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecipe> {
private final IDrawable background;
public AnimalSpawnerCategory(IGuiHelper helper) {
this.background = helper.createDrawable(new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/jei/animal_spawner.png"), 0, 0, 72, 86);
}
@Override
2020-01-21 21:04:44 +01:00
public ResourceLocation getUid() {
return JEINaturesAuraPlugin.SPAWNER;
}
@Override
2020-01-21 21:04:44 +01:00
public Class<? extends AnimalSpawnerRecipe> getRecipeClass() {
return AnimalSpawnerRecipe.class;
}
@Override
2020-01-21 21:04:44 +01:00
public String getTitle() {
return I18n.format("container." + JEINaturesAuraPlugin.SPAWNER + ".name");
}
@Override
public IDrawable getBackground() {
return this.background;
}
@Override
2020-01-21 21:04:44 +01:00
public IDrawable getIcon() {
return null;
}
@Override
public void setIngredients(AnimalSpawnerRecipe animalSpawnerRecipe, IIngredients iIngredients) {
}
@Override
public void setRecipe(IRecipeLayout iRecipeLayout, AnimalSpawnerRecipe recipe, IIngredients iIngredients) {
IGuiItemStackGroup group = iRecipeLayout.getItemStacks();
2019-01-03 13:46:57 +01:00
for (int i = 0; i < recipe.ingredients.length; i++) {
group.init(i, true, i * 18, 68);
2019-01-03 13:46:57 +01:00
group.set(i, Arrays.asList(recipe.ingredients[i].getMatchingStacks()));
}
}
}