diff options
| author | shedaniel <daniel@shedaniel.me> | 2020-01-17 14:31:30 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2020-01-17 14:31:30 +0800 |
| commit | 7a1cf35934ef14c04f884fe6ae34282e1d6243ba (patch) | |
| tree | e84d0c5bfb9929f065544e96ecc1fb07d3496c29 /src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java | |
| parent | b4be45e414504afb49910d766bebcd00f55b052b (diff) | |
| download | RoughlyEnoughItems-7a1cf35934ef14c04f884fe6ae34282e1d6243ba.tar.gz RoughlyEnoughItems-7a1cf35934ef14c04f884fe6ae34282e1d6243ba.tar.bz2 RoughlyEnoughItems-7a1cf35934ef14c04f884fe6ae34282e1d6243ba.zip | |
3.3.12
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java index e4fa346be..d9fab6dca 100644 --- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java @@ -11,7 +11,6 @@ import me.shedaniel.math.api.Point; import me.shedaniel.math.api.Rectangle; import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.api.*; -import me.shedaniel.rei.api.annotations.Internal; import me.shedaniel.rei.gui.widget.*; import me.shedaniel.rei.impl.ScreenHelper; import me.shedaniel.rei.utils.CollectionUtils; @@ -26,17 +25,16 @@ import net.minecraft.text.LiteralText; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.*; import java.util.function.Supplier; -@Deprecated -@Internal +@ApiStatus.Internal public class RecipeViewingScreen extends Screen { public static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png"); - private int tabsPerPage = 5; private final List<Widget> preWidgets; private final List<Widget> widgets; private final List<TabWidget> tabs; @@ -48,6 +46,7 @@ public class RecipeViewingScreen extends Screen { public int largestWidth, largestHeight; public boolean choosePageActivated; public RecipeChoosePageWidget recipeChoosePageWidget; + private int tabsPerPage = 5; private Rectangle bounds; @Nullable private CategoryBaseWidget workingStationsBaseWidget; private RecipeCategory<RecipeDisplay> selectedCategory; @@ -72,6 +71,23 @@ public class RecipeViewingScreen extends Screen { this.choosePageActivated = false; } + static void transformNotice(List<Widget> setupDisplay, EntryStack mainStackToNotice) { + if (mainStackToNotice.isEmpty()) + return; + for (Widget widget : setupDisplay) { + if (widget instanceof EntryWidget) { + EntryWidget entry = (EntryWidget) widget; + if (entry.entries().size() > 1) { + EntryStack stack = CollectionUtils.firstOrNullEqualsAll(entry.entries(), mainStackToNotice); + if (stack != null) { + entry.clearStacks(); + entry.entry(stack); + } + } + } + } + } + public void addMainStackToNotice(EntryStack stack) { this.mainStackToNotice = stack; } @@ -343,36 +359,6 @@ public class RecipeViewingScreen extends Screen { children.addAll(preWidgets); } - static void transformNotice(List<Widget> setupDisplay, EntryStack mainStackToNotice) { - if (mainStackToNotice.isEmpty()) - return; - for (Widget widget : setupDisplay) { - if (widget instanceof EntryWidget) { - EntryWidget entry = (EntryWidget) widget; - if (entry.entries().size() > 1) { - EntryStack stack = CollectionUtils.firstOrNullEqualsAll(entry.entries(), mainStackToNotice); - if (stack != null) { - entry.clearStacks(); - entry.entry(stack); - } - } - } - } - } - - public static class WorkstationSlotWidget extends EntryWidget { - public WorkstationSlotWidget(int x, int y, List<EntryStack> widgets) { - super(new Point(x, y)); - entries(widgets); - noBackground(); - } - - @Override - public boolean containsMouse(double mouseX, double mouseY) { - return getInnerBounds().contains(mouseX, mouseY); - } - } - public List<Widget> getWidgets() { return widgets; } @@ -398,7 +384,6 @@ public class RecipeViewingScreen extends Screen { return categoryPages; } - @SuppressWarnings("deprecation") private int getRecipesPerPage() { if (selectedCategory.getFixedRecipesPerPage() > 0) return selectedCategory.getFixedRecipesPerPage() - 1; @@ -534,4 +519,17 @@ public class RecipeViewingScreen extends Screen { return super.getFocused(); } + public static class WorkstationSlotWidget extends EntryWidget { + public WorkstationSlotWidget(int x, int y, List<EntryStack> widgets) { + super(new Point(x, y)); + entries(widgets); + noBackground(); + } + + @Override + public boolean containsMouse(double mouseX, double mouseY) { + return getInnerBounds().contains(mouseX, mouseY); + } + } + } |
