diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-03-09 23:17:05 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-03-09 23:17:05 +0800 |
| commit | de461fde691f593b85ffeae837b5b419a9abf7cc (patch) | |
| tree | cec6e08c99427eddf9eef5e19d04edca56d3d0d4 | |
| parent | 64bc9937d6ec04c6d66240a84b4fb345026c0b12 (diff) | |
| download | RoughlyEnoughItems-de461fde691f593b85ffeae837b5b419a9abf7cc.tar.gz RoughlyEnoughItems-de461fde691f593b85ffeae837b5b419a9abf7cc.tar.bz2 RoughlyEnoughItems-de461fde691f593b85ffeae837b5b419a9abf7cc.zip | |
Use AbstractRecipeViewingScreen and remove static from ScreenHelper
Signed-off-by: shedaniel <daniel@shedaniel.me>
78 files changed, 887 insertions, 577 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/ConfigObject.java b/api/src/main/java/me/shedaniel/rei/api/ConfigObject.java index fc802346d..9558bdd1e 100644 --- a/api/src/main/java/me/shedaniel/rei/api/ConfigObject.java +++ b/api/src/main/java/me/shedaniel/rei/api/ConfigObject.java @@ -25,8 +25,8 @@ package me.shedaniel.rei.api; import me.shedaniel.clothconfig2.api.ModifierKeyCode; import me.shedaniel.rei.api.favorites.FavoriteEntry; -import me.shedaniel.rei.api.ingredient.EntryStack; import me.shedaniel.rei.api.gui.config.*; +import me.shedaniel.rei.api.ingredient.EntryStack; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import org.jetbrains.annotations.ApiStatus; diff --git a/api/src/main/java/me/shedaniel/rei/api/REIHelper.java b/api/src/main/java/me/shedaniel/rei/api/REIHelper.java index 3a46cf03b..f02ba4024 100644 --- a/api/src/main/java/me/shedaniel/rei/api/REIHelper.java +++ b/api/src/main/java/me/shedaniel/rei/api/REIHelper.java @@ -23,16 +23,17 @@ package me.shedaniel.rei.api; +import me.shedaniel.math.Rectangle; +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.plugins.PluginManager; import me.shedaniel.rei.api.registry.Reloadable; -import me.shedaniel.rei.impl.Internals; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Optional; @@ -44,15 +45,25 @@ public interface REIHelper extends Reloadable { * @return the instance of {@link REIHelper} */ static REIHelper getInstance() { - return Internals.getREIHelper(); + return PluginManager.getInstance().get(REIHelper.class); } - @ApiStatus.Experimental - Optional<REIOverlay> getOverlay(); + boolean isOverlayVisible(); + + void toggleOverlayVisible(); + + default Optional<REIOverlay> getOverlay() { + return getOverlay(false); + } + + Optional<REIOverlay> getOverlay(boolean reset); @Nullable AbstractContainerScreen<?> getPreviousContainerScreen(); + @Nullable + Screen getPreviousScreen(); + boolean isDarkThemeEnabled(); @Nullable @@ -60,6 +71,11 @@ public interface REIHelper extends Reloadable { void queueTooltip(@Nullable Tooltip tooltip); - @NotNull ResourceLocation getDefaultDisplayTexture(); + + SearchFieldLocation getContextualSearchFieldLocation(); + + Rectangle calculateEntryListArea(); + + Rectangle calculateFavoritesListArea(); } diff --git a/api/src/main/java/me/shedaniel/rei/api/REIOverlay.java b/api/src/main/java/me/shedaniel/rei/api/REIOverlay.java index c9dc4c16e..2b66857d4 100644 --- a/api/src/main/java/me/shedaniel/rei/api/REIOverlay.java +++ b/api/src/main/java/me/shedaniel/rei/api/REIOverlay.java @@ -24,11 +24,17 @@ package me.shedaniel.rei.api; import me.shedaniel.rei.api.gui.drag.DraggingContext; +import me.shedaniel.rei.api.gui.widgets.WidgetWithBounds; import org.jetbrains.annotations.ApiStatus; @ApiStatus.Experimental -public interface REIOverlay { - void queueReloadOverlay(); +public abstract class REIOverlay extends WidgetWithBounds { + @ApiStatus.Internal + public abstract void closeOverlayMenu(); - DraggingContext getDraggingContext(); + public abstract void queueReloadOverlay(); + + public abstract DraggingContext getDraggingContext(); + + public abstract boolean isNotInExclusionZones(double mouseX, double mouseY); } diff --git a/api/src/main/java/me/shedaniel/rei/api/favorites/FavoriteEntry.java b/api/src/main/java/me/shedaniel/rei/api/favorites/FavoriteEntry.java index 0f8f3dd1a..a5cc707af 100644 --- a/api/src/main/java/me/shedaniel/rei/api/favorites/FavoriteEntry.java +++ b/api/src/main/java/me/shedaniel/rei/api/favorites/FavoriteEntry.java @@ -24,8 +24,8 @@ package me.shedaniel.rei.api.favorites; import com.google.gson.JsonObject; -import me.shedaniel.rei.api.ingredient.EntryStack; import me.shedaniel.rei.api.gui.Renderer; +import me.shedaniel.rei.api.ingredient.EntryStack; import me.shedaniel.rei.impl.Internals; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.NotNull; diff --git a/api/src/main/java/me/shedaniel/rei/api/gui/AbstractRenderer.java b/api/src/main/java/me/shedaniel/rei/api/gui/AbstractRenderer.java index b4ffb75c5..7ce38fd5f 100644 --- a/api/src/main/java/me/shedaniel/rei/api/gui/AbstractRenderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/gui/AbstractRenderer.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.api.gui; -import me.shedaniel.rei.api.gui.Renderer; import net.minecraft.client.gui.GuiComponent; public abstract class AbstractRenderer extends GuiComponent implements Renderer { diff --git a/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStack.java b/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStack.java index 8d38fb4c8..6bd61c953 100644 --- a/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStack.java +++ b/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStack.java @@ -1,3 +1,26 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package me.shedaniel.rei.api.gui.drag; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackProvider.java b/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackProvider.java index 7b799b26a..3a4b56afc 100644 --- a/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackProvider.java +++ b/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackProvider.java @@ -1,3 +1,26 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package me.shedaniel.rei.api.gui.drag; import org.jetbrains.annotations.Nullable; diff --git a/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackVisitor.java b/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackVisitor.java index e0e64bf9a..62f66de23 100644 --- a/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackVisitor.java +++ b/api/src/main/java/me/shedaniel/rei/api/gui/drag/DraggableStackVisitor.java @@ -1,3 +1,26 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEME |
