diff options
Diffstat (limited to 'src/main/java/lv/enes/mc/eris_alchemy/EmcLoader.java')
| -rw-r--r-- | src/main/java/lv/enes/mc/eris_alchemy/EmcLoader.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/lv/enes/mc/eris_alchemy/EmcLoader.java b/src/main/java/lv/enes/mc/eris_alchemy/EmcLoader.java index dd4613f..373e561 100644 --- a/src/main/java/lv/enes/mc/eris_alchemy/EmcLoader.java +++ b/src/main/java/lv/enes/mc/eris_alchemy/EmcLoader.java | |||
| @@ -2,6 +2,8 @@ package lv.enes.mc.eris_alchemy; | |||
| 2 | 2 | ||
| 3 | import com.google.gson.reflect.TypeToken; | 3 | import com.google.gson.reflect.TypeToken; |
| 4 | import jakarta.annotation.Nonnull; | 4 | import jakarta.annotation.Nonnull; |
| 5 | import lv.enes.mc.eris_alchemy.recipe.BannedRecipe; | ||
| 6 | import lv.enes.mc.eris_alchemy.recipe.SimplifiedRecipe; | ||
| 5 | import net.minecraft.resources.ResourceLocation; | 7 | import net.minecraft.resources.ResourceLocation; |
| 6 | import net.minecraft.server.packs.resources.ResourceManager; | 8 | import net.minecraft.server.packs.resources.ResourceManager; |
| 7 | import org.quiltmc.qsl.resource.loader.api.reloader.SimpleSynchronousResourceReloader; | 9 | import org.quiltmc.qsl.resource.loader.api.reloader.SimpleSynchronousResourceReloader; |
| @@ -30,7 +32,9 @@ public class EmcLoader implements SimpleSynchronousResourceReloader { | |||
| 30 | 32 | ||
| 31 | var fakeRecipes = loadAllFiles(manager, "fake_recipes", new ArrayList<>(), EmcLoader::loadFakeRecipes); | 33 | var fakeRecipes = loadAllFiles(manager, "fake_recipes", new ArrayList<>(), EmcLoader::loadFakeRecipes); |
| 32 | 34 | ||
| 33 | Emc.reloadData(itemValues, itemTagValues, blockTagValues, fakeRecipes); | 35 | var bannedRecipes = loadAllFiles(manager, "cycle_cut", new ArrayList<>(), EmcLoader::loadBannedRecipes); |
| 36 | |||
| 37 | Emc.reloadData(itemValues, itemTagValues, blockTagValues, fakeRecipes, bannedRecipes); | ||
| 34 | } | 38 | } |
| 35 | 39 | ||
| 36 | private static <T> T loadAllFiles( | 40 | private static <T> T loadAllFiles( |
| @@ -58,6 +62,15 @@ public class EmcLoader implements SimpleSynchronousResourceReloader { | |||
| 58 | return arg; | 62 | return arg; |
| 59 | } | 63 | } |
| 60 | 64 | ||
| 65 | private static void loadBannedRecipes(List<BannedRecipe> recipes, ResourceLocation id, InputStream is) | ||
| 66 | throws IOException | ||
| 67 | { | ||
| 68 | try (var reader = new InputStreamReader(is)) { | ||
| 69 | var json = GSON.fromJson(reader, new TypeToken<List<BannedRecipe>>(){}); | ||
| 70 | recipes.addAll(json); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 61 | private static void loadEmcValues(Map<ResourceLocation, OptionalDouble> map, ResourceLocation id, InputStream is) | 74 | private static void loadEmcValues(Map<ResourceLocation, OptionalDouble> map, ResourceLocation id, InputStream is) |
| 62 | throws IOException | 75 | throws IOException |
| 63 | { | 76 | { |