aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
diff options
context:
space:
mode:
authorDanielshe <shekwancheung0528@gmail.com>2019-11-03 19:02:00 +0800
committerDanielshe <shekwancheung0528@gmail.com>2019-11-03 19:02:00 +0800
commitad7f945d6f724d51ee843b334838fda84c6197f2 (patch)
treeb67cd5a1b95826435ef54813e4221ff3fda39212 /src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
parent9f5a9eae9a7863412cc5eb433bf15e5ee71da616 (diff)
downloadRoughlyEnoughItems-ad7f945d6f724d51ee843b334838fda84c6197f2.tar.gz
RoughlyEnoughItems-ad7f945d6f724d51ee843b334838fda84c6197f2.tar.bz2
RoughlyEnoughItems-ad7f945d6f724d51ee843b334838fda84c6197f2.zip
API Changes
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java')
-rw-r--r--src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
index 3a8f1a6cc..3c840d676 100644
--- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
@@ -21,7 +21,6 @@ import net.minecraft.client.render.GuiLighting;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.Window;
-import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
@@ -125,7 +124,7 @@ public class RecipeViewingScreen extends Screen {
this.largestWidth = width - 100;
this.largestHeight = height - 40;
int maxWidthDisplay = CollectionUtils.mapAndMax(getCurrentDisplayed(), display -> selectedCategory.getDisplayWidth((RecipeDisplay) display), (Comparator<Integer>) Comparator.naturalOrder()).orElse(150);
- this.guiWidth = MathHelper.clamp(maxWidthDisplay, 0, largestWidth);
+ this.guiWidth = MathHelper.clamp(maxWidthDisplay + 30, 0, largestWidth);
this.guiHeight = MathHelper.floor(MathHelper.clamp((selectedCategory.getDisplayHeight() + 7d) * (getRecipesPerPage() + 1d) + 40d, 186d, (double) largestHeight));
this.bounds = new Rectangle(width / 2 - guiWidth / 2, height / 2 - guiHeight / 2, guiWidth, guiHeight);
this.page = MathHelper.clamp(page, 0, getTotalPages(selectedCategory) - 1);
@@ -295,7 +294,7 @@ public class RecipeViewingScreen extends Screen {
else
recipeChoosePageWidget = null;
- List<List<ItemStack>> workingStations = RoughlyEnoughItemsCore.getRecipeHelper().getWorkingStations(selectedCategory.getIdentifier());
+ List<List<EntryStack>> workingStations = RoughlyEnoughItemsCore.getRecipeHelper().getWorkingStations(selectedCategory.getIdentifier());
if (!workingStations.isEmpty()) {
int hh = MathHelper.floor((bounds.height - 16) / 18f);
int actualHeight = Math.min(hh, workingStations.size());
@@ -306,8 +305,8 @@ public class RecipeViewingScreen extends Screen {
int index = 0;
List<String> list = Collections.singletonList(Formatting.YELLOW.toString() + I18n.translate("text.rei.working_station"));
xx += (innerWidth - 1) * 18;
- for (List<ItemStack> workingStation : workingStations) {
- preWidgets.add(new SlotWidget(xx, yy, Renderer.fromItemStacks(() -> workingStation, true, stack -> list), true, true, true));
+ for (List<EntryStack> workingStation : workingStations) {
+ preWidgets.add(EntryWidget.create(xx, yy).entries(CollectionUtils.map(workingStation, stack -> stack.copy().setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, s -> list))));
index++;
yy += 18;
if (index >= hh) {