diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-01-05 22:14:37 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-01-05 22:14:37 +0800 |
| commit | 63fdcc76da7e2d7cbd79d327c6dd72404708f64f (patch) | |
| tree | 7d95f69850beb2935856253db1d8515493717d1a /src/main/java/me/shedaniel/gui/RecipeGui.java | |
| parent | 418ee1e13fb66ef30c9473e0069695d89967124f (diff) | |
| download | RoughlyEnoughItems-63fdcc76da7e2d7cbd79d327c6dd72404708f64f.tar.gz RoughlyEnoughItems-63fdcc76da7e2d7cbd79d327c6dd72404708f64f.tar.bz2 RoughlyEnoughItems-63fdcc76da7e2d7cbd79d327c6dd72404708f64f.zip | |
Buggy Autocrafting
Diffstat (limited to 'src/main/java/me/shedaniel/gui/RecipeGui.java')
| -rwxr-xr-x | src/main/java/me/shedaniel/gui/RecipeGui.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/me/shedaniel/gui/RecipeGui.java b/src/main/java/me/shedaniel/gui/RecipeGui.java index cf2c87572..7f655c23f 100755 --- a/src/main/java/me/shedaniel/gui/RecipeGui.java +++ b/src/main/java/me/shedaniel/gui/RecipeGui.java @@ -1,6 +1,7 @@ package me.shedaniel.gui; import com.mojang.blaze3d.platform.GlStateManager; +import me.shedaniel.api.DisplayCategoryCraftable; import me.shedaniel.api.IDisplayCategory; import me.shedaniel.api.IRecipe; import me.shedaniel.gui.widget.Button; @@ -53,6 +54,10 @@ public class RecipeGui extends ContainerGui { setupCategories(); } + public Gui getPrevScreen() { + return prevScreen; + } + private void setupCategories() { for(IDisplayCategory adapter : REIRecipeManager.instance().getDisplayAdapters()) if (recipes.containsKey(adapter)) @@ -101,9 +106,7 @@ public class RecipeGui extends ContainerGui { } private void updateRecipe() { - int categoryPointer = categories.indexOf(selectedCategory); - - IRecipe recipe = recipes.get(categories.get(categoryPointer)).get(recipePointer); + IRecipe recipe = recipes.get(selectedCategory).get(recipePointer); selectedCategory.resetRecipes(); selectedCategory.addRecipe(recipe); slots = selectedCategory.setupDisplay(0); @@ -161,9 +164,14 @@ public class RecipeGui extends ContainerGui { controls.add(btnRecipeRight); List<Control> newControls = new LinkedList<>(); - categories.get(categoryPointer).addWidget(newControls, 0); - if (recipes.get(categories.get(categoryPointer)).size() >= recipePointer + 2) - categories.get(categoryPointer).addWidget(newControls, 1); + selectedCategory.addWidget(newControls, 0); + if (selectedCategory instanceof DisplayCategoryCraftable) + ((DisplayCategoryCraftable) selectedCategory).registerAutoCraftButton(newControls, this, getPrevScreen(), recipe, 0); + if (recipes.get(selectedCategory).size() >= recipePointer + 2) { + selectedCategory.addWidget(newControls, 1); + if (selectedCategory instanceof DisplayCategoryCraftable) + ((DisplayCategoryCraftable) selectedCategory).registerAutoCraftButton(newControls, this, getPrevScreen(), recipes.get(selectedCategory).get(recipePointer + 1), 1); + } newControls.forEach(f -> f.move(left, top)); controls.addAll(newControls); |
