aboutsummaryrefslogtreecommitdiff
path: root/shared-internals/src/main/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-07-28 01:39:41 +0800
committershedaniel <daniel@shedaniel.me>2022-08-26 10:52:28 +0900
commit9954713e457a5a5d80025432961b56ab0003bbb0 (patch)
treed26b3a09f824e58edd2ad7df39e6c4f48fcc6bb9 /shared-internals/src/main/java
parentc85b3d49f6d88e7e92b06bacca1ce93db7b75fd0 (diff)
downloadRoughlyEnoughItems-9954713e457a5a5d80025432961b56ab0003bbb0.tar.gz
RoughlyEnoughItems-9954713e457a5a5d80025432961b56ab0003bbb0.tar.bz2
RoughlyEnoughItems-9954713e457a5a5d80025432961b56ab0003bbb0.zip
More work on config module
Diffstat (limited to 'shared-internals/src/main/java')
-rw-r--r--shared-internals/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerInternal.java8
-rw-r--r--shared-internals/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java35
-rw-r--r--shared-internals/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java77
3 files changed, 120 insertions, 0 deletions
diff --git a/shared-internals/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerInternal.java b/shared-internals/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerInternal.java
index 48d2aec3b..16863185c 100644
--- a/shared-internals/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerInternal.java
+++ b/shared-internals/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerInternal.java
@@ -23,6 +23,8 @@
package me.shedaniel.rei.impl.client.config;
+import me.shedaniel.autoconfig.gui.registry.GuiRegistry;
+import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Jankson;
import me.shedaniel.rei.api.client.config.ConfigManager;
import org.jetbrains.annotations.ApiStatus;
@@ -38,4 +40,10 @@ public interface ConfigManagerInternal extends ConfigManager {
Object get(String fieldKey);
boolean set(String fieldKey, Object value);
+
+ interface SystemSetup {
+ default void setup(Jankson.Builder builder) {}
+
+ default void setup(GuiRegistry registry) {}
+ }
}
diff --git a/shared-internals/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java b/shared-internals/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java
new file mode 100644
index 000000000..4823008b6
--- /dev/null
+++ b/shared-internals/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+import net.minecraft.resources.ResourceLocation;
+
+public class InternalTextures {
+ public static final ResourceLocation ARROW_LEFT_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_left.png");
+ public static final ResourceLocation ARROW_RIGHT_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_right.png");
+ public static final ResourceLocation ARROW_LEFT_SMALL_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_left_small.png");
+ public static final ResourceLocation ARROW_RIGHT_SMALL_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_right_small.png");
+ public static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer.png");
+ public static final ResourceLocation CHEST_GUI_TEXTURE_DARK = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer_dark.png");
+}
diff --git a/shared-internals/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java b/shared-internals/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java
new file mode 100644
index 000000000..3d3895880
--- /dev/null
+++ b/shared-internals/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java
@@ -0,0 +1,77 @@
+/*
+ * 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.screen;
+
+import com.mojang.blaze3d.vertex.PoseStack;
+import net.minecraft.Util;
+import net.minecraft.client.gui.chat.NarratorChatListener;
+import net.minecraft.client.gui.screens.Screen;
+import net.minecraft.network.chat.Component;
+import org.jetbrains.annotations.ApiStatus;
+
+import java.util.function.BooleanSupplier;
+
+@ApiStatus.Internal
+public class ConfigReloadingScreen extends Screen {
+ private final Component title;
+ private final BooleanSupplier predicate;
+ private Runnable parent;
+
+ public ConfigReloadingScreen(Component title, BooleanSupplier predicate, Runnable parent) {
+ super(NarratorChatListener.NO_TITLE);
+ this.title = title;
+ this.predicate = predicate;
+ this.parent = parent;
+ }
+
+ @Override
+ public boolean shouldCloseOnEsc() {
+ return false;
+ }
+
+ @Override
+ public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
+ this.renderDirtBackground(0);
+ if (!predicate.getAsBoolean()) {
+ parent.run();
+ return;
+ }
+ drawCenteredString(matrices, this.font, title, this.width / 2, this.height / 2 - 50, 16777215);
+ String text;
+ switch ((int) (Util.getMillis() / 300L % 4L)) {
+ case 0:
+ default:
+ text = "O o o";
+ break;
+ case 1:
+ case 3:
+ text = "o O o";
+ break;
+ case 2:
+ text = "o o O";
+ }
+ drawCenteredString(matrices, this.font, text, this.width / 2, this.height / 2 - 41, 8421504);
+ super.render(matrices, mouseX, mouseY, delta);
+ }
+}