aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/api/RoughlyEnoughItemsPlugin.java
blob: 9930ca63fc1dd7ce5a2bfbb6c060995af4fb5775 (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
28
29
30
31
32
33
34
35
36
37
38
39
package me.shedaniel.rei.api;

import com.google.common.collect.Maps;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.plugin.DefaultPlugin;
import net.minecraft.util.ResourceLocation;
import org.dimdev.riftloader.listener.InitializationListener;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class RoughlyEnoughItemsPlugin implements InitializationListener {
    
    private static final Map<ResourceLocation, IRecipePlugin> plugins = Maps.newHashMap();
    public static final ResourceLocation DEFAULT_PLUGIN = new ResourceLocation("roughlyenoughitems", "default_plugin");
    
    public static IRecipePlugin registerPlugin(ResourceLocation ResourceLocation, IRecipePlugin plugin) {
        plugins.put(ResourceLocation, plugin);
        return plugin;
    }
    
    public static List<IRecipePlugin> getPlugins() {
        return new LinkedList<>(plugins.values());
    }
    
    public static ResourceLocation getPluginResourceLocation(IRecipePlugin plugin) {
        for(ResourceLocation ResourceLocation : plugins.keySet())
            if (plugins.get(ResourceLocation).equals(plugin))
                return ResourceLocation;
        return null;
    }
    
    @Override
    public void onInitialization() {
        RoughlyEnoughItemsPlugin.registerPlugin(RoughlyEnoughItemsPlugin.DEFAULT_PLUGIN, new DefaultPlugin());
    }
    
}