diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-03-21 12:23:14 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-03-21 12:23:14 +0800 |
| commit | 7c4788f86f589d71b319e186fa5d8a468046bcc1 (patch) | |
| tree | b87fd23a6d65a96e381c27fe0470d1f50e77a635 /runtime/src/main/java/me/shedaniel/rei/impl/REIHelperImpl.java | |
| parent | 2c29cac8a5e0878696c8e6635f4e41ed4845b41c (diff) | |
| download | RoughlyEnoughItems-7c4788f86f589d71b319e186fa5d8a468046bcc1.tar.gz RoughlyEnoughItems-7c4788f86f589d71b319e186fa5d8a468046bcc1.tar.bz2 RoughlyEnoughItems-7c4788f86f589d71b319e186fa5d8a468046bcc1.zip | |
Rely on ScreenRegistry more on calculating the bounds
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'runtime/src/main/java/me/shedaniel/rei/impl/REIHelperImpl.java')
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/REIHelperImpl.java | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/REIHelperImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/REIHelperImpl.java index 0884d70d7..a18b71b3c 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/REIHelperImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/REIHelperImpl.java @@ -36,8 +36,6 @@ import me.shedaniel.rei.api.config.ConfigObject; import me.shedaniel.rei.api.gui.config.SearchFieldLocation; import me.shedaniel.rei.api.gui.widgets.TextField; import me.shedaniel.rei.api.gui.widgets.Tooltip; -import me.shedaniel.rei.api.registry.screen.DisplayBoundsProvider; -import me.shedaniel.rei.api.registry.screen.OverlayDecider; import me.shedaniel.rei.api.registry.screen.ScreenRegistry; import me.shedaniel.rei.gui.ContainerScreenOverlay; import me.shedaniel.rei.gui.OverlaySearchField; @@ -174,17 +172,14 @@ public class REIHelperImpl implements REIHelper { @Override public SearchFieldLocation getContextualSearchFieldLocation() { + SearchFieldLocation location = ConfigObject.getInstance().getSearchFieldLocation(); Window window = Minecraft.getInstance().getWindow(); - for (OverlayDecider decider : ScreenRegistry.getInstance().getDeciders(Minecraft.getInstance().screen)) { - if (decider instanceof DisplayBoundsProvider) { - Rectangle containerBounds = ((DisplayBoundsProvider<Screen>) decider).getScreenBounds(Minecraft.getInstance().screen); - if (window.getGuiScaledHeight() - 20 <= containerBounds.getMaxY()) { - return SearchFieldLocation.BOTTOM_SIDE; - } else break; - } + Rectangle screenBounds = ScreenRegistry.getInstance().getScreenBounds(Minecraft.getInstance().screen); + if (location == SearchFieldLocation.CENTER && window.getGuiScaledHeight() - 20 <= screenBounds.getMaxY()) { + return SearchFieldLocation.BOTTOM_SIDE; } - return ConfigObject.getInstance().getSearchFieldLocation(); + return location; } @Override |
