aboutsummaryrefslogtreecommitdiff
path: root/neoforge/src/serverComponent/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2023-11-19 03:04:21 +0800
committershedaniel <daniel@shedaniel.me>2023-11-19 03:04:21 +0800
commitb10f1308f5359ce73a9f4b899cf9516c4ad5388f (patch)
tree5b5700934ae88681918a620edc39754dbf82d496 /neoforge/src/serverComponent/java
parent11b87fdd96f5542d646aa8f5136095917f207564 (diff)
downloadRoughlyEnoughItems-b10f1308f5359ce73a9f4b899cf9516c4ad5388f.tar.gz
RoughlyEnoughItems-b10f1308f5359ce73a9f4b899cf9516c4ad5388f.tar.bz2
RoughlyEnoughItems-b10f1308f5359ce73a9f4b899cf9516c4ad5388f.zip
Support NeoForge
Diffstat (limited to 'neoforge/src/serverComponent/java')
-rw-r--r--neoforge/src/serverComponent/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForgeServerComponent.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/neoforge/src/serverComponent/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForgeServerComponent.java b/neoforge/src/serverComponent/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForgeServerComponent.java
new file mode 100644
index 000000000..36a6cfb02
--- /dev/null
+++ b/neoforge/src/serverComponent/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForgeServerComponent.java
@@ -0,0 +1,55 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 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.forge;
+
+import me.shedaniel.rei.impl.init.RoughlyEnoughItemsInitializer;
+import net.neoforged.api.distmarker.Dist;
+import net.neoforged.fml.IExtensionPoint;
+import net.neoforged.fml.ModList;
+import net.neoforged.fml.ModLoadingContext;
+import net.neoforged.fml.common.Mod;
+import net.neoforged.fml.loading.FMLEnvironment;
+import net.neoforged.neoforge.data.loading.DatagenModLoader;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+@Mod("roughlyenoughitems_servercomponent")
+public class RoughlyEnoughItemsForgeServerComponent {
+ public RoughlyEnoughItemsForgeServerComponent() {
+ ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (a, b) -> true));
+ Logger logger = LogManager.getLogger(RoughlyEnoughItemsForgeServerComponent.class);
+ if (!DatagenModLoader.isRunningDataGen()) {
+ if (FMLEnvironment.dist == Dist.CLIENT) {
+ logger.error("Roughly Enough Items Server Component is not compatible with the client!");
+ System.exit(1);
+ } else if (ModList.get().isLoaded("roughlyenoughitems")) {
+ logger.error("Roughly Enough Items is already loaded! The server component is only used alongside Just Enough Items, " +
+ "to allow clients to use REI without switching to JEI completely on the server!");
+ System.exit(1);
+ } else {
+ RoughlyEnoughItemsInitializer.onInitialize();
+ }
+ }
+ }
+}