diff options
| author | shedaniel <daniel@shedaniel.me> | 2020-07-05 15:31:12 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2020-07-05 15:31:12 +0800 |
| commit | 17150bedcdf80944a64e165976cf2491d409b1c0 (patch) | |
| tree | f71725bf6c37fd2bc82fbf8bf07a4b98ba2d1584 /src/main/java/me/shedaniel/rei/impl/ScreenHelper.java | |
| parent | af1b3f780d8edb361c00421cdd991f3f2b86849c (diff) | |
| download | RoughlyEnoughItems-17150bedcdf80944a64e165976cf2491d409b1c0.tar.gz RoughlyEnoughItems-17150bedcdf80944a64e165976cf2491d409b1c0.tar.bz2 RoughlyEnoughItems-17150bedcdf80944a64e165976cf2491d409b1c0.zip | |
Fix #370 and changes to how screens are handled
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'src/main/java/me/shedaniel/rei/impl/ScreenHelper.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/impl/ScreenHelper.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java b/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java index a46bddc50..7068e15ce 100644 --- a/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java +++ b/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java @@ -28,6 +28,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Sets; import me.shedaniel.cloth.api.client.events.v0.ClothClientHooks; import me.shedaniel.math.Point; +import me.shedaniel.math.Rectangle; import me.shedaniel.math.api.Executor; import me.shedaniel.rei.RoughlyEnoughItemsState; import me.shedaniel.rei.api.ConfigManager; @@ -38,8 +39,11 @@ import me.shedaniel.rei.gui.ContainerScreenOverlay; import me.shedaniel.rei.gui.OverlaySearchField; import me.shedaniel.rei.gui.RecipeScreen; import me.shedaniel.rei.gui.WarningAndErrorScreen; +import me.shedaniel.rei.gui.config.SearchFieldLocation; import me.shedaniel.rei.gui.widget.TextFieldWidget; import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.event.client.ClientTickCallback; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; @@ -58,6 +62,7 @@ import java.util.List; import java.util.Optional; @ApiStatus.Internal +@Environment(EnvType.CLIENT) public class ScreenHelper implements ClientModInitializer, REIHelper { private OverlaySearchField searchField; @@ -203,6 +208,15 @@ public class ScreenHelper implements ClientModInitializer, REIHelper { ScreenHelper.instance = this; } + public static Rectangle getItemListArea(Rectangle bounds) { + return new Rectangle(bounds.x, bounds.y + 2 + (ConfigObject.getInstance().getSearchFieldLocation() == SearchFieldLocation.TOP_SIDE ? 24 : 0) + (ConfigObject.getInstance().isEntryListWidgetScrolled() ? 0 : 22), bounds.width, bounds.height - (ConfigObject.getInstance().getSearchFieldLocation() != SearchFieldLocation.CENTER ? 27 + 22 : 27) + (!ConfigObject.getInstance().isEntryListWidgetScrolled() ? 0 : 22)); + } + + public static Rectangle getFavoritesListArea(Rectangle bounds) { + int offset = 6 + (!ConfigObject.getInstance().isLowerConfigButton() ? 25 : 0) + (ConfigObject.getInstance().doesShowUtilsButtons() ? 25 : 0); + return new Rectangle(bounds.x, bounds.y + 2 + offset, bounds.width, bounds.height - 5 - offset); + } + @Override public void onInitializeClient() { ClothClientHooks.SCREEN_INIT_PRE.register((client, screen, screenHooks) -> { |
