diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-02-27 17:14:08 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-02-27 17:15:02 +0800 |
| commit | 542eb5154ebce387312ca3691f743b89e4aef99e (patch) | |
| tree | 48583bad05514d9a1a8d0ab3499af0d39f3fd1e5 /runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java | |
| parent | 9c570a0e71a6e209e0d234a99f35bd24efc18d7d (diff) | |
| download | RoughlyEnoughItems-542eb5154ebce387312ca3691f743b89e4aef99e.tar.gz RoughlyEnoughItems-542eb5154ebce387312ca3691f743b89e4aef99e.tar.bz2 RoughlyEnoughItems-542eb5154ebce387312ca3691f743b89e4aef99e.zip | |
Remove depending on Cloth API, switching to architectury
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java')
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java index ef265916a..4fd96d390 100644 --- a/runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java @@ -36,13 +36,15 @@ import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.api.*; import me.shedaniel.rei.api.ingredient.EntryIngredient; import me.shedaniel.rei.api.ingredient.EntryStack; -import me.shedaniel.rei.api.registry.CategoryRegistry; +import me.shedaniel.rei.api.registry.category.CategoryRegistry; import me.shedaniel.rei.api.registry.display.Display; import me.shedaniel.rei.api.registry.display.DisplayCategory; +import me.shedaniel.rei.api.registry.display.DisplayRegistry; import me.shedaniel.rei.api.util.ImmutableLiteralText; import me.shedaniel.rei.api.gui.widgets.Button; import me.shedaniel.rei.api.gui.widgets.Panel; import me.shedaniel.rei.api.gui.widgets.Widgets; +import me.shedaniel.rei.api.view.ViewSearchBuilder; import me.shedaniel.rei.gui.widget.EntryWidget; import me.shedaniel.rei.gui.widget.RecipeChoosePageWidget; import me.shedaniel.rei.gui.widget.TabWidget; @@ -262,7 +264,7 @@ public class RecipeViewingScreen extends Screen implements RecipeScreen { ClientHelperImpl.getInstance().openRecipeViewingScreen(categoriesMap, categories.get(currentCategoryIndex).getIdentifier(), ingredientStackToNotice, resultStackToNotice); }).tooltipLine(I18n.get("text.rei.previous_category"))); widgets.add(Widgets.createClickableLabel(new Point(bounds.getCenterX(), bounds.getY() + 7), selectedCategory.getTitle(), clickableLabelWidget -> { - ClientHelper.getInstance().openView(ClientHelper.ViewSearchBuilder.builder().addAllCategories().fillPreferredOpenedCategory()); + ClientHelper.getInstance().openView(ViewSearchBuilder.builder().addAllCategories().fillPreferredOpenedCategory()); }).tooltipLine(I18n.get("text.rei.view_all_categories"))); widgets.add(categoryNext = Widgets.createButton(new Rectangle(bounds.getMaxX() - 17, bounds.getY() + 5, 12, 12), new TranslatableComponent("text.rei.right_arrow")) .onClick(button -> { @@ -313,7 +315,7 @@ public class RecipeViewingScreen extends Screen implements RecipeScreen { tab.setRenderer(categories.get(j), categories.get(j).getIcon(), categories.get(j).getTitle(), tab.getId() + categoryPages * tabsPerPage == categories.indexOf(selectedCategory)); } } - Optional<ButtonAreaSupplier> supplier = DisplayRegistry.getInstance().getAutoCraftButtonArea(selectedCategory); + Optional<ButtonAreaSupplier> supplier = CategoryRegistry.getInstance().get(selectedCategory.getIdentifier()).getPlusButtonArea(); int recipeHeight = selectedCategory.getDisplayHeight(); List<Display> currentDisplayed = getCurrentDisplayed(); for (int i = 0; i < currentDisplayed.size(); i++) { @@ -335,18 +337,18 @@ public class RecipeViewingScreen extends Screen implements RecipeScreen { recipeChoosePageWidget = null; workingStationsBaseWidget = null; - List<EntryIngredient> workingStations = CategoryRegistry.getInstance().getWorkingStations(selectedCategory.getIdentifier()); - if (!workingStations.isEmpty()) { + List<EntryIngredient> workstations = CategoryRegistry.getInstance().get(selectedCategory.getIdentifier()).getWorkstations(); + if (!workstations.isEmpty()) { int hh = Mth.floor((bounds.height - 16) / 18f); - int actualHeight = Math.min(hh, workingStations.size()); - int innerWidth = Mth.ceil(workingStations.size() / ((float) hh)); + int actualHeight = Math.min(hh, workstations.size()); + int innerWidth = Mth.ceil(workstations.size() / ((float) hh)); int xx = bounds.x - (8 + innerWidth * 16) + 6; int yy = bounds.y + 16; preWidgets.add(workingStationsBaseWidget = Widgets.createCategoryBase(new Rectangle(xx - 5, yy - 5, 15 + innerWidth * 16, 10 + actualHeight * 16))); preWidgets.add(Widgets.createSlotBase(new Rectangle(xx - 1, yy - 1, innerWidth * 16 + 2, actualHeight * 16 + 2))); int index = 0; xx += (innerWidth - 1) * 16; - for (EntryIngredient workingStation : workingStations) { + for (EntryIngredient workingStation : workstations) { preWidgets.add(new WorkstationSlotWidget(xx, yy, workingStation)); index++; yy += 16; |
