From c0662b7aa58ef01822c7bd5a2003ffc38aef74d6 Mon Sep 17 00:00:00 2001 From: BrokenK3yboard <63761658+BrokenK3yboard@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:08:07 -0600 Subject: [PATCH] Remove deprecated methods --- .../zeta/util/handler/RecipeCrawlHandler.java | 34 +++++-------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/src/main/java/org/violetmoon/zeta/util/handler/RecipeCrawlHandler.java b/src/main/java/org/violetmoon/zeta/util/handler/RecipeCrawlHandler.java index 1599a77..3c7feb0 100644 --- a/src/main/java/org/violetmoon/zeta/util/handler/RecipeCrawlHandler.java +++ b/src/main/java/org/violetmoon/zeta/util/handler/RecipeCrawlHandler.java @@ -1,13 +1,10 @@ package org.violetmoon.zeta.util.handler; import java.util.ArrayList; -import java.util.Collection; import java.util.List; -import java.util.function.Consumer; import net.minecraft.world.item.crafting.*; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; import org.violetmoon.zeta.Zeta; import org.violetmoon.zeta.event.bus.IZetaPlayEvent; import org.violetmoon.zeta.event.bus.LoadEvent; @@ -92,19 +89,15 @@ private static void load(RecipeManager manager, RegistryAccess access) { if (recipe.getResultItem(access) == null) throw new IllegalStateException("Recipe getResultItem is null"); - ZRecipeCrawl.Visit event; - if (recipe instanceof ShapedRecipe) - event = new ZRecipeCrawl.Visit.Shaped((RecipeHolder) recipeHolder, access); - else if (recipe instanceof ShapelessRecipe) - event = new ZRecipeCrawl.Visit.Shapeless((RecipeHolder) recipeHolder, access); - else if (recipe instanceof CustomRecipe) - event = new ZRecipeCrawl.Visit.Custom((RecipeHolder) recipeHolder, access); - else if (recipe instanceof AbstractCookingRecipe) - event = new ZRecipeCrawl.Visit.Cooking((RecipeHolder) recipeHolder, access); - else - event = new ZRecipeCrawl.Visit.Misc((RecipeHolder>) recipeHolder, access); + ZRecipeCrawl.Visit event = switch (recipe) { + case ShapedRecipe shaped -> new ZRecipeCrawl.Visit.Shaped((RecipeHolder) recipeHolder, access); + case ShapelessRecipe shapeless -> new ZRecipeCrawl.Visit.Shapeless((RecipeHolder) recipeHolder, access); + case CustomRecipe custom -> new ZRecipeCrawl.Visit.Custom((RecipeHolder) recipeHolder, access); + case AbstractCookingRecipe cooking -> new ZRecipeCrawl.Visit.Cooking((RecipeHolder) recipeHolder, access); + default -> new ZRecipeCrawl.Visit.Misc((RecipeHolder>) recipeHolder, access); + }; - //misc recipes could have custom logic that we cant make many assumptions on. For example FD cutting board recipes are lossy. + //misc recipes could have custom logic that we cant make many assumptions on. For example FD cutting board recipes are lossy. //for instance a hanging sign can be cut into a plank. A hanging sign is magnetic but this does not mean planks are if(!(event instanceof ZRecipeCrawl.Visit.Misc)) { vanillaRecipesToLazyDigest.add(recipe); @@ -114,7 +107,7 @@ else if (recipe instanceof AbstractCookingRecipe) if (recipeHolder == null) Zeta.GLOBAL_LOG.error("Encountered null recipe in RecipeManager.getRecipes. This is not good"); else - Zeta.GLOBAL_LOG.error("Failed to scan recipe " + recipeHolder.id() + ". This should be reported to " + recipeHolder.id().getNamespace() + "!", e); + Zeta.GLOBAL_LOG.error("Failed to scan recipe {}. This should be reported to {}!", recipeHolder.id(), recipeHolder.id().getNamespace(), e); } } } @@ -159,13 +152,4 @@ private static void digest(Recipe recipe, RegistryAccess access) { } } } - - //delete this if you see it. Just here so this update doesnt crash with an old quark version - @Deprecated(forRemoval = true) - public void recursivelyFindCraftedItemsFromStrings(@Nullable Collection derivationList, @Nullable Collection whitelist, @Nullable Collection blacklist, Consumer callback) { - } - - @Deprecated(forRemoval = true) - public void recursivelyFindCraftedItems(@Nullable Collection derivationList, @Nullable Collection whitelist, @Nullable Collection blacklist, Consumer callback) { - } }