Jump to content

[1.13.2] PlayerEvent.ItemCraftedEvent.craftMatrix is not actually the craftMatrix?


xerca

Recommended Posts

The craftMatrix field of PlayerEvent.ItemCraftedEvent used to be public, but now it seems to be converted to private, and there is a getInventory() method that returns it instead. However, the IInventory you get by calling PlayerEvent.ItemCraftedEvent.getInventory() is not actually the craftMatrix. It returns a size 1 inventory with only air, instead of a size 9 inventory filled with ingredients. Is this a bug on Forge's end or am I doing something wrong?

 

Also IRecipe's became unregisterable without any explanation, so I hope at least one of these problems are fixed so that we can have some way to get non-trivial craftings working.

Link to comment
Share on other sites

I see, so it is a bug.

 

Quote

you need to use json now for recipe

do you need a custom IRecipe ?

I have some crafting recipes that need NBT manipulation. One of them works very similar to the vanilla book copying (that uses a custom IRecipe) and I found a lot of forum threads from 1.12 where people recommend registering IRecipes, so I emulated the vanilla code and tried registering it only to be disappointed that it doesn't work in 1.13 either. Before 1.13 I used item damage to hold some state that can be used in JSON recipes with the "data" attribute and did the rest of processing in crafting events, but it felt hacky to me. Now the data attribute doesn't work anyway.

 

I don't see any reason why Forge wouldn't allow registering IRecipe's just like vanilla does. I assumed they just forgot to add it yet.

Link to comment
Share on other sites

2 hours ago, xerca said:

I have some crafting recipes that need NBT manipulation. One of them works very similar to the vanilla book copying (that uses a custom IRecipe) and I found a lot of forum threads from 1.12 where people recommend registering IRecipes, so I emulated the vanilla code and tried registering it only to be disappointed that it doesn't work in 1.13 either. Before 1.13 I used item damage to hold some state that can be used in JSON recipes with the "data" attribute and did the rest of processing in crafting events, but it felt hacky to me. Now the data attribute doesn't work anyway.

 

I don't see any reason why Forge wouldn't allow registering IRecipe's just like vanilla does. I assumed they just forgot to add it yet.

 

You can register IRecipes just fine, but you need to reference them from a JSON recipe file.

 

To register a custom IRecipe you need to get a RecipeType usingRecipeType.get (look at VanillaRecipeTypes).
You also need to register a custom IRecipeSerializer using RecipeSerializers.register. RecipeSerializers also contain the registering of all vanilla serializers.

 

To use your custom IRecipe, set the type of your recipe to the ResourceLocation you specified from YourIRecipeSerializer#getName.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

17 hours ago, larsgerrits said:

 

You can register IRecipes just fine, but you need to reference them from a JSON recipe file.

 

To register a custom IRecipe you need to get a RecipeType usingRecipeType.get (look at VanillaRecipeTypes).
You also need to register a custom IRecipeSerializer using RecipeSerializers.register. RecipeSerializers also contain the registering of all vanilla serializers.

 

To use your custom IRecipe, set the type of your recipe to the ResourceLocation you specified from YourIRecipeSerializer#getName.

Thank you! I had actually tried registering the serializer with RecipeSerializers.register but it crashed and I assumed that would not work. Apperantly I just called register at the wrong place. Now it works!

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.

Announcements



×
×
  • Create New...

Important Information

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