-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anvil recipies with NBT tags or anyDamage as input #21
Comments
I used the term appendEnchantment() because if the item being crafted already has nbt data, say from a mod or other preset nbt data then the goal would be not to overwrite that nbt data, just append the enchantments. Additionally the anyDamage() method would be helpful to create repair recipes. Example: |
Is |
I just made up "item.copyEnchantments()" as an example of the feature I was looking for. It does not exist. Crafttweaker does support recipe enchantment copy in a complex method, see ( https://docs.blamejared.com/en/#Vanilla/Recipes/Crafting/Recipe_Functions/ ) but it not the simplest method. I don't believe Rocky Core Anvil recipes supports anything like this? Basically just like when you repair an item in the Anvil your get back the same item with increased durability with all the same NBT data. I was hoping that the anvil recipe would allow a similar method for repairing items or a way to upgrade them and keep their NBT data. |
Would you be willing to test out a build updated to support item conditions with some of your planed recipes? The enchantment thing is going to take some serious digging to see if it's even viable without an extra parameter which wouldn't be as flexible as being able to tag items in the recipe. |
Sure. I am packing today for a 8 day road trip through, leaving tomorrow at 6am. So, definitely will help, but it will be after next Sunday when I can take a look. |
If you would like to test this feature and provide feedback, a build is available here: https://github.com/DevOnTheRocks/RockyTweaks/releases/tag/0.6.0-PRE-RELEASE-1 |
I am testing your pre-release. The Item Conditions , i've tested <>.anyDamage() and it is working. for example. Anvil.addRecipe(minecraft:golden_sword:*.anyDamage(), minecraft:diamond * 4, minecraft:diamond_sword, 8); This works as expected. I can use a golden sword with any damage and get a new diamond sword. |
I either do not understand your needed syntax for IRecipeFunction or this feature is not working. Here's my code. Anvil.addRecipe(minecraft:golden_sword:*.anyDamage(), minecraft:diamond * 4, minecraft:diamond_sword, 8, function(out, ins, crafting){
when I place the input ingredients into the Anvil I get an error message printed in the chat log repeated eight times. ERROR: Could not execute RecipeFunction: |
the above syntax for the function(out, ins, crafting) works in crafttweaker for recipe.addshaped |
I also tried to use the funciton with out the item condition and got the same error message. Code:
|
FYI, I'm pasting in the code, but the form is stripping out the greater than and less than brackets. |
Try using a code block:
Also, ins should have |
Both features work now on client only game, awesome! Tested with mod items also. I will be testing on server/client next. Here's the code that worked:
|
tested client/server no issues with mod'd and vanilla items, worked as expected with the previously posted code. |
Glad to hear. What's your thoughts on me making a custom function instead of reusing the one from crafting table recipes? The Crafting Info parameter is completely useless and I feel like the input thing can be confusing. I could make a anvil specific function like |
I've actually used the crafting parameter for checking things like a players xp crafting.player.xp
|
I would probably leave it because it offers a more universal option that aligns with crafttweaker syntax. If someone wants to implement something in crafttweaker or rockytweaks they would already understand the syntax. |
What I think would be a great addition to creafttweaker that could be inherited by your mod would be a way to more easily handle NBT data from input to output items, simliar to
I would prefer to have options to append or replace nbt data because I have mods that have custom NBT data already added from within the class definition that I would not want to replace. really, you've done a great job and I'm using your pre-release now, it does exactly what I was looking for, and it's just a matter of understanding the function parameter for crafting and how it works. |
If you already have this feature and I missed it I apologize.
When creating an anvil recipe I want to set the input as an item with any damage.
Example:
Anvil.addRecipe(minecraft:golden_sword.anyDamage(), minecraft:diamond * 2, minecraft:diamond_sword, 2);
Then I would get out a diamond sword with full durability using a gold sword with any durability.
Additionally I would like to pass enchantments from one item to the next in the anvil recipes.
Example:
Anvil.addRecipe(minecraft:golden_sword.copyEnchantments(), minecraft:diamond * 2, minecraft:diamond_sword.appendEnchantments(), 2);
So If I put a gold sword with smite I would get out a diamond sword with smite.
The text was updated successfully, but these errors were encountered: