blob: 0b7bc19c07f6baa077303b9dfe3770e8a789aa39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package me.shedaniel.rei;
import info.tehnut.pluginloader.LoaderCreator;
import info.tehnut.pluginloader.PluginLoaderBuilder;
import info.tehnut.pluginloader.ValidationStrategy;
import me.shedaniel.rei.api.IRecipePlugin;
import net.fabricmc.loader.language.LanguageAdapter;
import net.fabricmc.loader.language.LanguageAdapterException;
import net.minecraft.util.Identifier;
public class RoughlyEnoughItemsPlugins implements LoaderCreator {
@Override
public void createLoaders() {
LanguageAdapter.Options instantiationOptions = new LanguageAdapter.Options();
new PluginLoaderBuilder("roughlyenoughitems").withValidator(ValidationStrategy.hasInterface(IRecipePlugin.class)).withInitializer((aClass, container) -> {
Identifier id = new Identifier(container.getOwner().getInfo().getId(), container.getInfo().getId());
try {
IRecipePlugin plugin = (IRecipePlugin) container.getOwner().getAdapter().createInstance(aClass, instantiationOptions);
RoughlyEnoughItemsCore.registerPlugin(id, plugin);
} catch (LanguageAdapterException e) {
RoughlyEnoughItemsCore.LOGGER.error("REI: Error loading plugin %s", id, e);
}
}).build();
}
}
|