Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Treetrain1 committed Nov 12, 2023
1 parent f0d46e6 commit 4e160b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.frozenblock.lib.recipe.api.ShapedRecipeBuilderExtension;
import net.minecraft.advancements.AdvancementHolder;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.ShapedRecipe;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
Expand Down Expand Up @@ -57,9 +60,9 @@ public class ShapedRecipeBuilderMixin implements ShapedRecipeBuilderExtension {
target = "Lnet/minecraft/data/recipes/RecipeOutput;accept(Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/world/item/crafting/Recipe;Lnet/minecraft/advancements/AdvancementHolder;)V"
)
)
private void modifySave(RecipeOutput instance, ResourceLocation recipe, Operation<?> operation) {
private void modifySave(RecipeOutput instance, ResourceLocation recipeId, Recipe<?> recipe, AdvancementHolder holder, Operation<ShapedRecipe> operation) {
((ShapedRecipeBuilderExtension) recipe).frozenLib$tag(this.tag);
operation.call(instance, recipe);
operation.call(instance, recipeId, recipe, holder);
}

/*@Mixin(ShapedRecipeBuilder.Result.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,29 @@
import net.frozenblock.lib.recipe.api.ShapedRecipeBuilderExtension;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.ShapedRecipe;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;

@Mixin(ShapedRecipe.class)
public class ShapedRecipeMixin implements ShapedRecipeBuilderExtension {

@Unique
@Nullable
private CompoundTag tag;
@Shadow
@Final
ItemStack result;

@Override
public ShapedRecipeBuilder frozenLib$tag(@Nullable CompoundTag tag) {
this.tag = tag;
this.result.setTag(tag);
return null;
}

@Override
public @Nullable CompoundTag frozenLib$getTag() {
return this.tag;
return this.result.getTag();
}
}
3 changes: 2 additions & 1 deletion src/main/resources/mixin/frozenlib.recipe.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"mixins": [
"ItemStackMixin",
"ItemValueMixin",
"ShapedRecipeBuilderMixin"
"ShapedRecipeBuilderMixin",
"ShapedRecipeMixin"
]
}

0 comments on commit 4e160b2

Please sign in to comment.