TechReborn/1.11/jei/assemblingMachine/AssemblingMachineRecipeCategory.java

86 lines
2.5 KiB
Java
Raw Normal View History

2016-03-13 17:08:30 +01:00
package techreborn.compat.jei.assemblingMachine;
import mezz.jei.api.IGuiHelper;
2016-10-08 21:46:16 +02:00
import mezz.jei.api.gui.*;
2016-09-27 18:03:57 +02:00
import mezz.jei.api.ingredients.IIngredients;
2016-03-13 17:08:30 +01:00
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.translation.I18n;
2016-03-13 17:08:30 +01:00
import techreborn.client.gui.GuiAssemblingMachine;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
2016-10-08 21:46:16 +02:00
import javax.annotation.Nonnull;
public class AssemblingMachineRecipeCategory extends BlankRecipeCategory<AssemblingMachineRecipeWrapper> {
2016-03-25 10:47:34 +01:00
private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2 };
2016-03-13 17:08:30 +01:00
private final IDrawable background;
private final IDrawableAnimated electricity;
private final String title;
2016-10-08 21:46:16 +02:00
public AssemblingMachineRecipeCategory(IGuiHelper guiHelper) {
2016-03-13 17:08:30 +01:00
background = guiHelper.createDrawable(GuiAssemblingMachine.texture, 46, 16, 91, 54);
IDrawableStatic electricityDrawable = guiHelper.createDrawable(GuiAssemblingMachine.texture, 176, 0, 14, 14);
2016-03-25 10:47:34 +01:00
electricity = guiHelper.createAnimatedDrawable(electricityDrawable, 300, IDrawableAnimated.StartDirection.TOP,
2016-10-08 21:46:16 +02:00
true);
title = I18n.translateToLocal("tile.techreborn.assemblingmachine.name");
2016-03-13 17:08:30 +01:00
}
@Nonnull
@Override
2016-10-08 21:46:16 +02:00
public String getUid() {
2016-03-13 17:08:30 +01:00
return RecipeCategoryUids.ASSEMBLING_MACHINE;
}
@Nonnull
@Override
2016-10-08 21:46:16 +02:00
public String getTitle() {
2016-03-13 17:08:30 +01:00
return title;
}
@Nonnull
@Override
2016-10-08 21:46:16 +02:00
public IDrawable getBackground() {
2016-03-13 17:08:30 +01:00
return background;
}
@Override
2016-11-19 13:50:08 +01:00
public void drawExtras(
2016-10-08 21:46:16 +02:00
@Nonnull
Minecraft minecraft) {
2016-03-13 17:08:30 +01:00
electricity.draw(minecraft, 10, 20);
}
@Override
2016-10-08 21:46:16 +02:00
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
AssemblingMachineRecipeWrapper recipeWrapper) {
2016-03-13 17:08:30 +01:00
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18);
2016-09-27 18:03:57 +02:00
RecipeUtil.setRecipeItems(recipeLayout, recipeWrapper, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
@Override
2016-10-08 21:46:16 +02:00
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
AssemblingMachineRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
2016-09-27 18:03:57 +02:00
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
2016-03-13 17:08:30 +01:00
}
}