xerca Posted March 5, 2019 Posted March 5, 2019 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. Quote
loordgek Posted March 5, 2019 Posted March 5, 2019 the event having the wrong craftMatrix https://github.com/MinecraftForge/MinecraftForge/issues/5580 you need to use json now for recipe do you need a custom IRecipe ? Quote
xerca Posted March 5, 2019 Author Posted March 5, 2019 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. Quote
larsgerrits Posted March 6, 2019 Posted March 6, 2019 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. Quote 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/
xerca Posted March 6, 2019 Author Posted March 6, 2019 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! Quote
Recommended Posts
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.