From 63ccdd3be54a57dd2a70775d426ac8d0496d379b Mon Sep 17 00:00:00 2001 From: mose Date: Fri, 3 Jan 2025 20:49:49 +0000 Subject: [PATCH] Reverted to just fix --- .../item/crafting/RecipeManagerMixin_API.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/item/crafting/RecipeManagerMixin_API.java b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/item/crafting/RecipeManagerMixin_API.java index 302ab6b23e0..84be7c7913c 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/item/crafting/RecipeManagerMixin_API.java +++ b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/item/crafting/RecipeManagerMixin_API.java @@ -52,30 +52,31 @@ public abstract class RecipeManagerMixin_API implements RecipeManager { // @formatter:off - @Shadow public abstract Optional> shadow$byKey(ResourceLocation recipeId); + @Shadow public abstract Optional> shadow$byKey(ResourceLocation recipeId); @Shadow protected abstract > Collection> shadow$byType(net.minecraft.world.item.crafting.RecipeType recipeTypeIn); - @Shadow public abstract Collection> shadow$getRecipes(); - @Shadow public abstract > Optional shadow$getRecipeFor(net.minecraft.world.item.crafting.RecipeType recipeTypeIn, I inventoryIn, net.minecraft.world.level.Level worldIn); + @Shadow public abstract Collection> shadow$getRecipes(); + @Shadow public abstract > Optional> shadow$getRecipeFor(net.minecraft.world.item.crafting.RecipeType recipeTypeIn, I inventoryIn, net.minecraft.world.level.Level worldIn); // @formatter:on + @SuppressWarnings({"DataFlowIssue", "unchecked"}) @Override public Optional> byKey(final ResourceKey key) { Objects.requireNonNull(key); - return this.shadow$byKey((ResourceLocation) (Object) key).map(Recipe.class::cast); + return this.shadow$byKey((ResourceLocation) (Object) key).map(RecipeHolder::value).map(Recipe.class::cast); } @Override @SuppressWarnings(value = {"unchecked", "rawtypes"}) public Collection> all() { - return (Collection) this.shadow$getRecipes(); + return (Collection) this.shadow$getRecipes().stream().map(RecipeHolder::value).toList(); } @Override @SuppressWarnings(value = {"unchecked", "rawtypes"}) public > Collection allOfType(final RecipeType type) { Objects.requireNonNull(type); - return this.shadow$byType((net.minecraft.world.item.crafting.RecipeType)type); + return this.shadow$byType((net.minecraft.world.item.crafting.RecipeType)type).stream().map(h -> ((RecipeHolder)h).value()).toList(); } @Override @@ -115,6 +116,6 @@ public Optional findCookingRecipe(final RecipeType< Objects.requireNonNull(ingredient); final SingleRecipeInput input = new SingleRecipeInput(ItemStackUtil.fromLikeToNative(ingredient)); - return this.shadow$getRecipeFor((net.minecraft.world.item.crafting.RecipeType) type, input, null); + return this.shadow$getRecipeFor((net.minecraft.world.item.crafting.RecipeType) type, input, null).map(h -> ((RecipeHolder)h).value()); } }