Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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]

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.