|
@@ -1,20 +1,19 @@
|
|
|
-package me.shedaniel.rei.gui.widget;
|
|
|
+package me.shedaniel.rei.gui;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.mojang.blaze3d.platform.GlStateManager;
|
|
|
-import me.shedaniel.rei.api.IRecipeCategory;
|
|
|
-import me.shedaniel.rei.api.IRecipeDisplay;
|
|
|
-import me.shedaniel.rei.api.SpeedCraftAreaSupplier;
|
|
|
-import me.shedaniel.rei.api.SpeedCraftFunctional;
|
|
|
+import me.shedaniel.rei.RoughlyEnoughItemsCore;
|
|
|
+import me.shedaniel.rei.api.*;
|
|
|
import me.shedaniel.rei.client.ClientHelper;
|
|
|
import me.shedaniel.rei.client.GuiHelper;
|
|
|
-import me.shedaniel.rei.client.RecipeHelper;
|
|
|
+import me.shedaniel.rei.gui.widget.*;
|
|
|
import net.minecraft.client.MinecraftClient;
|
|
|
import net.minecraft.client.audio.PositionedSoundInstance;
|
|
|
import net.minecraft.client.gui.ContainerScreen;
|
|
|
-import net.minecraft.client.gui.GuiEventListener;
|
|
|
+import net.minecraft.client.gui.InputListener;
|
|
|
import net.minecraft.client.gui.Screen;
|
|
|
import net.minecraft.client.render.GuiLighting;
|
|
|
+import net.minecraft.client.resource.language.I18n;
|
|
|
import net.minecraft.client.util.Window;
|
|
|
import net.minecraft.sound.SoundEvents;
|
|
|
import net.minecraft.text.TranslatableTextComponent;
|
|
@@ -22,18 +21,21 @@ import net.minecraft.util.Identifier;
|
|
|
import net.minecraft.util.math.MathHelper;
|
|
|
|
|
|
import java.awt.*;
|
|
|
-import java.util.ArrayList;
|
|
|
+import java.util.*;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
|
-public class RecipeViewingWidgetScreen extends Screen {
|
|
|
+public class RecipeViewingScreen extends Screen {
|
|
|
|
|
|
public static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png");
|
|
|
+ public static final Color SUB_COLOR = new Color(159, 159, 159);
|
|
|
private static final Identifier CREATIVE_INVENTORY_TABS = new Identifier("textures/gui/container/creative_inventory/tabs.png");
|
|
|
- public final int guiWidth = 176;
|
|
|
- public final int guiHeight = 186;
|
|
|
-
|
|
|
+ public int guiWidth;
|
|
|
+ public int guiHeight;
|
|
|
+ public int page, categoryPages;
|
|
|
+ public int largestWidth, largestHeight;
|
|
|
+ public boolean choosePageActivated;
|
|
|
+ public RecipeChoosePageWidget recipeChoosePageWidget;
|
|
|
private List<IWidget> widgets;
|
|
|
private List<TabWidget> tabs;
|
|
|
private Window window;
|
|
@@ -41,26 +43,26 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
private Map<IRecipeCategory, List<IRecipeDisplay>> categoriesMap;
|
|
|
private List<IRecipeCategory> categories;
|
|
|
private IRecipeCategory selectedCategory;
|
|
|
- private int page, categoryPages;
|
|
|
private ButtonWidget recipeBack, recipeNext, categoryBack, categoryNext;
|
|
|
|
|
|
- public RecipeViewingWidgetScreen(Window window, Map<IRecipeCategory, List<IRecipeDisplay>> categoriesMap) {
|
|
|
+ public RecipeViewingScreen(Window window, Map<IRecipeCategory, List<IRecipeDisplay>> categoriesMap) {
|
|
|
this.categoryPages = 0;
|
|
|
this.window = window;
|
|
|
this.widgets = Lists.newArrayList();
|
|
|
- this.bounds = new Rectangle(window.getScaledWidth() / 2 - guiWidth / 2, window.getScaledHeight() / 2 - guiHeight / 2, guiWidth, guiHeight);
|
|
|
+ this.bounds = new Rectangle(window.getScaledWidth() / 2 - guiWidth / 2, window.getScaledHeight() / 2 - guiHeight / 2, 176, 186);
|
|
|
this.categoriesMap = categoriesMap;
|
|
|
this.categories = Lists.newArrayList();
|
|
|
- RecipeHelper.getInstance().getCategories().forEach(category -> {
|
|
|
+ IRecipeHelper.getInstance().getAllCategories().forEach(category -> {
|
|
|
if (categoriesMap.containsKey(category))
|
|
|
categories.add(category);
|
|
|
});
|
|
|
this.selectedCategory = categories.get(0);
|
|
|
this.tabs = new ArrayList<>();
|
|
|
+ this.choosePageActivated = false;
|
|
|
}
|
|
|
|
|
|
public static SpeedCraftFunctional getSpeedCraftFunctionalByCategory(ContainerScreen containerScreen, IRecipeCategory category) {
|
|
|
- for(SpeedCraftFunctional functional : RecipeHelper.getInstance().getSpeedCraftFunctional(category))
|
|
|
+ for(SpeedCraftFunctional functional : IRecipeHelper.getInstance().getSpeedCraftFunctional(category))
|
|
|
for(Class aClass : functional.getFunctioningFor())
|
|
|
if (containerScreen.getClass().isAssignableFrom(aClass))
|
|
|
return functional;
|
|
@@ -74,7 +76,12 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
GuiHelper.getLastOverlay().onInitialized();
|
|
|
return true;
|
|
|
}
|
|
|
- for(GuiEventListener listener : listeners)
|
|
|
+ if (choosePageActivated) {
|
|
|
+ if (recipeChoosePageWidget.keyPressed(int_1, int_2, int_3))
|
|
|
+ return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for(InputListener listener : listeners)
|
|
|
if (listener.keyPressed(int_1, int_2, int_3))
|
|
|
return true;
|
|
|
return super.keyPressed(int_1, int_2, int_3);
|
|
@@ -86,11 +93,16 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- protected void onInitialized() {
|
|
|
+ public void onInitialized() {
|
|
|
super.onInitialized();
|
|
|
this.tabs.clear();
|
|
|
this.widgets.clear();
|
|
|
+ this.largestWidth = window.getScaledWidth() - 100;
|
|
|
+ this.largestHeight = window.getScaledHeight() - 40;
|
|
|
+ this.guiWidth = MathHelper.clamp(getCurrentDisplayed().stream().map(display -> selectedCategory.getDisplayWidth(display)).max(Integer::compareTo).orElse(150) + 30, 0, largestWidth);
|
|
|
+ this.guiHeight = MathHelper.floor(MathHelper.clamp((selectedCategory.getDisplayHeight() + 7) * (getRecipesPerPage() + 1) + 40f, 186f, (float) largestHeight));
|
|
|
this.bounds = new Rectangle(window.getScaledWidth() / 2 - guiWidth / 2, window.getScaledHeight() / 2 - guiHeight / 2, guiWidth, guiHeight);
|
|
|
+ this.page = MathHelper.clamp(page, 0, getTotalPages(selectedCategory) - 1);
|
|
|
|
|
|
widgets.add(categoryBack = new ButtonWidget((int) bounds.getX() + 5, (int) bounds.getY() + 5, 12, 12, new TranslatableTextComponent("text.rei.left_arrow")) {
|
|
|
@Override
|
|
@@ -101,10 +113,10 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
currentCategoryIndex = categories.size() - 1;
|
|
|
selectedCategory = categories.get(currentCategoryIndex);
|
|
|
categoryPages = MathHelper.floor(currentCategoryIndex / 6d);
|
|
|
- RecipeViewingWidgetScreen.this.onInitialized();
|
|
|
+ RecipeViewingScreen.this.onInitialized();
|
|
|
}
|
|
|
});
|
|
|
- widgets.add(categoryNext = new ButtonWidget((int) bounds.getX() + 159, (int) bounds.getY() + 5, 12, 12, new TranslatableTextComponent("text.rei.right_arrow")) {
|
|
|
+ widgets.add(categoryNext = new ButtonWidget((int) bounds.getMaxX() - 17, (int) bounds.getY() + 5, 12, 12, new TranslatableTextComponent("text.rei.right_arrow")) {
|
|
|
@Override
|
|
|
public void onPressed(int button, double mouseX, double mouseY) {
|
|
|
int currentCategoryIndex = categories.indexOf(selectedCategory);
|
|
@@ -113,7 +125,7 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
currentCategoryIndex = 0;
|
|
|
selectedCategory = categories.get(currentCategoryIndex);
|
|
|
categoryPages = MathHelper.floor(currentCategoryIndex / 6d);
|
|
|
- RecipeViewingWidgetScreen.this.onInitialized();
|
|
|
+ RecipeViewingScreen.this.onInitialized();
|
|
|
}
|
|
|
});
|
|
|
categoryBack.enabled = categories.size() > 1;
|
|
@@ -125,33 +137,50 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
page--;
|
|
|
if (page < 0)
|
|
|
page = getTotalPages(selectedCategory) - 1;
|
|
|
- RecipeViewingWidgetScreen.this.onInitialized();
|
|
|
+ RecipeViewingScreen.this.onInitialized();
|
|
|
}
|
|
|
});
|
|
|
- widgets.add(recipeNext = new ButtonWidget((int) bounds.getX() + 159, (int) bounds.getY() + 21, 12, 12, new TranslatableTextComponent("text.rei.right_arrow")) {
|
|
|
+ widgets.add(recipeNext = new ButtonWidget((int) bounds.getMaxX() - 17, (int) bounds.getY() + 21, 12, 12, new TranslatableTextComponent("text.rei.right_arrow")) {
|
|
|
@Override
|
|
|
public void onPressed(int button, double mouseX, double mouseY) {
|
|
|
page++;
|
|
|
if (page >= getTotalPages(selectedCategory))
|
|
|
page = 0;
|
|
|
- RecipeViewingWidgetScreen.this.onInitialized();
|
|
|
+ RecipeViewingScreen.this.onInitialized();
|
|
|
}
|
|
|
});
|
|
|
recipeBack.enabled = categoriesMap.get(selectedCategory).size() > getRecipesPerPage();
|
|
|
recipeNext.enabled = categoriesMap.get(selectedCategory).size() > getRecipesPerPage();
|
|
|
|
|
|
- widgets.add(new LabelWidget((int) bounds.getCenterX(), (int) bounds.getY() + 7, "") {
|
|
|
+ widgets.add(new ClickableLabelWidget((int) bounds.getCenterX(), (int) bounds.getY() + 7, "") {
|
|
|
@Override
|
|
|
public void draw(int mouseX, int mouseY, float partialTicks) {
|
|
|
this.text = selectedCategory.getCategoryName();
|
|
|
super.draw(mouseX, mouseY, partialTicks);
|
|
|
+ if (isHighlighted(mouseX, mouseY))
|
|
|
+ GuiHelper.getLastOverlay().addTooltip(new QueuedTooltip(new Point(mouseX, mouseY), Arrays.asList(I18n.translate("text.rei.view_all_categories").split("\n"))));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onLabelClicked() {
|
|
|
+ MinecraftClient.getInstance().getSoundLoader().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
|
|
+ ClientHelper.executeViewAllRecipesKeyBind(GuiHelper.getLastOverlay());
|
|
|
}
|
|
|
});
|
|
|
- widgets.add(new LabelWidget((int) bounds.getCenterX(), (int) bounds.getY() + 23, "") {
|
|
|
+ widgets.add(new ClickableLabelWidget((int) bounds.getCenterX(), (int) bounds.getY() + 23, "") {
|
|
|
@Override
|
|
|
public void draw(int mouseX, int mouseY, float partialTicks) {
|
|
|
this.text = String.format("%d/%d", page + 1, getTotalPages(selectedCategory));
|
|
|
super.draw(mouseX, mouseY, partialTicks);
|
|
|
+ if (isHighlighted(mouseX, mouseY))
|
|
|
+ GuiHelper.getLastOverlay().addTooltip(new QueuedTooltip(new Point(mouseX, mouseY), Arrays.asList(I18n.translate("text.rei.choose_page").split("\n"))));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onLabelClicked() {
|
|
|
+ MinecraftClient.getInstance().getSoundLoader().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
|
|
+ RecipeViewingScreen.this.choosePageActivated = true;
|
|
|
+ RecipeViewingScreen.this.onInitialized();
|
|
|
}
|
|
|
});
|
|
|
for(int i = 0; i < 6; i++) {
|
|
@@ -167,7 +196,7 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
return false;
|
|
|
selectedCategory = categories.get(getId() + categoryPages * 6);
|
|
|
page = 0;
|
|
|
- RecipeViewingWidgetScreen.this.onInitialized();
|
|
|
+ RecipeViewingScreen.this.onInitialized();
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
@@ -176,33 +205,45 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
tab.setItem(categories.get(j).getCategoryIcon(), categories.get(j).getCategoryName(), tab.getId() + categoryPages * 6 == categories.indexOf(selectedCategory));
|
|
|
}
|
|
|
}
|
|
|
- SpeedCraftAreaSupplier supplier = RecipeHelper.getInstance().getSpeedCraftButtonArea(selectedCategory);
|
|
|
+ Optional<SpeedCraftAreaSupplier> supplier = IRecipeHelper.getInstance().getSpeedCraftButtonArea(selectedCategory);
|
|
|
final SpeedCraftFunctional functional = getSpeedCraftFunctionalByCategory(GuiHelper.getLastContainerScreen(), selectedCategory);
|
|
|
- if (page * getRecipesPerPage() < categoriesMap.get(selectedCategory).size()) {
|
|
|
- final Supplier<IRecipeDisplay> topDisplaySupplier = () -> {
|
|
|
- return categoriesMap.get(selectedCategory).get(page * getRecipesPerPage());
|
|
|
+ int recipeHeight = selectedCategory.getDisplayHeight();
|
|
|
+ List<IRecipeDisplay> currentDisplayed = getCurrentDisplayed();
|
|
|
+ for(int i = 0; i < currentDisplayed.size(); i++) {
|
|
|
+ int finalI = i;
|
|
|
+ final Supplier<IRecipeDisplay> displaySupplier = () -> {
|
|
|
+ return currentDisplayed.get(finalI);
|
|
|
};
|
|
|
- final Rectangle topBounds = new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 40, 150, selectedCategory.usesFullPage() ? 140 : 66);
|
|
|
- widgets.addAll(selectedCategory.setupDisplay(topDisplaySupplier, topBounds));
|
|
|
- if (supplier != null)
|
|
|
- widgets.add(new SpeedCraftingButtonWidget(supplier.get(topBounds), supplier.getButtonText(), functional, topDisplaySupplier));
|
|
|
- if (!selectedCategory.usesFullPage() && page * getRecipesPerPage() + 1 < categoriesMap.get(selectedCategory).size()) {
|
|
|
- final Supplier<IRecipeDisplay> middleDisplaySupplier = () -> {
|
|
|
- return categoriesMap.get(selectedCategory).get(page * getRecipesPerPage() + 1);
|
|
|
- };
|
|
|
- final Rectangle middleBounds = new Rectangle((int) getBounds().getCenterX() - 75, getBounds().y + 113, 150, 66);
|
|
|
- widgets.addAll(selectedCategory.setupDisplay(middleDisplaySupplier, middleBounds));
|
|
|
- if (supplier != null)
|
|
|
- widgets.add(new SpeedCraftingButtonWidget(supplier.get(middleBounds), supplier.getButtonText(), functional, middleDisplaySupplier));
|
|
|
- }
|
|
|
+ int displayWidth = selectedCategory.getDisplayWidth(displaySupplier.get());
|
|
|
+ final Rectangle displayBounds = new Rectangle((int) getBounds().getCenterX() - displayWidth / 2, getBounds().y + 40 + recipeHeight * i + 7 * i, displayWidth, recipeHeight);
|
|
|
+ widgets.addAll(selectedCategory.setupDisplay(displaySupplier, displayBounds));
|
|
|
+ if (supplier.isPresent())
|
|
|
+ widgets.add(new SpeedCraftingButtonWidget(supplier.get().get(displayBounds), supplier.get().getButtonText(), functional, displaySupplier));
|
|
|
}
|
|
|
-
|
|
|
+ if (choosePageActivated)
|
|
|
+ recipeChoosePageWidget = new RecipeChoosePageWidget(this, page, getTotalPages(selectedCategory));
|
|
|
+ else
|
|
|
+ recipeChoosePageWidget = null;
|
|
|
+
|
|
|
GuiHelper.getLastOverlay().onInitialized();
|
|
|
listeners.addAll(tabs);
|
|
|
listeners.add(GuiHelper.getLastOverlay());
|
|
|
listeners.addAll(widgets);
|
|
|
}
|
|
|
|
|
|
+ public List<IRecipeDisplay> getCurrentDisplayed() {
|
|
|
+ List<IRecipeDisplay> list = Lists.newArrayList();
|
|
|
+ int recipesPerPage = getRecipesPerPage();
|
|
|
+ for(int i = 0; i <= recipesPerPage; i++)
|
|
|
+ if (recipesPerPage > 0 && page * (recipesPerPage + 1) + i < categoriesMap.get(selectedCategory).size())
|
|
|
+ list.add(categoriesMap.get(selectedCategory).get(page * (recipesPerPage + 1) + i));
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public IRecipeCategory getSelectedCategory() {
|
|
|
+ return selectedCategory;
|
|
|
+ }
|
|
|
+
|
|
|
public int getPage() {
|
|
|
return page;
|
|
|
}
|
|
@@ -212,44 +253,43 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
}
|
|
|
|
|
|
private int getRecipesPerPage() {
|
|
|
- if (selectedCategory.usesFullPage())
|
|
|
- return 1;
|
|
|
- return 2;
|
|
|
+ int height = selectedCategory.getDisplayHeight();
|
|
|
+ return MathHelper.clamp(MathHelper.floor(((float) largestHeight - 40f) / ((float) height + 7f)) - 1, 0, Math.min(RoughlyEnoughItemsCore.getConfigHelper().getConfig().maxRecipePerPage - 1, selectedCategory.getMaximumRecipePerPage() - 1));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void method_18326(int mouseX, int mouseY, float partialTicks) {
|
|
|
- drawBackground();
|
|
|
+ public void draw(int mouseX, int mouseY, float delta) {
|
|
|
+ this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
|
|
|
+ if (selectedCategory != null)
|
|
|
+ selectedCategory.drawCategoryBackground(bounds, mouseX, mouseY, delta);
|
|
|
+ else {
|
|
|
+ new RecipeBaseWidget(bounds).draw(mouseX, mouseY, delta);
|
|
|
+ drawRect(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, SUB_COLOR.getRGB());
|
|
|
+ drawRect(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, SUB_COLOR.getRGB());
|
|
|
+ }
|
|
|
tabs.stream().filter(tabWidget -> {
|
|
|
return !tabWidget.isSelected();
|
|
|
- }).forEach(tabWidget -> tabWidget.draw(mouseX, mouseY, partialTicks));
|
|
|
+ }).forEach(tabWidget -> tabWidget.draw(mouseX, mouseY, delta));
|
|
|
GuiLighting.disable();
|
|
|
- super.method_18326(mouseX, mouseY, partialTicks);
|
|
|
+ super.draw(mouseX, mouseY, delta);
|
|
|
widgets.forEach(widget -> {
|
|
|
GuiLighting.disable();
|
|
|
- widget.draw(mouseX, mouseY, partialTicks);
|
|
|
+ widget.draw(mouseX, mouseY, delta);
|
|
|
});
|
|
|
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
|
GuiLighting.disable();
|
|
|
- tabs.stream().filter(TabWidget::isSelected).forEach(tabWidget -> tabWidget.draw(mouseX, mouseY, partialTicks));
|
|
|
- GuiHelper.getLastOverlay().drawOverlay(mouseX, mouseY, partialTicks);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void drawBackground() {
|
|
|
- drawBackground(0);
|
|
|
- if (selectedCategory != null)
|
|
|
- selectedCategory.drawCategoryBackground(bounds);
|
|
|
- else {
|
|
|
- GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
|
- GuiLighting.disable();
|
|
|
- this.client.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
|
|
|
- this.drawTexturedRect((int) bounds.getX(), (int) bounds.getY(), 0, 0, (int) bounds.getWidth(), (int) bounds.getHeight());
|
|
|
+ tabs.stream().filter(TabWidget::isSelected).forEach(tabWidget -> tabWidget.draw(mouseX, mouseY, delta));
|
|
|
+ GuiHelper.getLastOverlay().drawOverlay(mouseX, mouseY, delta);
|
|
|
+ if (choosePageActivated) {
|
|
|
+ zOffset = 500.0f;
|
|
|
+ this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
|
|
|
+ zOffset = 0.0f;
|
|
|
+ recipeChoosePageWidget.draw(mouseX, mouseY, delta);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public int getTotalPages(IRecipeCategory category) {
|
|
|
- return MathHelper.ceil(categoriesMap.get(category).size() / (double) getRecipesPerPage());
|
|
|
+ return MathHelper.ceil(categoriesMap.get(category).size() / (double) (getRecipesPerPage() + 1));
|
|
|
}
|
|
|
|
|
|
public Rectangle getBounds() {
|
|
@@ -258,15 +298,40 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
|
|
|
@Override
|
|
|
public boolean charTyped(char char_1, int int_1) {
|
|
|
- for(GuiEventListener listener : listeners)
|
|
|
+ if (choosePageActivated) {
|
|
|
+ if (recipeChoosePageWidget.charTyped(char_1, int_1))
|
|
|
+ return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for(InputListener listener : listeners)
|
|
|
if (listener.charTyped(char_1, int_1))
|
|
|
return true;
|
|
|
return super.charTyped(char_1, int_1);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean mouseDragged(double double_1, double double_2, int int_1, double double_3, double double_4) {
|
|
|
+ if (choosePageActivated) {
|
|
|
+ if (recipeChoosePageWidget.mouseDragged(double_1, double_2, int_1, double_3, double_4))
|
|
|
+ return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return super.mouseDragged(double_1, double_2, int_1, double_3, double_4);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean mouseReleased(double double_1, double double_2, int int_1) {
|
|
|
+ if (choosePageActivated) {
|
|
|
+ if (recipeChoosePageWidget.mouseReleased(double_1, double_2, int_1))
|
|
|
+ return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return super.mouseReleased(double_1, double_2, int_1);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public boolean mouseScrolled(double amount) {
|
|
|
- for(GuiEventListener listener : listeners)
|
|
|
+ for(InputListener listener : listeners)
|
|
|
if (listener.mouseScrolled(amount))
|
|
|
return true;
|
|
|
if (getBounds().contains(ClientHelper.getMouseLocation())) {
|
|
@@ -286,9 +351,19 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
|
|
|
@Override
|
|
|
public boolean mouseClicked(double double_1, double double_2, int int_1) {
|
|
|
- for(GuiEventListener entry : method_1968()) //getEntries
|
|
|
+ if (choosePageActivated)
|
|
|
+ if (recipeChoosePageWidget.isHighlighted(double_1, double_2)) {
|
|
|
+ if (recipeChoosePageWidget.mouseClicked(double_1, double_2, int_1))
|
|
|
+ return true;
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ choosePageActivated = false;
|
|
|
+ onInitialized();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for(InputListener entry : getInputListeners())
|
|
|
if (entry.mouseClicked(double_1, double_2, int_1)) {
|
|
|
- method_1967(entry); //focusOn
|
|
|
+ focusOn(entry);
|
|
|
if (int_1 == 0)
|
|
|
method_1966(true); //setActive
|
|
|
return true;
|
|
@@ -296,4 +371,11 @@ public class RecipeViewingWidgetScreen extends Screen {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public InputListener getFocused() {
|
|
|
+ if (choosePageActivated)
|
|
|
+ return recipeChoosePageWidget;
|
|
|
+ return super.getFocused();
|
|
|
+ }
|
|
|
+
|
|
|
}
|