aboutsummaryrefslogtreecommitdiff
path: root/forge/src/main/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-11-21 19:10:50 +0800
committershedaniel <daniel@shedaniel.me>2021-11-21 19:10:50 +0800
commit85e72e9a9bc70cf283ba872172985b338be59233 (patch)
treebce73cb38c00b73d1323c7a014701ee638f2224b /forge/src/main/java
parenta437fe0560478c636526862679ba1098688bf2c1 (diff)
parentc4cdd997f981d0a3b763140d1515a73941b18f5c (diff)
downloadRoughlyEnoughItems-85e72e9a9bc70cf283ba872172985b338be59233.tar.gz
RoughlyEnoughItems-85e72e9a9bc70cf283ba872172985b338be59233.tar.bz2
RoughlyEnoughItems-85e72e9a9bc70cf283ba872172985b338be59233.zip
Merge remote-tracking branch 'origin/6.x-1.17' into 7.x-1.18
# Conflicts: # api/src/main/java/me/shedaniel/rei/api/common/transfer/info/MenuInfo.java # gradle.properties # runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/type/TooltipArgumentType.java # runtime/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultCategoryHandler.java
Diffstat (limited to 'forge/src/main/java')
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java7
-rw-r--r--forge/src/main/java/me/shedaniel/rei/plugin/common/displays/crafting/forge/DefaultCraftingDisplayImpl.java38
2 files changed, 45 insertions, 0 deletions
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java
index 8f67f2bff..e2b13d7bc 100644
--- a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java
+++ b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java
@@ -68,6 +68,7 @@ public class RoughlyEnoughItemsForge {
.flatMap(info -> info.getMods().stream())
.map(IModInfo::getModId)
.collect(Collectors.toList());
+ out:
for (ModFileScanData.AnnotationData annotation : data.getAnnotations()) {
if (annotationType.equals(annotation.annotationType())) {
try {
@@ -83,6 +84,12 @@ public class RoughlyEnoughItemsForge {
}, clazz));
}
} catch (Throwable throwable) {
+ Throwable t = throwable;
+ while (t != null) {
+ if (t.getMessage() != null && t.getMessage().contains("invalid dist DEDICATED_SERVER") && !RoughlyEnoughItemsInitializer.isClient())
+ continue out;
+ t = t.getCause();
+ }
LOGGER.error("Failed to load plugin: " + annotation.memberName(), throwable);
}
}
diff --git a/forge/src/main/java/me/shedaniel/rei/plugin/common/displays/crafting/forge/DefaultCraftingDisplayImpl.java b/forge/src/main/java/me/shedaniel/rei/plugin/common/displays/crafting/forge/DefaultCraftingDisplayImpl.java
new file mode 100644
index 000000000..fe2b36fcc
--- /dev/null
+++ b/forge/src/main/java/me/shedaniel/rei/plugin/common/displays/crafting/forge/DefaultCraftingDisplayImpl.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.plugin.common.displays.crafting.forge;
+
+import net.minecraft.world.item.crafting.Recipe;
+import net.minecraftforge.common.crafting.IShapedRecipe;
+import org.apache.commons.lang3.tuple.Pair;
+
+public class DefaultCraftingDisplayImpl {
+ public static Pair<Integer, Integer> getSize(Recipe<?> recipe) {
+ if (recipe instanceof IShapedRecipe) {
+ return Pair.of(((IShapedRecipe<?>) recipe).getRecipeWidth(), ((IShapedRecipe<?>) recipe).getRecipeHeight());
+ }
+
+ return null;
+ }
+}