diff options
| author | shedaniel <daniel@shedaniel.me> | 2020-08-27 19:36:00 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2020-08-27 19:36:50 +0800 |
| commit | 6104964f60bac00a4ac1359bd244d361e50786bd (patch) | |
| tree | 04bf0350e7305633436bb133e8647f0cecce0bf5 /RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java | |
| parent | 935417891d62500610fb05ce75dc8d63219c39d2 (diff) | |
| download | RoughlyEnoughItems-6104964f60bac00a4ac1359bd244d361e50786bd.tar.gz RoughlyEnoughItems-6104964f60bac00a4ac1359bd244d361e50786bd.tar.bz2 RoughlyEnoughItems-6104964f60bac00a4ac1359bd244d361e50786bd.zip | |
Migrate from yarn to mojmap
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java')
| -rw-r--r-- | RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java index c6214092e..fdfeba33c 100644 --- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java +++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/server/ContainerInfoHandler.java @@ -24,16 +24,16 @@ package me.shedaniel.rei.server; import com.google.common.collect.Maps; -import net.minecraft.container.Container; -import net.minecraft.util.Identifier; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.inventory.AbstractContainerMenu; import org.jetbrains.annotations.ApiStatus; import java.util.Map; public class ContainerInfoHandler { - private static final Map<String, Map<Class<? extends Container>, ContainerInfo<? extends Container>>> containerInfoMap = Maps.newLinkedHashMap(); + private static final Map<String, Map<Class<? extends AbstractContainerMenu>, ContainerInfo<? extends AbstractContainerMenu>>> containerInfoMap = Maps.newLinkedHashMap(); - public static void registerContainerInfo(Identifier category, ContainerInfo<? extends Container> containerInfo) { + public static void registerContainerInfo(ResourceLocation category, ContainerInfo<? extends AbstractContainerMenu> containerInfo) { registerScreenWithHandlerInfo(category, containerInfo); } @@ -42,23 +42,23 @@ public class ContainerInfoHandler { */ @Deprecated @ApiStatus.ScheduledForRemoval - public static void registerScreenWithHandlerInfo(Identifier category, ContainerInfo<? extends Container> containerInfo) { + public static void registerScreenWithHandlerInfo(ResourceLocation category, ContainerInfo<? extends AbstractContainerMenu> containerInfo) { if (!containerInfoMap.containsKey(category.toString())) containerInfoMap.put(category.toString(), Maps.newLinkedHashMap()); containerInfoMap.get(category.toString()).put(containerInfo.getContainerClass(), containerInfo); } - public static boolean isCategoryHandled(Identifier category) { + public static boolean isCategoryHandled(ResourceLocation category) { return containerInfoMap.containsKey(category.toString()) && !containerInfoMap.get(category.toString()).isEmpty(); } - public static ContainerInfo<? extends Container> getContainerInfo(Identifier category, Class<?> containerClass) { + public static ContainerInfo<? extends AbstractContainerMenu> getContainerInfo(ResourceLocation category, Class<?> containerClass) { if (!isCategoryHandled(category)) return null; - Map<Class<? extends Container>, ContainerInfo<? extends Container>> infoMap = containerInfoMap.get(category.toString()); + Map<Class<? extends AbstractContainerMenu>, ContainerInfo<? extends AbstractContainerMenu>> infoMap = containerInfoMap.get(category.toString()); if (infoMap.containsKey(containerClass)) return infoMap.get(containerClass); - for (Map.Entry<Class<? extends Container>, ContainerInfo<? extends Container>> entry : infoMap.entrySet()) + for (Map.Entry<Class<? extends AbstractContainerMenu>, ContainerInfo<? extends AbstractContainerMenu>> entry : infoMap.entrySet()) if (entry.getKey().isAssignableFrom(containerClass)) return entry.getValue(); return null; |
