Jump to content

Null Pointer Exception when overriding recipes with dummies.


drok0920

Recommended Posts

Hello,

I seem to be having problems when ever i override all recipes in a tab.  When i do this and i open the recipe book i get a null pointer exception.  It seems to be be caused by the removal of the Lists of RecipeLists in RecipeBookClient.class.  My question is is there a way i can fix this mayself or should i request a change some where?  If i should request a change where would i do that.

Link to comment
Share on other sites

This is the error.

 

java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_121]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_121]
	at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1161) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:436) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: java.lang.NullPointerException
	at net.minecraft.client.gui.recipebook.GuiButtonRecipeTab.func_193919_e(GuiButtonRecipeTab.java:146) ~[GuiButtonRecipeTab.class:?]
	at net.minecraft.client.gui.recipebook.GuiRecipeBook.func_193949_f(GuiRecipeBook.java:210) ~[GuiRecipeBook.class:?]
	at net.minecraft.client.gui.recipebook.GuiRecipeBook.func_193014_a(GuiRecipeBook.java:97) ~[GuiRecipeBook.class:?]
	at net.minecraft.client.gui.recipebook.GuiRecipeBook.func_194303_a(GuiRecipeBook.java:73) ~[GuiRecipeBook.class:?]
	at net.minecraft.client.gui.inventory.GuiCrafting.initGui(GuiCrafting.java:47) ~[GuiCrafting.class:?]
	at net.minecraft.client.gui.GuiScreen.setWorldAndResolution(GuiScreen.java:543) ~[GuiScreen.class:?]
	at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:1081) ~[Minecraft.class:?]
	at net.minecraft.client.entity.EntityPlayerSP.displayGui(EntityPlayerSP.java:856) ~[EntityPlayerSP.class:?]
	at net.minecraft.client.network.NetHandlerPlayClient.handleOpenWindow(NetHandlerPlayClient.java:1214) ~[NetHandlerPlayClient.class:?]
	at net.minecraft.network.play.server.SPacketOpenWindow.processPacket(SPacketOpenWindow.java:47) ~[SPacketOpenWindow.class:?]
	at net.minecraft.network.play.server.SPacketOpenWindow.processPacket(SPacketOpenWindow.java:11) ~[SPacketOpenWindow.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_121]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_121]
	at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
	... 15 more

 

Link to comment
Share on other sites

18 hours ago, diesieben07 said:

The recipe book will crash like that if it tries to display a tab with no recipes on it. You will need to manually remove the tab from the recipe book GUI.

  • Subscribe to InitGuiEvent.Pre and check if the GuiScreen is a GuiInventory or a GuiCrafting.
  • Grab the recipeBookGui field from the GuiScreen, you will need reflection since the field is private. Also keep in mind the SRG names.
  • Now you have an instance of GuiRecipeBook. That class has a field recipeTabs (again, you need reflection), which contains all tabs visible on that GUI (a List<GuiButtonRecipeTab>). You will need to remove any tab from that list that you removed all recipes from. You know which tab is which using the GuiButtonRecipeTab::getCategory method.

Ok i have gotten access to the list of tabs but now what?  I know i have to remove the ones that have no recipes but is there a way to  check if it has recipes?  or do i just have to manually remove the ones that are not being used?

Link to comment
Share on other sites

1 minute ago, diesieben07 said:

You have to remove the ones that you removed all recipes from. You know which recipes you remove, right?

Yes i do.  I remove all vanilla recipes.  I was just hoping that if i add one of my items and its in a tab i wont have to change the code to account for that.

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.