ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/util/ResourceReloader.java

40 lines
1.7 KiB
Java
Raw Normal View History

2021-10-23 20:17:04 +02:00
package de.ellpeck.actuallyadditions.mod.util;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
2022-01-19 02:11:23 +01:00
import net.minecraft.item.crafting.IRecipeType;
2021-10-23 20:17:04 +02:00
import net.minecraft.item.crafting.RecipeManager;
import net.minecraft.resources.DataPackRegistries;
import net.minecraft.resources.IResourceManager;
2021-12-30 18:30:01 +01:00
import net.minecraft.resources.IResourceManagerReloadListener;
2021-10-23 20:17:04 +02:00
2022-01-19 02:11:23 +01:00
import java.util.List;
2021-12-30 18:30:01 +01:00
@SuppressWarnings("deprecation")
public class ResourceReloader implements IResourceManagerReloadListener {
2021-10-23 20:17:04 +02:00
private final DataPackRegistries data;
public ResourceReloader(DataPackRegistries dataPackRegistries) {
data = dataPackRegistries;
}
@Override
2021-12-30 18:30:01 +01:00
public void onResourceManagerReload(IResourceManager pResourceManager) {
2021-10-23 20:17:04 +02:00
RecipeManager recipeManager = data.getRecipeManager();
ActuallyAdditionsAPI.EMPOWERER_RECIPES.clear();
ActuallyAdditionsAPI.EMPOWERER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING));
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.clear();
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.SOLID_FUEL));
2022-01-07 00:16:37 +01:00
ActuallyAdditionsAPI.PRESSING_RECIPES.clear();
ActuallyAdditionsAPI.PRESSING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.PRESSING));
2022-01-15 19:38:00 +01:00
ActuallyAdditionsAPI.FERMENTING_RECIPES.clear();
ActuallyAdditionsAPI.FERMENTING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.FERMENTING));
2022-01-19 02:11:23 +01:00
ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.clear();
ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LASER));
2021-10-23 20:17:04 +02:00
}
}