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.

Featured Replies

Posted

Hello Guys!

 

Inside a Living Update Event, I had the following code:

 

if (ConfigValues.truesight.get() && entity.getActivePotionEffect(Effects.INVISIBILITY) != null) {
    AxisAlignedBB bb = entity.getBoundingBox();

    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.minX, bb.minY, bb.minZ, 0, 0, bb.getZSize() / 20.0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.minX, bb.minY, bb.minZ, bb.getXSize() / 20.0, 0, 0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.minX, bb.minY, bb.minZ, 0, bb.getYSize() / 20.0, 0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.maxX, bb.maxY, bb.maxZ, 0, -bb.getYSize() / 20.0, 0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.maxX, bb.maxY, bb.maxZ, -bb.getXSize() / 20.0, 0, 0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.maxX, bb.maxY, bb.maxZ, 0, 0, -bb.getZSize() / 20.0);


}

 

This code basically creates a flame hitbox around entities with the invisibility effect. The code worked fine until I closed the game and reopened the game. Upon re-opening the world, I recieved the followed crash and have no clue why. None of the code should be at risk for throwing a NullPointerException:

java.lang.NullPointerException: Rendering Particle
   at net.minecraft.client.particle.Particle.getBrightnessForRender(Particle.java:201) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
   at net.minecraft.client.particle.FlameParticle.getBrightnessForRender(FlameParticle.java:39) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
   at net.minecraft.client.particle.TexturedParticle.renderParticle(TexturedParticle.java:35) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
   at net.minecraft.client.particle.ParticleManager.renderParticles(ParticleManager.java:321) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
   at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:755) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
   at net.minecraft.client.renderer.GameRenderer.renderWorld(GameRenderer.java:655) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
   at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:509) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
   at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:925) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
   at net.minecraft.client.Minecraft.run(Minecraft.java:384) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
   at net.minecraft.client.main.Main.main(Main.java:128) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
   at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
   at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {}
   at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
   at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?] {}
   at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
   at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-4.1.0.jar:?] {}
   at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-4.1.0.jar:?] {}
   at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-4.1.0.jar:?] {}
   at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-4.1.0.jar:?] {}
   at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-4.1.0.jar:?] {}
   at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.14.4-28.1.80_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}

 

  • Author
3 hours ago, diesieben07 said:

You are most likely reaching across logical sides.

At the top of the class where I have this code I have the following annotation: 

@Mod.EventBusSubscriber(Dist.CLIENT)

 

Shouldn't this prevent me from reaching across logical sides?

  • Author

Alright: I added this to the code and it still crashes, would you be able to explain why?

 

if (Minecraft.getInstance().world != null && Minecraft.getInstance().world.isRemote() && ConfigValues.truesight.get() && entity.getActivePotionEffect(Effects.INVISIBILITY) != null) {
    AxisAlignedBB bb = entity.getBoundingBox();

    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.minX, bb.minY, bb.minZ, 0, 0, bb.getZSize() / 20.0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.minX, bb.minY, bb.minZ, bb.getXSize() / 20.0, 0, 0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.minX, bb.minY, bb.minZ, 0, bb.getYSize() / 20.0, 0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.maxX, bb.maxY, bb.maxZ, 0, -bb.getYSize() / 20.0, 0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.maxX, bb.maxY, bb.maxZ, -bb.getXSize() / 20.0, 0, 0);
    Minecraft.getInstance().particles.addParticle(ParticleTypes.FLAME, bb.maxX, bb.maxY, bb.maxZ, 0, 0, -bb.getZSize() / 20.0);

}

 

I added Minecraft.getInstance().world != null && Minecraft.getInstance().world.isRemote() to make sure the Logistical Side is the Client, and it still crashes. If I change the Logistical Side to the server it just doesn't render the particles.

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.