aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-10-21 23:48:30 +0800
committershedaniel <daniel@shedaniel.me>2022-10-21 23:48:30 +0800
commit22e1bf58aeb4204bed30200b28da60284f384f88 (patch)
treefe84b955a8f3469dda08a2f636818c955a5c459e
parentd70b8353a6db5fc5d835af5d662372952703d2fd (diff)
parentd8c250d378a2cbaede41093a80973e47f34aec00 (diff)
downloadRoughlyEnoughItems-22e1bf58aeb4204bed30200b28da60284f384f88.tar.gz
RoughlyEnoughItems-22e1bf58aeb4204bed30200b28da60284f384f88.tar.bz2
RoughlyEnoughItems-22e1bf58aeb4204bed30200b28da60284f384f88.zip
Merge remote-tracking branch 'origin/8.x-1.18.2' into modularity
# Conflicts: # api/build.gradle # default-plugin/build.gradle # forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java # runtime-frontend/overlay-entries/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/entries/EntryListStackEntry.java # runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java # runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java # runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java # runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/InternalWidgets.java
-rw-r--r--.github/workflows/curseforge.yml2
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java3
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinInputConstants.java52
-rw-r--r--fabric/src/main/resources/rei.mixins.json1
-rw-r--r--fake/REIPlugin.classbin556 -> 627 bytes
-rw-r--r--fake/REIPluginClient.classbin0 -> 404 bytes
-rw-r--r--fake/REIPluginCommon.classbin0 -> 404 bytes
-rw-r--r--fake/REIPluginDedicatedServer.classbin0 -> 422 bytes
-rw-r--r--fake/REIPluginLoader.classbin0 -> 639 bytes
-rw-r--r--fake/REIPluginLoaderClient.classbin0 -> 416 bytes
-rw-r--r--fake/REIPluginLoaderCommon.classbin0 -> 416 bytes
-rw-r--r--fake/REIPluginLoaderDedicatedServer.classbin0 -> 434 bytes
-rw-r--r--fake/mods.toml10
-rw-r--r--forge/build.gradle24
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java163
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/REIPlugin.java1
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/REIPluginClient.java (renamed from forge/src/main/java/me/shedaniel/rei/forge/JEIStub.java)11
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/REIPluginCommon.java34
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/REIPluginDedicatedServer.java34
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/REIPluginLoader.java38
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/REIPluginLoaderClient.java34
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/REIPluginLoaderCommon.java34
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/REIPluginLoaderDedicatedServer.java34
-rw-r--r--forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java52
-rw-r--r--forge/src/main/resources/META-INF/mods.toml8
-rw-r--r--forge/src/main/resources/rei.mixins.json1
-rw-r--r--runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java9
-rw-r--r--runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringContextImpl.java2
-rw-r--r--runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/ManualFilteringRule.java2
-rw-r--r--runtime-frontend/overlay-entries/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/entries/EntryListStackEntry.java8
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java21
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java10
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java10
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/cs_cz.json17
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/de_de.json114
-rwxr-xr-xruntime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json7
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/es_es.json17
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/fr_fr.json9
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/ja_jp.json11
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/ko_kr.json16
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/pt_br.json23
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/ru_ru.json13
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/tr_tr.json17
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/zh_cn.json9
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/zh_hk.json2
-rw-r--r--runtime/src/main/resources/assets/roughlyenoughitems/lang/zh_tw.json8
-rw-r--r--shared-internals/src/main/java/me/shedaniel/rei/impl/client/search/AsyncSearchManager.java2
47 files changed, 736 insertions, 127 deletions
diff --git a/.github/workflows/curseforge.yml b/.github/workflows/curseforge.yml
index d67a5ad2d..82a6755eb 100644
--- a/.github/workflows/curseforge.yml
+++ b/.github/workflows/curseforge.yml
@@ -25,7 +25,7 @@ jobs:
- name: Upload Mod
uses: gradle/gradle-build-action@v2
with:
- arguments: build publish forge:publishUnified fabric:publishUnified jei-internals-workaround:publishUnified --stacktrace
+ arguments: build publish fabric:publishUnified forge:publishUnified --stacktrace
env:
danielshe_curse_api_key: ${{ secrets.CF_API_KEY }}
modrinth_key: ${{ secrets.MODRINTH_KEY }}
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java
index 4da17b6c0..c994980cd 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java
@@ -317,6 +317,9 @@ public interface ConfigObject {
int getAsyncSearchPartitionSize();
@ApiStatus.Experimental
+ boolean isPatchingAsyncThreadCrash();
+
+ @ApiStatus.Experimental
boolean doDebugSearchTimeRequired();
@Deprecated(forRemoval = true)
diff --git a/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinInputConstants.java b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinInputConstants.java
new file mode 100644
index 000000000..634c81339
--- /dev/null
+++ b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinInputConstants.java
@@ -0,0 +1,52 @@
+/*
+ * 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.mixin.fabric;
+
+import com.mojang.blaze3d.platform.InputConstants;
+import com.mojang.blaze3d.systems.RenderSystem;
+import me.shedaniel.rei.api.client.config.ConfigObject;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Unique;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(InputConstants.class)
+public class MixinInputConstants {
+ @Inject(method = "isKeyDown", at = @At("HEAD"), cancellable = true)
+ private static void isKeyDown(long windowId, int key, CallbackInfoReturnable<Boolean> cir) {
+ if (isPatchingAsyncThreadCrash() && !RenderSystem.isOnRenderThread()) {
+ cir.setReturnValue(false);
+ }
+ }
+
+ @Unique
+ private static boolean isPatchingAsyncThreadCrash() {
+ try {
+ return ConfigObject.getInstance().isPatchingAsyncThreadCrash();
+ } catch (Throwable throwable) {
+ return false;
+ }
+ }
+}
diff --git a/fabric/src/main/resources/rei.mixins.json b/fabric/src/main/resources/rei.mixins.json
index 7d240b971..3946fe5a8 100644
--- a/fabric/src/main/resources/rei.mixins.json
+++ b/fabric/src/main/resources/rei.mixins.json
@@ -6,6 +6,7 @@
"client": [
"MixinClientPacketListener",
"MixinEffectRenderingInventoryScreen",
+ "MixinInputConstants",
"MixinRecipeToast",
"MixinScreen"
],
diff --git a/fake/REIPlugin.class b/fake/REIPlugin.class
index 52c4432dc..83ddc0db7 100644
--- a/fake/REIPlugin.class
+++ b/fake/REIPlugin.class
Binary files differ
diff --git a/fake/REIPluginClient.class b/fake/REIPluginClient.class
new file mode 100644
index 000000000..b9b15aad1
--- /dev/null
+++ b/fake/REIPluginClient.class
Binary files differ
diff --git a/fake/REIPluginCommon.class b/fake/REIPluginCommon.class
new file mode 100644
index 000000000..1317a21b7
--- /dev/null
+++ b/fake/REIPluginCommon.class
Binary files differ
diff --git a/fake/REIPluginDedicatedServer.class b/fake/REIPluginDedicatedServer.class
new file mode 100644
index 000000000..251fa80ee
--- /dev/null
+++ b/fake/REIPluginDedicatedServer.class
Binary files differ
diff --git a/fake/REIPluginLoader.class b/fake/REIPluginLoader.class
new file mode 100644
index 000000000..e8112a583
--- /dev/null
+++ b/fake/REIPluginLoader.class
Binary files differ
diff --git a/fake/REIPluginLoaderClient.class b/fake/REIPluginLoaderClient.class
new file mode 100644
index 000000000..4a730e2eb
--- /dev/null
+++ b/fake/REIPluginLoaderClient.class
Binary files differ
diff --git a/fake/REIPluginLoaderCommon.class b/fake/REIPluginLoaderCommon.class
new file mode 100644
index 000000000..22e44c6b4
--- /dev/null
+++ b/fake/REIPluginLoaderCommon.class
Binary files differ
diff --git a/fake/REIPluginLoaderDedicatedServer.class b/fake/REIPluginLoaderDedicatedServer.class
new file mode 100644
index 000000000..46e006300
--- /dev/null
+++ b/fake/REIPluginLoaderDedicatedServer.class
Binary files differ
diff --git a/fake/mods.toml b/fake/mods.toml
new file mode 100644
index 000000000..6df8b4b18
--- /dev/null
+++ b/fake/mods.toml
@@ -0,0 +1,10 @@
+modLoader = "javafml"
+loaderVersion = "[1,)"
+logoFile = "icon.png"
+authors = "shedaniel"
+license = "MIT"
+
+[[mods]]
+modId = "rei_fake"
+version = "ABC"
+displayName = "THIS SHOULDN'T SHOW UP"
diff --git a/forge/build.gradle b/forge/build.gradle
index 52e011454..962677d6e 100644
--- a/forge/build.gradle
+++ b/forge/build.gradle
@@ -183,19 +183,29 @@ components.java {
publishing {
publications {
- mavenFabric(MavenPublication) {
+ mavenForge(MavenPublication) {
artifactId = rootProject.name + "-" + project.name
from components.java
}
["api", "default-plugin"].forEach { projectName ->
- create(projectName + "Fabric", MavenPublication.class) { publication ->
+ def remapSrg = tasks.create("remapSrgJarFor$projectName", net.fabricmc.loom.task.RemapJarTask) {
+ inputFile = project(":" + projectName).tasks.jar.archiveFile
+ classifier "srg-remapped-$projectName"
+ targetNamespace = "srg"
+ }
+ def remapSrgSourcesJar = tasks.create("remapSrgSourcesFor$projectName", net.fabricmc.loom.task.RemapSourcesJarTask) {
+ inputFile = project(":" + projectName).tasks.sourcesJar.archiveFile
+ classifier "srg-remapped-$projectName-sources"
+ targetNamespace = "srg"
+ }
+ create(projectName + "Forge", MavenPublication.class) { publication ->
publication.artifactId = rootProject.name + "-" + projectName + "-forge"
project.afterEvaluate {
def project = project(":" + projectName)
- publication.artifact(project.fakeForgeJar) { classifier null }
- def remapSourcesJarTask = project.remapSourcesJar
- publication.artifact(remapSourcesJarTask) {
- builtBy remapSourcesJarTask
+ remapSrg.inputFile = project.fakeForgeJar.archiveFile
+ publication.artifact(remapSrg) { classifier null }
+ publication.artifact(remapSrgSourcesJar) {
+ builtBy remapSrgSourcesJar
classifier "sources"
}
}
@@ -230,7 +240,7 @@ unifiedPublishing {
token = project.hasProperty("danielshe_curse_api_key") ? project.property("danielshe_curse_api_key") : System.getenv("danielshe_curse_api_key")
id = "310111"
gameVersions.addAll "Java 17"
-
+
relations {
depends "roughly-enough-items-hacks"
}
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
index 21397c373..6b432b932 100644
--- a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
+++ b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
@@ -23,6 +23,9 @@
package me.shedaniel.rei.forge;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
import dev.architectury.platform.forge.EventBuses;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.common.plugins.PluginManager;
@@ -40,16 +43,16 @@ import me.shedaniel.rei.plugin.common.runtime.DefaultRuntimePlugin;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
+import net.minecraftforge.fml.loading.FMLEnvironment;
+import org.jetbrains.annotations.NotNull;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
import java.util.function.Supplier;
public class PluginDetectorImpl implements PluginDetector {
private static <P extends me.shedaniel.rei.api.common.plugins.REIPlugin<?>> REIPluginProvider<P> wrapPlugin(List<String> modId, REIPluginProvider<P> plugin) {
return new REIPluginProvider<P>() {
- String nameSuffix = " [" + String.join(", ", modId) + "]";
+ final String nameSuffix = " [" + String.join(", ", modId) + "]";
@Override
public Collection<P> provide() {
@@ -68,22 +71,108 @@ public class PluginDetectorImpl implements PluginDetector {
};
}
+ private static final Supplier<List<Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>>>> loaderProvided =
+ Suppliers.memoize(() -> getPluginsLoader(REIPluginLoader.class));
+ private static final Supplier<List<Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>>>> loaderProvidedCommon =
+ Suppliers.memoize(() -> getPluginsLoader(REIPluginLoaderCommon.class));
+ private static final Supplier<List<Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>>>> loaderProvidedDist;
+
+ static {
+ Supplier<List<Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>>>> dist;
+ if (FMLEnvironment.dist == Dist.CLIENT) {
+ dist = Suppliers.memoize(() -> getPluginsLoader(REIPluginLoaderClient.class));
+ } else if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) {
+ dist = Suppliers.memoize(() -> getPluginsLoader(REIPluginLoaderDedicatedServer.class));
+ } else throw new IllegalStateException("Unknown environment: " + FMLEnvironment.dist);
+ loaderProvidedDist = dist;
+ }
+
+ @NotNull
+ private static <T, P extends me.shedaniel.rei.api.common.plugins.REIPlugin<?>> List<Map.Entry<REIPluginProvider<P>, List<String>>> getPluginsLoader(Class<T> annotation) {
+ List<Map.Entry<REIPluginProvider<P>, List<String>>> list = new ArrayList<>();
+ AnnotationUtils.<T, REIPluginProvider<P>>scanAnnotation(annotation, REIPluginProvider.class::isAssignableFrom, (modId, provider, clazz) -> {
+ try {
+ list.add(new AbstractMap.SimpleEntry<>(provider.get(), modId));
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
+ });
+ return list;
+ }
+
@Override
public void detectServerPlugins() {
PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultPluginImpl()));
PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultRuntimePlugin()));
- // PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new JEIExtraPlugin()));
+
+ // Legacy Annotation
AnnotationUtils.<REIPlugin, REIServerPlugin>scanAnnotation(REIPlugin.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
});
+
+ // Common plugins
+ AnnotationUtils.<REIPluginCommon, REIServerPlugin>scanAnnotation(REIPluginCommon.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ });
+
+ // Dist plugins
+ if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) {
+ AnnotationUtils.<REIPluginDedicatedServer, REIServerPlugin>scanAnnotation(REIPluginDedicatedServer.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ });
+ } else {
+ AnnotationUtils.<REIPluginClient, REIServerPlugin>scanAnnotation(REIPluginClient.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ });
+ }
+
+ // Loaders
+ for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvided.get()) {
+ ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REIServerPlugin.class)));
+ }
+ for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvidedCommon.get()) {
+ ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REIServerPlugin.class)));
+ }
+ for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvidedDist.get()) {
+ ((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REIServerPlugin.class)));
+ }
}
@Override
public void detectCommonPlugins() {
EventBuses.registerModEventBus("roughlyenoughitems", FMLJavaModLoadingContext.get().getModEventBus());
+
+ // Legacy Annotation
AnnotationUtils.<REIPlugin, me.shedaniel.rei.api.common.plugins.REIPlugin<?>>scanAnnotation(REIPlugin.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
});
+
+ // Common plugins
+ AnnotationUtils.<REIPluginCommon, me.shedaniel.rei.api.common.plugins.REIPlugin<?>>scanAnnotation(REIPluginCommon.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ });
+
+ // Dist plugins
+ if (FMLEnvironment.dist == Dist.CLIENT) {
+ AnnotationUtils.<REIPluginClient, me.shedaniel.rei.api.common.plugins.REIPlugin>scanAnnotation(REIPluginClient.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ });
+ } else if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) {
+ AnnotationUtils.<REIPluginDedicatedServer, me.shedaniel.rei.api.common.plugins.REIPlugin>scanAnnotation(REIPluginDedicatedServer.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ });
+ }
+
+ // Loaders
+ for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvided.get()) {
+ ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(entry.getValue(), entry.getKey()));
+ }
+ for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvidedCommon.get()) {
+ ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(entry.getValue(), entry.getKey()));
+ }
+ for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvidedDist.get()) {
+ ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(entry.getValue(), entry.getKey()));
+ }
}
@OnlyIn(Dist.CLIENT)
@@ -95,21 +184,61 @@ public class PluginDetectorImpl implements PluginDetector {
PluginView.getClientInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultRuntimeInputMethodPlugin()));
PluginView.getClientInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultClientTransferCategoryPlugin()));
PluginView.getClientInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new FavoritesEntriesBuiltinPlugin()));
- // PluginView.getClientInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new JEIExtraClientPlugin()));
+
+ // Legacy Annotation
AnnotationUtils.<REIPlugin, REIClientPlugin>scanAnnotation(REIPlugin.class, REIClientPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
((PluginView<REIClientPlugin>) PluginManager.getClientInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
});
-// ClientInternals.attachInstance((Supplier<List<String>>) () -> {
-// List<String> modIds = new ArrayList<>();
-// for (REIPluginProvider<REIClientPlugin> plugin : PluginManager.getClientInstance().getPluginProviders()) {
-// if (plugin instanceof JEIPluginDetector.JEIPluginProvider) {
-// modIds.addAll(((JEIPluginDetector.JEIPluginProvider) plugin).modIds);
-// }
-// }
-// return modIds;
-// }, "jeiCompatMods");
-// JEIPluginDetector.detect((aClass, consumer) -> AnnotationUtils.scanAnnotation((Class<Object>) aClass, c -> true,
-// (TriConsumer<List<String>, Supplier<Object>, Class<Object>>) (TriConsumer) consumer), PluginView.getClientInstance()::registerPlugin);
+
+ // Common plugins
+ AnnotationUtils.<REIPluginCommon, REIClientPlugin>scanAnnotation(REIPluginCommon.class, REIClientPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ ((PluginView<REIClientPlugin>) PluginManager.getClientInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ });
+
+ // Dist plugins
+ AnnotationUtils.<REIPluginClient, REIClientPlugin>scanAnnotation(REIPluginClient.class, REIClientPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
+ ((PluginView<REIClientPlugin>) PluginManager.getClientInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
+ });
+
+ // Loaders
+ for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvided.get()) {
+ ((PluginView<REIClientPlugin>) PluginManager.getClientInstance()).registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REIClientPlugin.class)));
+ }
+ for (Map.Entry<REIPluginProvider<me.shedaniel.rei.api.common.plugins.REIPlugin<?>>, List<String>> entry : loaderProvidedCommon.get()) {
+ ((PluginView<REIClientPlugin>) PluginManager.getClientInstance()).registerPlugin(wrapPlugin(entry.getValue(), wrapAndFilter(entry.getKey(), REIClientPlug