aboutsummaryrefslogtreecommitdiff
path: root/fabric/src
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-05-17 21:41:37 +0800
committershedaniel <daniel@shedaniel.me>2021-05-17 21:41:37 +0800
commit943c7aab9fe4dac5801d5dfa9af2611331eccd78 (patch)
tree5956ccecec82a594830fcb6a8855b7a633595859 /fabric/src
parent0cd2336ababe5d6c78a64943adde5b54cb3e72b6 (diff)
parent745f78a4aa7d23fe03e7420eb3fe06b8c418db35 (diff)
downloadRoughlyEnoughItems-943c7aab9fe4dac5801d5dfa9af2611331eccd78.tar.gz
RoughlyEnoughItems-943c7aab9fe4dac5801d5dfa9af2611331eccd78.tar.bz2
RoughlyEnoughItems-943c7aab9fe4dac5801d5dfa9af2611331eccd78.zip
Merge remote-tracking branch 'origin/6.x' into 6.x-1.17
Diffstat (limited to 'fabric/src')
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java7
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/ErrorDisplayerImpl.java38
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinScreen.java44
-rw-r--r--fabric/src/main/resources/fabric.mod.json3
-rw-r--r--fabric/src/main/resources/rei.mixins.json14
5 files changed, 106 insertions, 0 deletions
diff --git a/fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java b/fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java
index d7200f47c..47f671dc0 100644
--- a/fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java
+++ b/fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsInitializerImpl.java
@@ -57,6 +57,9 @@ public class RoughlyEnoughItemsInitializerImpl {
break;
}
}
+ if (!FabricLoader.getInstance().isModLoaded("architectury")) {
+ RoughlyEnoughItemsState.error("Architectury API is not installed!", "https://www.curseforge.com/minecraft/mc-mods/architectury-fabric/files/all");
+ }
if (isClient()) {
try {
if (!FabricLoader.getInstance().isModLoaded("cloth-config2")) {
@@ -69,4 +72,8 @@ public class RoughlyEnoughItemsInitializerImpl {
}
}
}
+
+ public static boolean isDev() {
+ return FabricLoader.getInstance().isDevelopmentEnvironment();
+ }
}
diff --git a/fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/ErrorDisplayerImpl.java b/fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/ErrorDisplayerImpl.java
new file mode 100644
index 000000000..ae6a0f9f3
--- /dev/null
+++ b/fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/ErrorDisplayerImpl.java
@@ -0,0 +1,38 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021 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.fabric;
+
+import net.minecraft.client.gui.screens.Screen;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Consumer;
+
+public class ErrorDisplayerImpl {
+ public static List<Consumer<Screen>> consumerList = new ArrayList<>();
+
+ public static void registerGuiInit(Consumer<Screen> consumer) {
+ consumerList.add(consumer);
+ }
+}
diff --git a/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinScreen.java b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinScreen.java
new file mode 100644
index 000000000..a14577a7f
--- /dev/null
+++ b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinScreen.java
@@ -0,0 +1,44 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021 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.mixin.fabric;
+
+import me.shedaniel.rei.impl.client.fabric.ErrorDisplayerImpl;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.screens.Screen;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import java.util.function.Consumer;
+
+@Mixin(Screen.class)
+public class MixinScreen {
+ @Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At("HEAD"))
+ private void init(Minecraft minecraft, int i, int j, CallbackInfo ci) {
+ for (Consumer<Screen> consumer : ErrorDisplayerImpl.consumerList) {
+ consumer.accept((Screen) (Object) this);
+ }
+ }
+}
diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json
index bf7bf3d6b..3f1c179a0 100644
--- a/fabric/src/main/resources/fabric.mod.json
+++ b/fabric/src/main/resources/fabric.mod.json
@@ -29,6 +29,9 @@
]
},
"accessWidener": "roughlyenoughitems.accessWidener",
+ "mixins": [
+ "rei.mixins.json"
+ ],
"custom": {
"rei:translators": {
"English": ["shedaniel"],
diff --git a/fabric/src/main/resources/rei.mixins.json b/fabric/src/main/resources/rei.mixins.json
new file mode 100644
index 000000000..b7d1e7c81
--- /dev/null
+++ b/fabric/src/main/resources/rei.mixins.json
@@ -0,0 +1,14 @@
+{
+ "required": true,
+ "package": "me.shedaniel.rei.mixin.fabric",
+ "compatibilityLevel": "JAVA_8",
+ "client": [
+ "MixinScreen"
+ ],
+ "mixins": [
+ ],
+ "injectors": {
+ "maxShiftBy": 5,
+ "defaultRequire": 1
+ }
+}