aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-02-28 02:07:47 +0800
committershedaniel <daniel@shedaniel.me>2021-02-28 02:07:47 +0800
commit69d386214f5d3471a3ef1e5533037cdc32648c57 (patch)
treea78d97ca416909ce68c3e5c11e1a1412e6fc174e
parent542eb5154ebce387312ca3691f743b89e4aef99e (diff)
downloadRoughlyEnoughItems-69d386214f5d3471a3ef1e5533037cdc32648c57.tar.gz
RoughlyEnoughItems-69d386214f5d3471a3ef1e5533037cdc32648c57.tar.bz2
RoughlyEnoughItems-69d386214f5d3471a3ef1e5533037cdc32648c57.zip
Port to Architectury Multiloader
Signed-off-by: shedaniel <daniel@shedaniel.me>
-rw-r--r--api/build.gradle18
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/gui/widgets/Tooltip.java4
-rw-r--r--api/src/main/resources/fabric.mod.json20
-rwxr-xr-xbuild.gradle150
-rw-r--r--default-plugin/build.gradle19
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java53
-rw-r--r--default-plugin/src/main/resources/fabric.mod.json29
-rw-r--r--default-plugin/src/main/resources/roughlyenoughitems-default-plugin.accessWidener21
-rw-r--r--fabric/build.gradle39
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java52
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/fabric/RoughlyEnoughItemsFabric.java31
-rw-r--r--fabric/src/main/resources/fabric.mod.json (renamed from runtime/src/main/resources/fabric.mod.json)17
-rw-r--r--fabric/src/main/resources/icon.png (renamed from api/src/main/resources/icon.png)bin27270 -> 27270 bytes
-rw-r--r--fabric/src/main/resources/roughlyenoughitems.accessWidener33
-rw-r--r--forge/build.gradle26
-rw-r--r--forge/gradle.properties1
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java21
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java17
-rw-r--r--forge/src/main/resources/META-INF/accesstransformer.cfg23
-rw-r--r--forge/src/main/resources/META-INF/mods.toml20
-rw-r--r--forge/src/main/resources/icon.png (renamed from default-plugin/src/main/resources/icon.png)bin27270 -> 27270 bytes
-rw-r--r--forge/src/main/resources/pack.mcmeta6
-rw-r--r--gradle.properties3
-rw-r--r--runtime/build.gradle25
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/PluginDetector.java18
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/REIModMenuEntryPoint.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java46
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java57
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java7
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsState.java8
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java6
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/plugin/DefaultRuntimePlugin.java3
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java30
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/widget/QueuedTooltip.java14
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java17
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java3
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/ErrorDisplayer.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/IssuesDetector.java31
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/ScreenHelper.java4
-rw-r--r--runtime/src/main/resources/icon.pngbin27270 -> 0 bytes
-rw-r--r--runtime/src/main/resources/roughlyenoughitems-runtime.accessWidener23
-rwxr-xr-xsettings.gradle2
-rwxr-xr-xsrc/main/resources/fabric.mod.json21
-rw-r--r--src/main/resources/icon.pngbin27270 -> 0 bytes
44 files changed, 528 insertions, 398 deletions
diff --git a/api/build.gradle b/api/build.gradle
index 598a85f5a..925fed277 100644
--- a/api/build.gradle
+++ b/api/build.gradle
@@ -1 +1,17 @@
-archivesBaseName = "api" \ No newline at end of file
+archivesBaseName = "api"
+
+dependencies {
+ modCompileOnly("net.fabricmc:fabric-loader:${project.fabricloader_version}")
+ modCompileOnly("me.shedaniel.cloth:cloth-config:${cloth_config_version}")
+ modCompileOnly("me.shedaniel:architectury:${architectury_version}")
+}
+
+architectury {
+ common()
+}
+
+remapJar {
+ afterEvaluate {
+ remapAccessWidener.set(false)
+ }
+}
diff --git a/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Tooltip.java b/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Tooltip.java
index 075e57580..972df5a43 100644
--- a/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Tooltip.java
+++ b/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Tooltip.java
@@ -23,8 +23,8 @@
package me.shedaniel.rei.api.gui.widgets;
+import me.shedaniel.architectury.utils.EnvExecutor;
import me.shedaniel.math.Point;
-import me.shedaniel.math.api.Executor;
import me.shedaniel.rei.api.REIHelper;
import me.shedaniel.rei.impl.Internals;
import net.fabricmc.api.EnvType;
@@ -64,6 +64,6 @@ public interface Tooltip {
List<Component> getText();
default void queue() {
- Executor.runIfEnv(EnvType.CLIENT, () -> () -> REIHelper.getInstance().queueTooltip(this));
+ EnvExecutor.runInEnv(EnvType.CLIENT, () -> () -> REIHelper.getInstance().queueTooltip(this));
}
}
diff --git a/api/src/main/resources/fabric.mod.json b/api/src/main/resources/fabric.mod.json
deleted file mode 100644
index 29784abf1..000000000
--- a/api/src/main/resources/fabric.mod.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "schemaVersion": 1,
- "id": "roughlyenoughitems-api",
- "name": "REI (API)",
- "description": "The api facing part of Roughly Enough Items.",
- "version": "${version}",
- "authors": [
- "shedaniel"
- ],
- "contact": {
- "homepage": "https://www.curseforge.com/minecraft/mc-mods/roughly-enough-items",
- "sources": "https://github.com/shedaniel/RoughlyEnoughItems",
- "issues": "https://github.com/shedaniel/RoughlyEnoughItems/issues"
- },
- "license": "MIT",
- "icon": "icon.png",
- "custom": {
- "modmenu:parent": "roughlyenoughitems"
- }
-}
diff --git a/build.gradle b/build.gradle
index b534499d6..5c5d0c67c 100755
--- a/build.gradle
+++ b/build.gradle
@@ -1,14 +1,12 @@
plugins {
- id("forgified-fabric-loom") version("0.6.66") apply false
- id("maven-publish")
- id("java")
- id("java-library")
- id("net.minecrell.licenser") version("0.4.1")
+ id("architectury-plugin") version("3.0.89")
+ id("forgified-fabric-loom") version("0.6.71") apply false
+ id("org.cadixdev.licenser") version("0.5.0")
id("com.matthewprenger.cursegradle") version("1.4.0")
+ id("java")
+ id("maven-publish")
}
-import net.fabricmc.loom.task.RemapJarTask
-
import java.text.SimpleDateFormat
archivesBaseName = "RoughlyEnoughItems"
@@ -18,111 +16,77 @@ version = rootProject.base_version + "." + runNumber
group = "me.shedaniel"
-allprojects {
- apply plugin: 'maven-publish'
- apply plugin: 'forgified-fabric-loom'
- apply plugin: 'net.minecrell.licenser'
-
- sourceCompatibility = targetCompatibility = 1.8
+subprojects {
+ apply plugin: "forgified-fabric-loom"
loom {
silentMojangMappingsLicense()
-// shareCaches = true
}
+ dependencies {
+ minecraft("com.mojang:minecraft:${rootProject.minecraft_version}")
+ mappings(loom.officialMojangMappings())
+ }
+}
+
+allprojects {
+ apply plugin: "maven-publish"
+ apply plugin: "architectury-plugin"
+ apply plugin: "org.cadixdev.licenser"
+
+ sourceCompatibility = targetCompatibility = 1.8
+
repositories {
+ mavenLocal()
maven { url "https://maven.shedaniel.me" }
maven { url "https://maven.terraformersmc.com/releases" }
}
-
- processResources {
- filesMatching('fabric.mod.json') {
- expand 'version': project.version
- }
- inputs.property "version", project.version
+
+ architectury {
+ transformerVersion = "2.1.9999"
}
license {
- header rootProject.file('HEADER')
- include '**/*.java'
+ header rootProject.file("HEADER")
+ include "**/*.java"
}
jar {
from rootProject.file("LICENSE")
}
- dependencies {
- minecraft("com.mojang:minecraft:${project.minecraft_version}")
- mappings(loom.officialMojangMappings())
- modApi("net.fabricmc:fabric-loader:${project.fabricloader_version}")
-// modApi(fabricApi.module("fabric-api-base", project.fabric_api))
-// modApi(fabricApi.module("fabric-resource-loader-v0", project.fabric_api))
-// modApi(fabricApi.module("fabric-networking-api-v1", project.fabric_api))
-// modApi(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_api))
-// modApi(fabricApi.module("fabric-rendering-fluids-v1", project.fabric_api))
- modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
- exclude(module: "fabric-api")
- }
- modApi("org.jetbrains:annotations:19.0.0")
- modRuntime("com.terraformersmc:modmenu:${modmenu_version}") {
- transitive(false)
- }
- modRuntime("me.shedaniel:SmoothScrollingEverywhere:3.0.3-unstable") {
- transitive(false)
- }
- modCompileOnly("me.shedaniel:architectury:${architectury_version}") {
- exclude(module: "fabric-api")
- }
- modRuntime("me.shedaniel:architectury-fabric:${architectury_version}")
- modRuntime("net.fabricmc.fabric-api:fabric-api:${project.fabric_api}")
- }
-
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
- }
- task sourcesJar(type: Jar, dependsOn: classes) {
- classifier("sources")
- from sourceSets.main.allSource
+ def targetVersion = 8
+ if (JavaVersion.current().isJava9Compatible()) {
+ options.release = targetVersion
+ }
}
}
subprojects {
+// apply plugin: "forgified-fabric-loom"
+
group = rootProject.group
version = rootProject.version
- task remapMavenJar(type: Copy, dependsOn: remapJar) {
- afterEvaluate {
- from("${project.buildDir}/libs/$archivesBaseName-${version}.jar")
- into("${project.buildDir}/libs/")
- rename { String fn -> "$archivesBaseName-${version}-maven.jar" }
- }
- }
-
- configurations {
- dev
- remapped
- }
+// loom {
+// silentMojangMappingsLicense()
+// }
- jar {
- classifier("dev")
- }
-
- remapJar {
- classifier(null)
- }
-
- artifacts {
- dev file: file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar"), type: "jar", builtBy: jar
- remapped file: file("${project.buildDir}/libs/$archivesBaseName-${version}.jar"), type: "jar", builtBy: remapJar
+ dependencies {
+// minecraft("com.mojang:minecraft:${project.minecraft_version}")
+// mappings(loom.officialMojangMappings())
+// modApi("net.fabricmc:fabric-loader:${project.fabricloader_version}")
}
- publishing {
+ /*publishing {
publications {
create("${archivesBaseName}_mavenJava", MavenPublication) {
afterEvaluate {
- artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}-maven.jar")) {
- builtBy remapMavenJar
+ artifact(jar) {
+ builtBy mavenJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
@@ -142,25 +106,19 @@ subprojects {
}
}
}
- }
+ }*/
}
task licenseFormatAll
subprojects { licenseFormatAll.dependsOn("${path}:licenseFormat") }
-subprojects { rootProject.remapJar.dependsOn("${path}:remapJar") }
+//subprojects { rootProject.remapJar.dependsOn("${path}:remapJar") }
-task remapMavenJar(type: RemapJarTask, dependsOn: jar) {
- input.set(file("${project.buildDir}/libs/${archivesBaseName}-${project.version}-dev.jar"))
- archiveFileName = "${archivesBaseName}-${project.version}-maven.jar"
- addNestedDependencies.set(false)
-}
-
-dependencies {
- subprojects.each {
- compile project(path: ":${it.name}", configuration: "dev")
- include project(path: ":${it.name}", configuration: "remapped")
- }
-}
+//dependencies {
+// subprojects.each {
+// compile project(path: ":${it.name}", configuration: "dev")
+// include project(path: ":${it.name}", configuration: "remapped")
+// }
+//}
def releaseChangelog = "No changelog"
@@ -193,7 +151,7 @@ task releaseOnCf {
dependsOn tasks.getByName("curseforge")
}
-curseforge {
+/*curseforge {
if (project.hasProperty('danielshe_curse_api_key') || System.getenv('danielshe_curse_api_key') != null) {
apiKey = project.hasProperty('danielshe_curse_api_key') ? project.property('danielshe_curse_api_key') : System.getenv('danielshe_curse_api_key')
project {
@@ -232,8 +190,8 @@ curseforge {
publishing {
publications {
mavenJava(MavenPublication) {
- artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}-maven.jar")) {
- builtBy remapMavenJar
+ artifact(jar) {
+ builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
@@ -262,4 +220,4 @@ publishing {
}
}
}
-}
+}*/
diff --git a/default-plugin/build.gradle b/default-plugin/build.gradle
index 159cda85d..4f7fbee58 100644
--- a/default-plugin/build.gradle
+++ b/default-plugin/build.gradle
@@ -1,9 +1,22 @@
archivesBaseName = "default-plugin"
loom {
- accessWidener = file("src/main/resources/roughlyenoughitems-default-plugin.accessWidener")
+ accessWidener = gradle.rootProject.project("fabric").file("src/main/resources/roughlyenoughitems.accessWidener")
}
dependencies {
- compile project(path: ":api", configuration: "dev")
-} \ No newline at end of file
+ modCompileOnly("net.fabricmc:fabric-loader:${project.fabricloader_version}")
+ modCompileOnly("me.shedaniel.cloth:cloth-config:${cloth_config_version}")
+ modCompileOnly("me.shedaniel:architectury:${architectury_version}")
+ compileOnly(project(path: ":api"))
+}
+
+architectury {
+ common()
+}
+
+remapJar {
+ afterEvaluate {
+ remapAccessWidener.set(false)
+ }
+}
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
index edd91e2ba..289ba480b 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
@@ -30,6 +30,7 @@ import it.unimi.dsi.fastutil.objects.Object2FloatMap;
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
import it.unimi.dsi.fastutil.objects.ReferenceSet;
import me.shedaniel.architectury.hooks.FluidStackHooks;
+import me.shedaniel.architectury.platform.Platform;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.*;
import me.shedaniel.rei.api.ingredient.EntryIngredient;
@@ -344,32 +345,34 @@ public class DefaultPlugin implements REIPlugin, BuiltinPlugin {
});
registry.registerDisplay(new DefaultBeaconBaseDisplay(CollectionUtils.map(Lists.newArrayList(BlockTags.BEACON_BASE_BLOCKS.getValues()), ItemStack::new)));
registry.registerDisplay(new DefaultBeaconPaymentDisplay(CollectionUtils.map(Lists.newArrayList(ItemTags.BEACON_PAYMENT_ITEMS.getValues()), ItemStack::new)));
- Set<Potion> potions = Sets.newLinkedHashSet();
- for (Ingredient container : PotionBrewing.ALLOWED_CONTAINERS) {
- for (PotionBrewing.Mix<Potion> mix : PotionBrewing.POTION_MIXES) {
- Potion from = mix.from;
- Ingredient ingredient = mix.ingredient;
- Potion to = mix.to;
- Ingredient base = Ingredient.of(Arrays.stream(container.getItems())
- .map(ItemStack::copy)
- .map(stack -> PotionUtils.setPotion(stack, from)));
- ItemStack output = Arrays.stream(container.getItems())
- .map(ItemStack::copy)
- .map(stack -> PotionUtils.setPotion(stack, to))
- .findFirst().orElse(ItemStack.EMPTY);
- registerBrewingRecipe(base, ingredient, output);
- potions.add(from);
- potions.add(to);
+ if (Platform.isFabric()) {
+ Set<Potion> potions = Sets.newLinkedHashSet();
+ for (Ingredient container : PotionBrewing.ALLOWED_CONTAINERS) {
+ for (PotionBrewing.Mix<Potion> mix : PotionBrewing.POTION_MIXES) {
+ Potion from = mix.from;
+ Ingredient ingredient = mix.ingredient;
+ Potion to = mix.to;
+ Ingredient base = Ingredient.of(Arrays.stream(container.getItems())
+ .map(ItemStack::copy)
+ .map(stack -> PotionUtils.setPotion(stack, from)));
+ ItemStack output = Arrays.stream(container.getItems())
+ .map(ItemStack::copy)
+ .map(stack -> PotionUtils.setPotion(stack, to))
+ .findFirst().orElse(ItemStack.EMPTY);
+ registerBrewingRecipe(base, ingredient, output);
+ potions.add(from);
+ potions.add(to);
+ }
}
- }
- for (Potion potion : potions) {
- for (PotionBrewing.Mix<Item> mix : PotionBrewing.CONTAINER_MIXES) {
- Item from = mix.from;
- Ingredient ingredient = mix.ingredient;
- Item to = mix.to;
- Ingredient base = Ingredient.of(PotionUtils.setPotion(new ItemStack(from), potion));
- ItemStack output = PotionUtils.setPotion(new ItemStack(to), potion);
- registerBrewingRecipe(base, ingredient, output);
+ for (Potion potion : potions) {
+ for (PotionBrewing.Mix<Item> mix : PotionBrewing.CONTAINER_MIXES) {
+ Item from = mix.from;
+ Ingredient ingredient = mix.ingredient;
+ Item to = mix.to;
+ Ingredient base = Ingredient.of(PotionUtils.setPotion(new ItemStack(from), potion));
+ ItemStack output = PotionUtils.setPotion(new ItemStack(to), potion);
+ registerBrewingRecipe(base, ingredient, output);
+ }
}
}
}
diff --git a/default-plugin/src/main/resources/fabric.mod.json b/default-plugin/src/main/resources/fabric.mod.json
deleted file mode 100644
index c6b67960d..000000000
--- a/default-plugin/src/main/resources/fabric.mod.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "schemaVersion": 1,
- "id": "roughlyenoughitems-default-plugin",
- "name": "REI (Default Plugin)",
- "description": "The default implementation of handling vanilla features.",
- "version": "${version}",
- "authors": [
- "shedaniel"
- ],
- "contact": {
- "homepage": "https://www.curseforge.com/minecraft/mc-mods/roughly-enough-items",
- "sources": "https://github.com/shedaniel/RoughlyEnoughItems",
- "issues": "https://github.com/shedaniel/RoughlyEnoughItems/issues"
- },
- "license": "MIT",
- "icon": "icon.png",
- "entrypoints": {
- "rei_plugins": [
- "me.shedaniel.rei.plugin.DefaultPlugin"
- ],
- "rei_containers": [
- "me.shedaniel.rei.plugin.DefaultServerContainerPlugin"
- ]
- },
- "accessWidener": "roughlyenoughitems-default-plugin.accessWidener",
- "custom": {
- "modmenu:parent": "roughlyenoughitems"
- }
-}
diff --git a/default-plugin/src/main/resources/roughlyenoughitems-default-plugin.accessWidener b/default-plugin/src/main/resources/roughlyenoughitems-default-plugin.accessWidener
deleted file mode 100644
index 7a3f5ba99..000000000
--- a/default-plugin/src/main/resources/roughlyenoughitems-default-plugin.accessWidener
+++ /dev/null
@@ -1,21 +0,0 @@
-accessWidener v1 named
-accessible field net/minecraft/world/item/BucketItem content Lnet/minecraft/world/level/material/Fluid;
-accessible field net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen doRenderEffects Z
-accessible field net/minecraft/client/gui/screens/recipebook/RecipeBookComponent ghostRecipe Lnet/minecraft/client/gui/screens/recipebook/GhostRecipe;
-accessible field net/minecraft/client/gui/screens/recipebook/RecipeBookComponent searchBox Lnet/minecraft/client/gui/components/EditBox;
-accessible field net/minecraft/client/gui/screens/recipebook/RecipeBookComponent tabButtons Ljava/util/List;
-accessible field net/minecraft/client/gui/screens/inventory/AbstractContainerScreen leftPos I
-accessible field net/minecraft/client/gui/screens/inventory/AbstractContainerScreen topPos I
-accessible field net/minecraft/client/gui/screens/inventory/AbstractContainerScreen imageWidth I
-accessible field net/minecraft/client/gui/screens/inventory/AbstractContainerScreen imageHeight I
-accessible field net/minecraft/client/gui/screens/inventory/AbstractContainerScreen hoveredSlot Lnet/minecraft/world/inventory/Slot;
-accessible method net/minecraft/client/gui/GuiComponent innerBlit (Lcom/mojang/math/Matrix4f;IIIIIFFFF)V
-accessible field net/minecraft/world/item/crafting/UpgradeRecipe base Lnet/minecraft/world/item/crafting/Ingredient;
-accessible field net/minecraft/world/item/crafting/UpgradeRecipe addition Lnet/minecraft/world/item/crafting/Ingredient;
-accessible field net/minecraft/world/item/alchemy/PotionBrewing ALLOWED_CONTAINERS Ljava/util/List;
-accessible field net/minecraft/world/item/alchemy/PotionBrewing POTION_MIXES Ljava/util/List;
-accessible field net/minecraft/world/item/alchemy/PotionBrewing CONTAINER_MIXES Ljava/util/List;
-accessible class net/minecraft/world/item/alchemy/PotionBrewing$Mix
-accessible field net/minecraft/world/item/alchemy/PotionBrewing$Mix from Ljava/lang/Object;
-accessible field net/minecraft/world/item/alchemy/PotionBrewing$Mix to Ljava/lang/Object;
-accessible field net/minecraft/world/item/alchemy/PotionBrewing$Mix ingredient Lnet/minecraft/world/item/crafting/Ingredient;
diff --git a/fabric/build.gradle b/fabric/build.gradle
new file mode 100644
index 000000000..be813394e
--- /dev/null
+++ b/fabric/build.gradle
@@ -0,0 +1,39 @@
+archivesBaseName = "fabric"
+
+architectury {
+ platformSetupLoomIde()
+ fabric()
+}
+
+processResources {
+ filesMatching("fabric.mod.json") {
+ expand "version": project.version
+ }
+ inputs.property "version", project.version
+}
+
+loom {
+ accessWidener = file("src/main/resources/roughlyenoughitems.accessWidener")
+}
+
+dependencies {
+ modApi("net.fabricmc:fabric-loader:${project.fabricloader_version}")
+ modRuntime("net.fabricmc.fabric-api:fabric-api:${project.fabric_api}")
+ modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
+ exclude(module: "fabric-api")
+ }
+ modRuntime("com.terraformersmc:modmenu:${modmenu_version}") {
+ transitive(false)
+ }
+ modRuntime("me.shedaniel:SmoothScrollingEverywhere:3.0.3-unstable") {
+ transitive(false)
+ }
+ modApi("me.shedaniel:architectury-fabric:${architectury_version}")
+
+ implementation(project(path: ":api")) { transitive = false }
+ implementation(project(path: ":default-plugin")) { transitive = false }
+ implementation(project(path: ":runtime")) { transitive = false }
+ developmentFabric(project(path: ":api")) { transitive = false }
+ developmentFabric(project(path: ":default-plugin")) { transitive = false }
+ developmentFabric(project(path: ":runtime")) { transitive = false }
+}
diff --git a/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java b/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java
new file mode 100644
index 000000000..b8f10ba4e
--- /dev/null
+++ b/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java
@@ -0,0 +1,52 @@
+package me.shedaniel.rei.fabric;
+
+import com.google.common.collect.Iterables;
+import me.shedaniel.rei.RoughlyEnoughItemsCore;
+import me.shedaniel.rei.api.plugins.REIPlugin;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+import net.fabricmc.loader.api.FabricLoader;
+import net.fabricmc.loader.api.ModContainer;
+
+import static me.shedaniel.rei.RoughlyEnoughItemsCore.registerPlugin;
+
+public class PluginDetectorImpl {
+ public static void detectServerPlugins() {
+ FabricLoader.getInstance().getEntrypoints("rei_containers", Runnable.class).forEach(Runnable::run);
+ }
+
+ @Environment(EnvType.CLIENT)
+ public static void detectClientPlugins() {
+ for (ModContainer modContainer : FabricLoader.getInstance().getAllMods()) {
+ if (modContainer.getMetadata().containsCustomElement("roughlyenoughitems:plugins"))
+ RoughlyEnoughItemsCore.LOGGER.error("REI plugin from " + modContainer.getMetadata().getId() + " is not loaded because it is too old!");
+ }
+
+ for (REIPlugin plugin : Iterables.concat(
+ FabricLoader.getInstance().getEntrypoints("rei_plugins", REIPlugin.class),
+ FabricLoader.getInstance().getEntrypoints("rei", REIPlugin.class)
+ )) {
+ try {
+ registerPlugin(plugin);
+ } catch (Exception e) {
+ e.printStackTrace();