Jump to content

[1.15.2] Recipe For Custom Machines Displayed in Craft Recipe Book and Cause Error When Clicked


lcy0x1

Recommended Posts

I made some crafting recipes by using the JSON recipe files and made 3 recipe types for my custom machines by implementing IRecipe<T>. However, I found that they are displayed in the recipe book of Work Bench and shows in one of the recipe categories. When I click a recipe that belongs to one of the 3 custom recipe types, a fatal error was thrown by the WorkBenchContainer.

 

I have looked into the source code, and find that recipe categories are hardcoded and there is no way to add a new recipe category. Furthermore, all custom recipe types will be displayed since the ClientRecipeBook class simply retrieves all recipes and display all of them regardless of the container type (the generic type T in IRecipe<T>). Thus, I can't find a way to remove them from the Workbench Recipe Book or change the recipe category. I can't find the registries for ClientRecipeBook and RecipeManager also.

 

Is there any solution to this problem? It keeps causing fatal errors.

 

Stack Trace:

java.lang.ClassCastException: net.minecraft.inventory.CraftingInventory cannot be cast to 
******.recipe.OxiRecipe$Inv
	at ******.recipe.OxiRecipe.func_77569_a(OxiRecipe.java:23) ~[?:1.0]
	at net.minecraft.inventory.container.WorkbenchContainer.func_201769_a(SourceFile:96) ~[?:?]
	at net.minecraft.item.crafting.ServerRecipePlacer.func_201508_a(SourceFile:96) ~[?:?]
	at net.minecraft.item.crafting.ServerRecipePlacer.func_194327_a(SourceFile:53) ~[?:?]
	at net.minecraft.inventory.container.RecipeBookContainer.func_217056_a(RecipeBookContainer.java:17) ~[?:?]
	at net.minecraft.network.play.ServerPlayNetHandler.lambda$processPlaceRecipe$3(ServerPlayNetHandler.java:1165) ~[?:?]
	at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_241]
	at net.minecraft.network.play.ServerPlayNetHandler.func_194308_a(ServerPlayNetHandler.java:1164) ~[?:?]
	at net.minecraft.network.play.client.CPlaceRecipePacket.func_148833_a(SourceFile:40) ~[?:?]
	at net.minecraft.network.play.client.CPlaceRecipePacket.func_148833_a(SourceFile:10) ~[?:?]
	at net.minecraft.network.PacketThreadUtil.func_225383_a(SourceFile:21) ~[?:?]
	at net.minecraft.util.concurrent.TickDelayedTask.run(SourceFile:18) ~[?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(SourceFile:144) [?:?]
	at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23) [?:?]
	at net.minecraft.server.MinecraftServer.func_213166_h(MinecraftServer.java:729) [?:?]
	at net.minecraft.server.MinecraftServer.func_213166_h(MinecraftServer.java:141) [?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(SourceFile:118) [?:?]
	at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:712) [?:?]
	at net.minecraft.server.MinecraftServer.func_213168_p(MinecraftServer.java:706) [?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213161_c(SourceFile:127) [?:?]
	at net.minecraft.server.MinecraftServer.func_213202_o(MinecraftServer.java:692) [?:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:639) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241]

 

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.