update Implosion Compressor to GuiBase
This commit is contained in:
parent
aa2df32222
commit
e4b5d3378a
4 changed files with 116 additions and 59 deletions
|
@ -29,6 +29,8 @@ import mezz.jei.api.gui.*;
|
|||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import techreborn.client.gui.GuiImplosionCompressor;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
|
@ -38,18 +40,15 @@ import techreborn.lib.ModInfo;
|
|||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory<ImplosionCompressorRecipeWrapper> {
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/jei.png");
|
||||
private static final int[] INPUT_SLOTS = { 0, 1 };
|
||||
private static final int[] OUTPUT_SLOTS = { 2, 3 };
|
||||
|
||||
private final IDrawable background;
|
||||
private final IDrawable electricity;
|
||||
private final String title;
|
||||
|
||||
public ImplosionCompressorRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createDrawable(GuiImplosionCompressor.texture, 16, 25, 116, 36);
|
||||
IDrawableStatic electricityDrawable = guiHelper.createDrawable(GuiImplosionCompressor.texture, 176, 0, 14, 14);
|
||||
electricity = guiHelper.createAnimatedDrawable(electricityDrawable, 300, IDrawableAnimated.StartDirection.TOP,
|
||||
true);
|
||||
background = guiHelper.createDrawable(texture, 0, 95, 120, 42);
|
||||
title = I18n.translateToLocal("tile.techreborn:implosion_compressor.name");
|
||||
}
|
||||
|
||||
|
@ -76,12 +75,6 @@ public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory<Implo
|
|||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
super.drawExtras(minecraft);
|
||||
electricity.draw(minecraft, 0, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(
|
||||
@Nonnull
|
||||
|
@ -91,11 +84,11 @@ public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory<Implo
|
|||
@Nonnull
|
||||
IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
guiItemStacks.init(INPUT_SLOTS[0], true, 20, 0);
|
||||
guiItemStacks.init(INPUT_SLOTS[1], true, 20, 18);
|
||||
guiItemStacks.init(INPUT_SLOTS[0], true, 21, 2);
|
||||
guiItemStacks.init(INPUT_SLOTS[1], true, 21, 22);
|
||||
|
||||
guiItemStacks.init(OUTPUT_SLOTS[0], false, 76, 9);
|
||||
guiItemStacks.init(OUTPUT_SLOTS[1], false, 94, 9);
|
||||
guiItemStacks.init(OUTPUT_SLOTS[0], false, 63, 11);
|
||||
guiItemStacks.init(OUTPUT_SLOTS[1], false, 81, 11);
|
||||
|
||||
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import mezz.jei.api.gui.IDrawableStatic;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import techreborn.api.recipe.machines.ImplosionCompressorRecipe;
|
||||
import techreborn.client.gui.GuiImplosionCompressor;
|
||||
import techreborn.client.gui.TRBuilder;
|
||||
import techreborn.compat.jei.BaseRecipeWrapper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -45,7 +46,7 @@ public class ImplosionCompressorRecipeWrapper extends BaseRecipeWrapper<Implosio
|
|||
ImplosionCompressorRecipe baseRecipe) {
|
||||
super(baseRecipe);
|
||||
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
|
||||
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiImplosionCompressor.texture, 176, 14, 21, 11);
|
||||
IDrawableStatic progressStatic = guiHelper.createDrawable(TRBuilder.GUI_SHEET, 100, 151, 16, 10);
|
||||
this.progress = guiHelper.createAnimatedDrawable(progressStatic, baseRecipe.tickTime(),
|
||||
IDrawableAnimated.StartDirection.LEFT, false);
|
||||
}
|
||||
|
@ -53,10 +54,10 @@ public class ImplosionCompressorRecipeWrapper extends BaseRecipeWrapper<Implosio
|
|||
@Override
|
||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||
progress.draw(minecraft, 44, 13);
|
||||
progress.draw(minecraft, 43, 16);
|
||||
|
||||
int x = -45;
|
||||
int y = 4;
|
||||
int x = -35;
|
||||
int y = 13;
|
||||
int lineHeight = minecraft.fontRenderer.FONT_HEIGHT;
|
||||
|
||||
minecraft.fontRenderer.drawString("Time: " + baseRecipe.tickTime / 20 + " s", x, y, 0x444444);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue