GUI update for assembly machine. Some work for #1512
This commit is contained in:
parent
7bc792fd69
commit
ed9cdc7353
7 changed files with 40 additions and 157 deletions
|
@ -332,11 +332,11 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
addRecipeClickArea(GuiFusionReactor.class, 150, 4, 18, 18, RecipeCategoryUids.FUSION_REACTOR);
|
||||
addRecipeClickArea(GuiRollingMachine.class, 150, 4, 20, 12, RecipeCategoryUids.ROLLING_MACHINE);
|
||||
addRecipeClickArea(GuiFluidReplicator.class, 150, 4, 20, 12, RecipeCategoryUids.FLUID_REPLICATOR);
|
||||
addRecipeClickArea(GuiAssemblingMachine.class, 150, 4, 20, 12, RecipeCategoryUids.ASSEMBLING_MACHINE);
|
||||
|
||||
//OLD ONES
|
||||
addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER,
|
||||
VanillaRecipeCategoryUid.FUEL);
|
||||
addRecipeClickArea(GuiAssemblingMachine.class, 85, 34, 24, 20, RecipeCategoryUids.ASSEMBLING_MACHINE);
|
||||
addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING,
|
||||
VanillaRecipeCategoryUid.FUEL);
|
||||
|
||||
|
|
|
@ -28,9 +28,8 @@ import mezz.jei.api.IGuiHelper;
|
|||
import mezz.jei.api.gui.*;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import techreborn.client.gui.GuiAssemblingMachine;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
import techreborn.compat.jei.RecipeUtil;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
@ -39,18 +38,16 @@ import javax.annotation.Nonnull;
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AssemblingMachineRecipeCategory implements IRecipeCategory<AssemblingMachineRecipeWrapper> {
|
||||
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 };
|
||||
|
||||
private final IDrawable background;
|
||||
private final IDrawableAnimated electricity;
|
||||
private final String title;
|
||||
|
||||
public AssemblingMachineRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createDrawable(GuiAssemblingMachine.texture, 46, 16, 91, 54);
|
||||
IDrawableStatic electricityDrawable = guiHelper.createDrawable(GuiAssemblingMachine.texture, 176, 0, 14, 14);
|
||||
electricity = guiHelper.createAnimatedDrawable(electricityDrawable, 300, IDrawableAnimated.StartDirection.TOP,
|
||||
true);
|
||||
// TO-DO add texture to JEI
|
||||
background = guiHelper.createDrawable(texture, 0, 94, 120, 78);
|
||||
title = I18n.translateToLocal("tile.techreborn.assemblingmachine.name");
|
||||
}
|
||||
|
||||
|
@ -78,21 +75,10 @@ public class AssemblingMachineRecipeCategory implements IRecipeCategory<Assembli
|
|||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(
|
||||
@Nonnull
|
||||
Minecraft minecraft) {
|
||||
electricity.draw(minecraft, 10, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(
|
||||
@Nonnull
|
||||
IRecipeLayout recipeLayout,
|
||||
@Nonnull
|
||||
AssemblingMachineRecipeWrapper recipeWrapper,
|
||||
@Nonnull
|
||||
IIngredients ingredients) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull AssemblingMachineRecipeWrapper recipeWrapper,
|
||||
@Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
// TODO: fix slots
|
||||
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
|
||||
guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0);
|
||||
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18);
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.compat.jei.assemblingMachine;
|
||||
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import techreborn.api.recipe.machines.AssemblingMachineRecipe;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AssemblingMachineRecipeHandler implements IRecipeHandler<AssemblingMachineRecipe> {
|
||||
@Nonnull
|
||||
private final IJeiHelpers jeiHelpers;
|
||||
|
||||
public AssemblingMachineRecipeHandler(
|
||||
@Nonnull
|
||||
IJeiHelpers jeiHelpers) {
|
||||
this.jeiHelpers = jeiHelpers;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<AssemblingMachineRecipe> getRecipeClass() {
|
||||
return AssemblingMachineRecipe.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(
|
||||
@Nonnull
|
||||
AssemblingMachineRecipe recipe) {
|
||||
return RecipeCategoryUids.ASSEMBLING_MACHINE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(
|
||||
@Nonnull
|
||||
AssemblingMachineRecipe recipe) {
|
||||
return new AssemblingMachineRecipeWrapper(jeiHelpers, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(
|
||||
@Nonnull
|
||||
AssemblingMachineRecipe recipe) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -30,7 +30,7 @@ import mezz.jei.api.gui.IDrawableAnimated;
|
|||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import techreborn.api.recipe.machines.AssemblingMachineRecipe;
|
||||
import techreborn.client.gui.GuiAssemblingMachine;
|
||||
import techreborn.client.gui.TRBuilder;
|
||||
import techreborn.compat.jei.BaseRecipeWrapper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -38,21 +38,17 @@ import javax.annotation.Nonnull;
|
|||
public class AssemblingMachineRecipeWrapper extends BaseRecipeWrapper<AssemblingMachineRecipe> {
|
||||
private final IDrawableAnimated progress;
|
||||
|
||||
public AssemblingMachineRecipeWrapper(
|
||||
@Nonnull
|
||||
IJeiHelpers jeiHelpers,
|
||||
@Nonnull
|
||||
AssemblingMachineRecipe baseRecipe) {
|
||||
public AssemblingMachineRecipeWrapper(@Nonnull IJeiHelpers jeiHelpers, @Nonnull AssemblingMachineRecipe baseRecipe) {
|
||||
super(baseRecipe);
|
||||
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
|
||||
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiAssemblingMachine.texture, 176, 14, 20, 18);
|
||||
IDrawableStatic progressStatic = guiHelper.createDrawable(TRBuilder.GUI_SHEET, 100, 151, 16, 10);
|
||||
this.progress = guiHelper.createAnimatedDrawable(progressStatic, baseRecipe.tickTime(),
|
||||
IDrawableAnimated.StartDirection.LEFT, false);
|
||||
IDrawableAnimated.StartDirection.LEFT, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||
progress.draw(minecraft, 40, 18);
|
||||
progress.draw(minecraft, 25, 11);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue