From de2601e9808c56a3e9ad3dc01cc711291a802c77 Mon Sep 17 00:00:00 2001 From: mezz Date: Sun, 22 Nov 2015 17:09:21 -0800 Subject: [PATCH] Rename RecipeGui to RecipeWidget --- .../gui/{RecipeGui.java => RecipeWidget.java} | 4 +-- src/main/java/mezz/jei/gui/RecipesGui.java | 36 +++++++++---------- 2 files changed, 19 insertions(+), 21 deletions(-) rename src/main/java/mezz/jei/gui/{RecipeGui.java => RecipeWidget.java} (90%) diff --git a/src/main/java/mezz/jei/gui/RecipeGui.java b/src/main/java/mezz/jei/gui/RecipeWidget.java similarity index 90% rename from src/main/java/mezz/jei/gui/RecipeGui.java rename to src/main/java/mezz/jei/gui/RecipeWidget.java index 66e4b41e8..f8ff71b02 100644 --- a/src/main/java/mezz/jei/gui/RecipeGui.java +++ b/src/main/java/mezz/jei/gui/RecipeWidget.java @@ -11,7 +11,7 @@ import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; -public class RecipeGui { +public class RecipeWidget { @Nonnull private final IRecipeCategory recipeCategory; @@ -21,7 +21,7 @@ public class RecipeGui { private int posX; private int posY; - public RecipeGui(@Nonnull IRecipeCategory recipeCategory) { + public RecipeWidget(@Nonnull IRecipeCategory recipeCategory) { this.recipeCategory = recipeCategory; this.guiItemStacks = new GuiItemStacks(); this.recipeCategory.init(guiItemStacks); diff --git a/src/main/java/mezz/jei/gui/RecipesGui.java b/src/main/java/mezz/jei/gui/RecipesGui.java index 5333cd034..b6e644591 100644 --- a/src/main/java/mezz/jei/gui/RecipesGui.java +++ b/src/main/java/mezz/jei/gui/RecipesGui.java @@ -15,8 +15,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; @@ -54,9 +52,9 @@ private enum Mode { @Nonnull private ImmutableList recipeCategories = ImmutableList.of(); - /* List of RecipeGui to display */ + /* List of RecipeWidget to display */ @Nonnull - private final List recipeGuis = new ArrayList(); + private final List recipeWidgets = new ArrayList(); /* List of recipes for the currently selected recipeClass */ @Nonnull @@ -117,7 +115,7 @@ public void initGui(@Nonnull Minecraft minecraft) { addButtons(); // on screen resize - if (recipeGuis.size() > 0) { + if (recipeWidgets.size() > 0) { resetLayout(); } } @@ -135,7 +133,7 @@ public void setWorldAndResolution(Minecraft mc, int width, int height) { } private void resetLayout() { - recipeGuis.clear(); + recipeWidgets.clear(); pageIndex = 0; updateLayout(); } @@ -154,8 +152,8 @@ public ItemStack getStackUnderMouse(int mouseX, int mouseY) { if (!isOpen) { return null; } - for (RecipeGui recipeGui : recipeGuis) { - ItemStack stack = recipeGui.getStackUnderMouse(mouseX, mouseY); + for (RecipeWidget recipeWidget : recipeWidgets) { + ItemStack stack = recipeWidget.getStackUnderMouse(mouseX, mouseY); if (stack != null) { return stack; } @@ -324,8 +322,8 @@ private void updateLayout() { final int posX = guiLeft + recipeXOffset; int posY = guiTop + headerHeight + recipeSpacing; - recipeGuis.clear(); - for (int recipeIndex = pageIndex * recipesPerPage; recipeIndex < recipes.size() && recipeGuis.size() < recipesPerPage; recipeIndex++) { + recipeWidgets.clear(); + for (int recipeIndex = pageIndex * recipesPerPage; recipeIndex < recipes.size() && recipeWidgets.size() < recipesPerPage; recipeIndex++) { Object recipe = recipes.get(recipeIndex); IRecipeHandler recipeHandler = JEIManager.recipeRegistry.getRecipeHandler(recipe.getClass()); if (recipeHandler == null) { @@ -333,13 +331,13 @@ private void updateLayout() { continue; } - RecipeGui recipeGui = new RecipeGui(recipeCategory); - recipeGui.setPosition(posX, posY); + RecipeWidget recipeWidget = new RecipeWidget(recipeCategory); + recipeWidget.setPosition(posX, posY); posY += recipeBackground.getHeight() + recipeSpacing; IRecipeWrapper recipeWrapper = recipeHandler.getRecipeWrapper(recipe); - recipeGui.setRecipe(recipeWrapper, focusStack); - recipeGuis.add(recipeGui); + recipeWidget.setRecipe(recipeWrapper, focusStack); + recipeWidgets.add(recipeWidget); } nextPage.enabled = previousPage.enabled = (pageCount() > 1); @@ -367,12 +365,12 @@ public void draw(int mouseX, int mouseY) { } GL11.glPopMatrix(); - RecipeGui hovered = null; - for (RecipeGui recipeGui : recipeGuis) { - if (recipeGui.getStackUnderMouse(mouseX, mouseY) != null) { - hovered = recipeGui; + RecipeWidget hovered = null; + for (RecipeWidget recipeWidget : recipeWidgets) { + if (recipeWidget.getStackUnderMouse(mouseX, mouseY) != null) { + hovered = recipeWidget; } else { - recipeGui.draw(minecraft, mouseX, mouseY); + recipeWidget.draw(minecraft, mouseX, mouseY); } } if (hovered != null) {