aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java
blob: ca009695b3cb7c07a7161579656dd07c2649da11 (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
package me.shedaniel.rei.server;

import com.google.common.collect.Maps;
import net.minecraft.container.Container;
import net.minecraft.util.Identifier;

import java.util.Map;

public class ContainerInfoHandler {
    private static final Map<Identifier, Map<Class<? extends Container>, ContainerInfo>> containerInfoMap = Maps.newHashMap();
    
    public static void registerContainerInfo(Identifier category, ContainerInfo containerInfo) {
        if (!containerInfoMap.containsKey(category))
            containerInfoMap.put(category, Maps.newHashMap());
        containerInfoMap.get(category).put(containerInfo.getContainerClass(), containerInfo);
    }
    
    public static boolean isCategoryHandled(Identifier category) {
        return containerInfoMap.containsKey(category) && !containerInfoMap.get(category).isEmpty();
    }
    
    public static ContainerInfo getContainerInfo(Identifier category, Class<?> containerClass) {
        return containerInfoMap.get(category).get(containerClass);
    }
}