diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-08-06 10:37:38 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-08-26 10:54:44 +0900 |
| commit | d3bfd79800aacfde6617d5430ead5fdda0a506fe (patch) | |
| tree | b8420034448bd3193c7f541f47a6387a9772d99f /api/src/main/java | |
| parent | 8c13c015031a0de865d2e767cd8e879754f803e2 (diff) | |
| download | RoughlyEnoughItems-d3bfd79800aacfde6617d5430ead5fdda0a506fe.tar.gz RoughlyEnoughItems-d3bfd79800aacfde6617d5430ead5fdda0a506fe.tar.bz2 RoughlyEnoughItems-d3bfd79800aacfde6617d5430ead5fdda0a506fe.zip | |
More work okay
Diffstat (limited to 'api/src/main/java')
4 files changed, 72 insertions, 2 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/ClientHelper.java b/api/src/main/java/me/shedaniel/rei/api/client/ClientHelper.java index 6b62994b1..7169e83ad 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/ClientHelper.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/ClientHelper.java @@ -24,6 +24,7 @@ package me.shedaniel.rei.api.client; import me.shedaniel.rei.api.client.config.ConfigManager; +import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import me.shedaniel.rei.api.client.view.ViewSearchBuilder; import me.shedaniel.rei.api.common.entry.EntryStack; @@ -56,7 +57,9 @@ public interface ClientHelper { * * @return whether cheating is enabled */ - boolean isCheating(); + default boolean isCheating() { + return ConfigObject.getInstance().isCheating(); + } /** * Sets current cheating mode @@ -64,7 +67,10 @@ public interface ClientHelper { * * @param cheating the new cheating mode */ - void setCheating(boolean cheating); + default void setCheating(boolean cheating) { + ConfigObject.getInstance().setCheating(cheating); + ConfigManager.getInstance().saveConfig(); + } /** * Tries to cheat stack using either packets or commands. diff --git a/api/src/main/java/me/shedaniel/rei/api/client/overlay/OverlayListWidget.java b/api/src/main/java/me/shedaniel/rei/api/client/overlay/OverlayListWidget.java index 57e7e8999..f72952d17 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/overlay/OverlayListWidget.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/overlay/OverlayListWidget.java @@ -55,5 +55,8 @@ public interface OverlayListWidget { */ boolean containsMouse(Point point); + /** + * Queues reload of the search result. + */ void queueReloadSearch(); } diff --git a/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java b/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java index 944755f61..b9758f235 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/overlay/ScreenOverlay.java @@ -35,19 +35,72 @@ import java.util.Optional; @Environment(EnvType.CLIENT) public abstract class ScreenOverlay extends WidgetWithBounds { + /** + * Queues reload of the overlay. + */ public abstract void queueReloadOverlay(); + /** + * Queues reload of the search result. + */ public abstract void queueReloadSearch(); + /** + * Returns whether the overlay is queued to be reloaded. + * + * @return whether the overlay is queued to be reloaded + */ + public abstract boolean isOverlayReloadQueued(); + + /** + * Returns whether the search result is queued to be reloaded. + * + * @return whether the search result is queued to be reloaded + */ + public abstract boolean isSearchReloadQueued(); + + /** + * Returns the current dragging context. + * + * @return the current dragging context + */ public abstract DraggingContext<?> getDraggingContext(); + /** + * Returns whether a specified point is within the bounds of the overlay. + * + * @param mouseX the x coordinate of the mouse + * @param mouseY the y coordinate of the mouse + * @return whether the point is within the bounds of the overlay + */ public abstract boolean isNotInExclusionZones(double mouseX, double mouseY); + /** + * Returns the entry list of the overlay. + * + * @return the entry list of the overlay + */ public abstract OverlayListWidget getEntryList(); + /** + * Returns the favorites list of the overlay. + * + * @return the favorites list of the overlay, or {@code null} if favorites are not enabled + */ public abstract Optional<OverlayListWidget> getFavoritesList(); + /** + * Returns the search field of the overlay. + * + * @return the search field of the overlay + */ public abstract TextField getSearchField(); + /** + * Renders a tooltip. + * + * @param matrices the matrices transform + * @param tooltip the tooltip + */ public abstract void renderTooltip(PoseStack matrices, Tooltip tooltip); } diff --git a/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java b/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java index 407e4dfde..8855adcd9 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/view/Views.java @@ -24,6 +24,7 @@ package me.shedaniel.rei.api.client.view; import me.shedaniel.rei.api.client.plugins.REIClientPlugin; +import me.shedaniel.rei.api.common.display.Display; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.plugins.PluginManager; import me.shedaniel.rei.api.common.registry.Reloadable; @@ -31,6 +32,7 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import java.util.Collection; +import java.util.List; public interface Views extends Reloadable<REIClientPlugin> { /** @@ -45,6 +47,12 @@ public interface Views extends Reloadable<REIClientPlugin> { @ApiStatus.Experimental ViewSearchBuilder getContext(); + @ApiStatus.Experimental + boolean isRecipesFor(List<EntryStack<?>> stacks, Display display); + + @ApiStatus.Experimental + boolean isUsagesFor(List<EntryStack<?>> stacks, Display display); + /** * Returns all craftable items from materials. * |
