-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
785196a
commit e1cea00
Showing
8 changed files
with
53 additions
and
121 deletions.
There are no files selected for viewing
58 changes: 0 additions & 58 deletions
58
src/main/java/net/frozenblock/lib/recipe/mixin/CraftingRecipeCodecsMixin.java
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
src/main/java/net/frozenblock/lib/recipe/mixin/ItemValueMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/net/frozenblock/lib/recipe/mixin/ShapedRecipeMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2023 FrozenBlock | ||
* This file is part of FrozenLib. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package net.frozenblock.lib.recipe.mixin; | ||
|
||
import com.google.gson.JsonObject; | ||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import com.mojang.serialization.JsonOps; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.crafting.ShapedRecipe; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
/** | ||
* Adds {@link CompoundTag} data support to crafting recipes. | ||
* @since 1.4.1 | ||
*/ | ||
@Mixin(ShapedRecipe.class) | ||
public class ShapedRecipeMixin { | ||
|
||
@ModifyReturnValue(method = "itemStackFromJson", at = @At("RETURN")) | ||
private static ItemStack itemStackFromJson(ItemStack stack, JsonObject stackObject) { | ||
if (stackObject.has("tag")) | ||
stack.setTag(CompoundTag.CODEC.decode(JsonOps.INSTANCE, stackObject.get("tag")).getOrThrow(false, error -> {}).getFirst()); | ||
return stack; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters