aboutsummaryrefslogtreecommitdiff
path: root/runtime-frontend/overlay/src/main/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-08-27 13:23:37 +0900
committershedaniel <daniel@shedaniel.me>2022-08-27 13:23:37 +0900
commit03b0adcf960c5e462fddc8e045b146a8c727670c (patch)
treedcd998806437b6fea4e6ce0d34f5ddf97404d674 /runtime-frontend/overlay/src/main/java
parent1ba613d9c97e722e76f459162de2e1a1c9e875bb (diff)
downloadRoughlyEnoughItems-03b0adcf960c5e462fddc8e045b146a8c727670c.tar.gz
RoughlyEnoughItems-03b0adcf960c5e462fddc8e045b146a8c727670c.tar.bz2
RoughlyEnoughItems-03b0adcf960c5e462fddc8e045b146a8c727670c.zip
Refactors to overlays and reiruntime
Diffstat (limited to 'runtime-frontend/overlay/src/main/java')
-rw-r--r--runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/EntryListProvider.java9
-rw-r--r--runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/FavoritesListProvider.java11
-rw-r--r--runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/TooltipQueueImpl.java57
3 files changed, 77 insertions, 0 deletions
diff --git a/runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/EntryListProvider.java b/runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/EntryListProvider.java
new file mode 100644
index 000000000..8ad40444b
--- /dev/null
+++ b/runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/EntryListProvider.java
@@ -0,0 +1,9 @@
+package me.shedaniel.rei.impl.client.gui.overlay;
+
+import me.shedaniel.rei.api.client.overlay.OverlayListWidget;
+import org.jetbrains.annotations.ApiStatus;
+
+@ApiStatus.Internal
+public interface EntryListProvider {
+ OverlayListWidget getEntryList();
+}
diff --git a/runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/FavoritesListProvider.java b/runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/FavoritesListProvider.java
new file mode 100644
index 000000000..07e329074
--- /dev/null
+++ b/runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/FavoritesListProvider.java
@@ -0,0 +1,11 @@
+package me.shedaniel.rei.impl.client.gui.overlay;
+
+import me.shedaniel.rei.api.client.overlay.OverlayListWidget;
+import org.jetbrains.annotations.ApiStatus;
+
+import java.util.Optional;
+
+@ApiStatus.Internal
+public interface FavoritesListProvider {
+ Optional<OverlayListWidget> getFavoritesList();
+}
diff --git a/runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/TooltipQueueImpl.java b/runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/TooltipQueueImpl.java
new file mode 100644
index 000000000..de285ef68
--- /dev/null
+++ b/runtime-frontend/overlay/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/TooltipQueueImpl.java
@@ -0,0 +1,57 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022 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.impl.client.gui.overlay;
+
+import com.google.common.collect.Lists;
+import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
+import me.shedaniel.rei.api.client.gui.widgets.TooltipQueue;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+import java.util.Objects;
+
+@ApiStatus.Internal
+public final class TooltipQueueImpl implements TooltipQueue {
+ private final List<Tooltip> tooltips = Lists.newArrayList();
+
+ @Override
+ public void queue(@Nullable Tooltip tooltip) {
+ if (tooltip != null)
+ tooltips.add(tooltip);
+ }
+
+ @Override
+ public void clear() {
+ tooltips.clear();
+ }
+
+ @Override
+ @Nullable
+ public Tooltip get() {
+ return tooltips.stream().filter(Objects::nonNull)
+ .reduce((tooltip, tooltip2) -> tooltip2)
+ .orElse(null);
+ }
+}