Jump to content

Recommended Posts

Posted (edited)

I get this stacktrace and then crash when joining my world with custom entity:

 

[Render thread/FATAL] [minecraft/Minecraft]: Unreported exception thrown!
java.lang.NullPointerException: null
    at net.minecraft.client.renderer.entity.EntityRendererManager.shouldRender(EntityRendererManager.java:238) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.WorldRenderer.renderLevel(WorldRenderer.java:987) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:608) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:425) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:976) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:607) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171] {}
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171] {}
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {}

 

Here are my classes:

 

Entity Class:

383189417_ScreenShot2021-05-19at4_53_10PM.thumb.png.81746a9f254387415d5afe6e80d665d9.png

 

Renderer Class:

502343619_ScreenShot2021-05-19at4_53_42PM.thumb.png.908e9bde1704e97a06bab4a2b3dfb4cf.png

 

Registering Class:

1796129046_ScreenShot2021-05-19at4_56_55PM.thumb.png.4170c26e2091655cbf20cb8db3f7250e.png

 

Help would be appreciated!

 

Edited by aritod
Solved
  • aritod changed the title to [URGENT] NullPointerException For Entity [1.16.5]
Posted (edited)

1. Don't use OnlyIn, properly side off your code.

2. You never register your entity renderer, the static method isn't called anywhere so nothing happens. Register it within FMLClientSetupEvent.

3. Attributes are never registered, same reason. Use the EntityAttributeCreationEvent for this.

 

Edited by ChampionAsh5357
Posted
  On 5/20/2021 at 3:25 AM, ChampionAsh5357 said:

1. Don't use OnlyIn, properly side off your code.

2. You never register your entity renderer, the static method isn't called anywhere so nothing happens. Register it within FMLClientSetupEvent.

3. Attributes are never registered, same reason. Use the EntityAttributeCreationEvent for this.

 

Expand  

Hi, sorry that was my old code. I actually did all these things beforehand but it still crashes.

 

My code looks like this:

 

Main Class:

761034157_ScreenShot2021-05-20at10_12_07AM.thumb.png.9fe2a4b852752a4797876551842db1c2.png

 

 

Renderer Class:

461794437_ScreenShot2021-05-20at10_12_28AM.thumb.png.94334e29e06917196f8abb20644e8c10.png

 

Posted
  On 5/20/2021 at 6:52 PM, diesieben07 said:

Look at the parameters for the EventBusSubscriber annotation.

Expand  

 

The parameter 'bus' in EventBusSubscriber is using Mod.EventBusSubscriber.Bus.MOD which is the mod event bus so I'm not sure why it is using the forge event bus.

The parameter 'value' does not seem to be related but I added it as a parameter because it says that it is only necessary if it is not on the same class that has a @Mod annotation.

 

 

It still crashes so I'm not really sure what I should be looking for.

 

This is my code:

2145631072_ScreenShot2021-05-20at3_32_33PM.thumb.png.77a698ec97c184e68029ffc71fff3c86.png

 

Posted

Please link a paste of the EntityType object initialization, where the associated register is attached to the event bus, the renderer, where the renderer is registered, and where the attributes are registered. I know you might have already sent them, but I would like full context rather than pictures of partial snippets.

 

Also, you shouldn't be passing in a new instance of the Reloadable resource manager. Grab the one within the Minecraft instance and pass that in.

Posted
  On 5/20/2021 at 8:54 PM, ChampionAsh5357 said:

Please link a paste of the EntityType object initialization, where the associated register is attached to the event bus, the renderer, where the renderer is registered, and where the attributes are registered. I know you might have already sent them, but I would like full context rather than pictures of partial snippets.

 

Also, you shouldn't be passing in a new instance of the Reloadable resource manager. Grab the one within the Minecraft instance and pass that in.

Expand  

https://paste.gemwire.uk/view/98040c70

Posted
  On 5/20/2021 at 10:53 PM, ChampionAsh5357 said:

Is the error still the same? If so, could you put breakpoints within the client setup event where you register the renderer and attribute creation to make sure both events do run and call their methods?

Expand  

The error is still the same and both ClientSetupEvent and EntityAttributeCreationEvent are called after checking through debug mode.

Posted

There's nothing that suggests the error is outside of #shouldRender meaning that the entity renderer might be null somehow. However, there is nothing that suggests an error can occur there with the snippets.

Would you mind posting a link to your repository on Github, Gitlab, etc.? I'm going to build a local workspace and see if I can't debug it.

Posted
  On 5/21/2021 at 2:59 PM, ChampionAsh5357 said:

There's nothing that suggests the error is outside of #shouldRender meaning that the entity renderer might be null somehow. However, there is nothing that suggests an error can occur there with the snippets.

Would you mind posting a link to your repository on Github, Gitlab, etc.? I'm going to build a local workspace and see if I can't debug it.

Expand  

https://github.com/ForgeModDev/LogFixer/tree/master

Posted

Found the error, and its annoying. The resource location being passed into the rendering handler has the modid written twice, once in the namespace and once in the path. The path does not accept colons, so an error was thrown which was eaten by the lambda and discarded. All you need to do is remove the modid and the colon from the path of the resource location in ModRenderers.

Posted
  On 5/21/2021 at 5:49 PM, ChampionAsh5357 said:

Found the error, and its annoying. The resource location being passed into the rendering handler has the modid written twice, once in the namespace and once in the path. The path does not accept colons, so an error was thrown which was eaten by the lambda and discarded. All you need to do is remove the modid and the colon from the path of the resource location in ModRenderers.

Expand  

Thank you so much! Can't believe something as little as that was the cause of this. Now I can finally continue working on my mod. Thanks to everyone who helped

  • aritod changed the title to [SOLVED] NullPointerException For Entity [1.16.5]
Posted

This is my first time posting on this forum, so I don't know If I should make a completely new post for this, but I am having trouble with a similar thing.

EntityRenderManager.shouldRender is throwing a NullPointerException, but the decription is "Unexpected Error".

I tried doing what OP did but it didn't fix anything. I have seperate classes for the Renderers though and it might have something to do with that.

Can I just post my code here or should I create a new topic as mentioned? (Dont wanna upset anyone)

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Yes that’s the full log, I managed to get it working last night, the anvil fix mod is what was causing it to crash
    • Hey guys, i'm currently developping a mod with forge 1.12.2 2860 and i'm using optifine and gradle 4.9. The thing is i'm trying to figure out how to show the player's body in first person. So far everything's going well since i've try to use a shader. The player's body started to blink dark when using a shader. I've try a lot of shader like chocapic, zeus etc etc but still the same issue. So my question is : How should i apply the current shader to the body ? At the same time i'm also drawing a HUD so maybe it could be the problem?   Here is the issue :    And here is the code where i'm trying to display the body :    private static void renderFirstPersonBody(EntityPlayerSP player, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); try { // Préparation OpenGL GlStateManager.enableDepth(); GlStateManager.depthMask(true); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // Éclairage correct pour shaders GlStateManager.enableLighting(); RenderHelper.enableStandardItemLighting(); GlStateManager.enableRescaleNormal(); // Active la lightmap pour les shaders mc.entityRenderer.enableLightmap(); // Position de rendu interpolée double px = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; double py = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; double pz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; GlStateManager.translate( px - mc.getRenderManager().viewerPosX, py - mc.getRenderManager().viewerPosY, pz - mc.getRenderManager().viewerPosZ ); // Rendu du joueur sans la tête Render<?> render = mc.getRenderManager().getEntityRenderObject(player); if (render instanceof RenderPlayer) { RenderPlayer renderPlayer = (RenderPlayer) render; boolean oldHeadHidden = renderPlayer.getMainModel().bipedHead.isHidden; boolean oldHeadwearHidden = renderPlayer.getMainModel().bipedHeadwear.isHidden; renderPlayer.getMainModel().bipedHead.isHidden = true; renderPlayer.getMainModel().bipedHeadwear.isHidden = true; setArmorHeadVisibility(renderPlayer, false); renderPlayer.doRender(player, 0, 0, 0, player.rotationYaw, partialTicks); renderPlayer.getMainModel().bipedHead.isHidden = oldHeadHidden; renderPlayer.getMainModel().bipedHeadwear.isHidden = oldHeadwearHidden; setArmorHeadVisibility(renderPlayer, !oldHeadwearHidden); } // Nettoyage post rendu mc.entityRenderer.disableLightmap(); GlStateManager.disableRescaleNormal(); } catch (Exception e) { // silent fail } finally { GlStateManager.popAttrib(); GlStateManager.popMatrix(); } }   Ty for your help. 
    • Item successfully registered, but there was a problem with the texture of the item, it did not insert and has just the wrong texture.     
    • Keep on using the original Launcher Run Vanilla 1.12.2 once and close the game Download Optifine and run optifine as installer (click on the optifine jar) Start the launcher and make sure the Optifine profile is selected - then test it again  
    • Hi everyone, I’m hoping to revisit an old version of Minecraft — specifically around Beta 1.7.3 — for nostalgia’s sake. I’ve heard you can do this through the official Minecraft Launcher, but I’m unsure how to do it safely without affecting my current installation or save files. Are there any compatibility issues I should watch out for when switching between versions? Would really appreciate any tips or advice from anyone who’s done this before! – Adam
  • Topics

×
×
  • Create New...

Important Information

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