aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-05-08 00:55:25 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-05-08 00:55:25 +0800
commita5c90bb7d4748ba2da024ce468ffeeda99bf4a0f (patch)
tree4bcc51bdcee2dbc521d2bf74f0f913ec04485f67 /src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
parent5357ec90f80768b69b197161e877e3ef884650a4 (diff)
downloadRoughlyEnoughItems-a5c90bb7d4748ba2da024ce468ffeeda99bf4a0f.tar.gz
RoughlyEnoughItems-a5c90bb7d4748ba2da024ce468ffeeda99bf4a0f.tar.bz2
RoughlyEnoughItems-a5c90bb7d4748ba2da024ce468ffeeda99bf4a0f.zip
start of 2.9 update beta
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java')
-rw-r--r--src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
index 16af460f4..c35c31a5b 100644
--- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
@@ -43,16 +43,15 @@ public class RecipeViewingScreen extends Screen {
public int largestWidth, largestHeight;
public boolean choosePageActivated;
public RecipeChoosePageWidget recipeChoosePageWidget;
- private Window window;
private Rectangle bounds;
private RecipeCategory selectedCategory;
private ButtonWidget recipeBack, recipeNext, categoryBack, categoryNext;
- public RecipeViewingScreen(Window window, Map<RecipeCategory, List<RecipeDisplay>> categoriesMap) {
+ public RecipeViewingScreen(Map<RecipeCategory, List<RecipeDisplay>> categoriesMap) {
super(new StringTextComponent(""));
this.categoryPages = 0;
- this.window = window;
this.widgets = Lists.newArrayList();
+ Window window = MinecraftClient.getInstance().window;
this.bounds = new Rectangle(window.getScaledWidth() / 2 - guiWidth / 2, window.getScaledHeight() / 2 - guiHeight / 2, 176, 186);
this.categoriesMap = categoriesMap;
this.categories = Lists.newArrayList();
@@ -119,11 +118,11 @@ public class RecipeViewingScreen extends Screen {
this.children.clear();
this.tabs.clear();
this.widgets.clear();
- this.largestWidth = window.getScaledWidth() - 100;
- this.largestHeight = window.getScaledHeight() - 40;
+ this.largestWidth = width - 100;
+ this.largestHeight = height - 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() + 7d) * (getRecipesPerPage() + 1d) + 40d, 186d, (double) largestHeight));
- this.bounds = new Rectangle(window.getScaledWidth() / 2 - guiWidth / 2, window.getScaledHeight() / 2 - guiHeight / 2, guiWidth, guiHeight);
+ this.bounds = new Rectangle(width / 2 - guiWidth / 2, height / 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")) {
@@ -250,7 +249,7 @@ public class RecipeViewingScreen extends Screen {
return false;
}
});
- tab.setItem(categories.get(j).getCategoryIcon(), categories.get(j).getCategoryName(), tab.getId() + categoryPages * 6 == categories.indexOf(selectedCategory));
+ tab.setRenderable(categories.get(j), categories.get(j).getIcon(), categories.get(j).getCategoryName(), tab.getId() + categoryPages * 6 == categories.indexOf(selectedCategory));
}
}
Optional<ButtonAreaSupplier> supplier = RecipeHelper.getInstance().getSpeedCraftButtonArea(selectedCategory);