2020-01-21 21:04:44 +01:00
|
|
|
package de.ellpeck.naturesaura.compat.jei;
|
2018-12-31 17:32:38 +01:00
|
|
|
|
|
|
|
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;
|
2018-12-31 17:32:38 +01:00
|
|
|
import mezz.jei.api.ingredients.IIngredients;
|
2020-01-21 21:04:44 +01:00
|
|
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
2018-12-31 17:32:38 +01:00
|
|
|
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> {
|
2018-12-31 17:32:38 +01:00
|
|
|
|
|
|
|
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() {
|
2018-12-31 17:32:38 +01:00
|
|
|
return JEINaturesAuraPlugin.SPAWNER;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-01-21 21:04:44 +01:00
|
|
|
public Class<? extends AnimalSpawnerRecipe> getRecipeClass() {
|
|
|
|
return AnimalSpawnerRecipe.class;
|
2018-12-31 17:32:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-01-21 21:04:44 +01:00
|
|
|
public String getTitle() {
|
|
|
|
return I18n.format("container." + JEINaturesAuraPlugin.SPAWNER + ".name");
|
2018-12-31 17:32:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@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++) {
|
2018-12-31 17:32:38 +01:00
|
|
|
group.init(i, true, i * 18, 68);
|
2019-01-03 13:46:57 +01:00
|
|
|
group.set(i, Arrays.asList(recipe.ingredients[i].getMatchingStacks()));
|
2018-12-31 17:32:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|