Jump to content

[1.19.4] How to create custom anvil recipes?


JimiIT92

Recommended Posts

I'm trying to create a custom anvil recipe, to make so when you combine two items you get a new one (kinda like the pre 1.20 smithing table recipe system, but for the anvil). So I was curious to see if there is a way to make the recipe like usual, with a json file specifying the recipe type.

Apparently there's currently no way of doing this (at least in vanilla Minecraft), so I'm wondering how can you create such recipes? Is there a custom forge recipe type that you can use? Or you have to rely on the AnvilUpdateEvent only?

Edited by JimiIT92
Found out that mixins doesn't actually works for this case, so the event is left

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Quote

Apparently there's currently no way of doing this (at least in vanilla Minecraft), so I'm wondering how can you create such recipes?

Correct there are no recipes for the anvil. The logic is hardwired, see AnvilMenu.createResult()

Quote

Is there a custom forge recipe type that you can use? Or you have to rely on the AnvilUpdateEvent only?

Forge does not have one. I guess you could try to implement this yourself?

You would need a RecipeSerializer that lets you parse and load recipes for the Anvil using a new RecipeType.

You would then check these recipes in the AnvilUpdateEvent using RecipeManager.getRecipeFor().

To get the recipe manager: player.level -> ServerLevel -> Server -> RecipeManager

 

The devil is always in the detail. There is probably a reason why Mojang or Forge haven't already done this? 🙂

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Yeah, maybe that would break things... Will try at some point to do so to see if I can add this. Meanwhile what I've tried is to listen to the event, check the ingredients and if they matches two items for a custom recipe I set the output of the event to the desired result. However for some reason I see the output but can't pick up from the anvil

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.