Display progress bar on JEI recipes for the Solderer

This commit is contained in:
raoulvdberge
2017-04-22 12:32:50 +02:00
parent e2ce330397
commit 032071a44c
6 changed files with 36 additions and 5 deletions

View File

@@ -14,6 +14,7 @@
- Fixed Grid crash (raoulvdberge) - Fixed Grid crash (raoulvdberge)
- Fixed Fluid Grid not formatting large quantities correctly (raoulvdberge) - Fixed Fluid Grid not formatting large quantities correctly (raoulvdberge)
- Small performance improvement: only sort the storages when needed (raoulvdberge) - Small performance improvement: only sort the storages when needed (raoulvdberge)
- Display progress bar on JEI recipes for the Solderer (raoulvdberge)
### 1.4.2 ### 1.4.2
- Updated Forge to 2261 (raoulvdberge) - Updated Forge to 2261 (raoulvdberge)

View File

@@ -1,5 +1,8 @@
package com.raoulvdberge.refinedstorage.api.storage; package com.raoulvdberge.refinedstorage.api.storage;
/**
* The storage disk type.
*/
public enum StorageDiskType { public enum StorageDiskType {
ITEMS, ITEMS,
FLUIDS FLUIDS

View File

@@ -27,7 +27,7 @@ public class RSJEIPlugin extends BlankModPlugin {
registry.handleRecipes(RecipeWrapperSolderer.class, recipe -> recipe, RecipeCategorySolderer.ID); registry.handleRecipes(RecipeWrapperSolderer.class, recipe -> recipe, RecipeCategorySolderer.ID);
registry.addRecipes(RecipeMakerSolderer.getRecipes(), RecipeCategorySolderer.ID); registry.addRecipes(RecipeMakerSolderer.getRecipes(registry.getJeiHelpers().getGuiHelper()), RecipeCategorySolderer.ID);
registry.addRecipeCategoryCraftingItem(new ItemStack(RSBlocks.SOLDERER), RecipeCategorySolderer.ID); registry.addRecipeCategoryCraftingItem(new ItemStack(RSBlocks.SOLDERER), RecipeCategorySolderer.ID);

View File

@@ -18,7 +18,7 @@ public class RecipeCategorySolderer extends BlankRecipeCategory<RecipeWrapperSol
private IDrawable background; private IDrawable background;
public RecipeCategorySolderer(IGuiHelper helper) { public RecipeCategorySolderer(IGuiHelper helper) {
background = helper.createDrawable(new ResourceLocation("refinedstorage", "textures/gui/solderer.png"), 43, 19, 101, 54); this.background = helper.createDrawable(new ResourceLocation("refinedstorage", "textures/gui/solderer.png"), 43, 19, 101, 54);
} }
@Override @Override

View File

@@ -2,13 +2,14 @@ package com.raoulvdberge.refinedstorage.integration.jei;
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe; import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
import com.raoulvdberge.refinedstorage.apiimpl.API; import com.raoulvdberge.refinedstorage.apiimpl.API;
import mezz.jei.api.IGuiHelper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public final class RecipeMakerSolderer { public final class RecipeMakerSolderer {
public static List<RecipeWrapperSolderer> getRecipes() { public static List<RecipeWrapperSolderer> getRecipes(IGuiHelper guiHelper) {
List<RecipeWrapperSolderer> recipes = new ArrayList<>(); List<RecipeWrapperSolderer> recipes = new ArrayList<>();
for (ISoldererRecipe recipe : API.instance().getSoldererRegistry().getRecipes()) { for (ISoldererRecipe recipe : API.instance().getSoldererRegistry().getRecipes()) {
@@ -20,7 +21,7 @@ public final class RecipeMakerSolderer {
ItemStack output = recipe.getResult(); ItemStack output = recipe.getResult();
recipes.add(new RecipeWrapperSolderer(inputs, output)); recipes.add(new RecipeWrapperSolderer(guiHelper, recipe.getDuration(), inputs, output));
} }
return recipes; return recipes;

View File

@@ -1,16 +1,35 @@
package com.raoulvdberge.refinedstorage.integration.jei; package com.raoulvdberge.refinedstorage.integration.jei;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import java.util.List; import java.util.List;
public class RecipeWrapperSolderer extends BlankRecipeWrapper { public class RecipeWrapperSolderer extends BlankRecipeWrapper {
private IDrawableAnimated progress;
private List<ItemStack> inputs; private List<ItemStack> inputs;
private ItemStack output; private ItemStack output;
public RecipeWrapperSolderer(List<ItemStack> inputs, ItemStack output) { public RecipeWrapperSolderer(IGuiHelper guiHelper, int duration, List<ItemStack> inputs, ItemStack output) {
this.progress = guiHelper.createAnimatedDrawable(
guiHelper.createDrawable(
new ResourceLocation("refinedstorage", "textures/gui/solderer.png"),
212,
0,
22,
15
),
duration,
IDrawableAnimated.StartDirection.LEFT,
false
);
this.inputs = inputs; this.inputs = inputs;
this.output = output; this.output = output;
} }
@@ -38,6 +57,13 @@ public class RecipeWrapperSolderer extends BlankRecipeWrapper {
return ItemStack.areItemStacksEqual(output, other.output); return ItemStack.areItemStacksEqual(output, other.output);
} }
@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);
}
@Override @Override
public String toString() { public String toString() {
return inputs + " = " + output; return inputs + " = " + output;