#Adding nbt data to a recipe or mixin to a custom recipe

13 messages · Page 1 of 1 (latest)

radiant junco
#

I have a recipe for an vanilla item.

I want the craftet item tho, to have a specific name and also some custom data in it (thats persistantly stored).
The problem I am facing is that from my research, I cannot modify the result item to have custom data in the recipe itself.
So my thought was, I could mixin to the crafing process, check if the recipe used is mine and if so modify the item that was crafted.

The problem with the second attempt is that I cant find an applicable method for that to mixin. Using 1.12.1 btw.

Would appreciate some help here and maybe a short explanaition to how you found a good spot to mixin.
Thanks in advance :)

sand pumice
#

The method should either be “getResult” or “craft”

#

Explanation:
I’ve been working on custom recipes, so I have a good understanding of where things are…
I know that the getResult function is used in the recipe book, and the “toast” that pops up if you don’t have the “advancement” for that recipe… (both client side)

The craft function is run when they click on the crafted item…

Probably you want that one. As it is the last place to mess with things. It would be helpful to know what data you hope to add… as there’s a good chance making a custom recipe is the easier option…

radiant junco
#

I dont think making a custom recipe does it for me as I want the mod stay completely server sided

#

thanks tho, ill have a look in that

icy beacon
#

aren't custom recipes server-sided on 1.12? my 1.21 server uses a lot of custom recipes and still allows vanilla clients to join

radiant junco
#

well maybe I dont get what you want then

sand pumice
#

@icy beacon Sorry… custom recipes are serverside. They just don’t do nbt data.

I meant a custom recipe handler… which does need a client side…

@qdbp is there a problem with mixing into the “craft”function?

radiant junco
#

Idk yet, ill have a look into that. But havent had the time yet. I'll prob answer tomorrow :)

radiant junco
#

Well, i really had no time the last days.
From what I did till now, I in the first place couldn't get the craft() mixin to work because I did not know how to check for the recipe "id" or whatever. Also I was thinking that even if i get that to work, that thing would fire when clicked on the crafted item right? So i can't even rename the item before it gets crafted.
I'd like the item to display a custom name and have some custom data directly in the crafting grid.

sand pumice
#

So… is this just for 1 item, or are you hoping to do this to a bunch of items?

If it is just 1 or two… you could manually check the if the result matches the item you want to mess with… then manually check if the inventory matches the version of the recipe you want to mess with…
This isn’t really feasible for lots of recipes, but just one or two would work.

#

That may still not solve your preview problem tho.

radiant junco
#

yeah, just for one.

I want to craft an Item Frame thats called "Invisible Item Frame" and has some custom data so i know it is one. Thats gonna be crafted from idk, a glass pane and a normal item frame.

So its just one recipe really. You mean that i check for the ingredients and the result instead of some id or something?