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

I'm getting a NullPointer on this code:

Spoiler

for (Entity entity : Minecraft.getInstance().world.getAllEntities())

 

I don't understand how it can be null because the line right before it is:

Spoiler

if(Minecraft.getInstance().world.getAllEntities() != null && Iterables.size(Minecraft.getInstance().world.getAllEntities()) > 0)

 

Heres the Git repo: https://github.com/Novarch129/JoJo-s-Blocky-Adventure,

the relevant code is at :https://github.com/Novarch129/JoJo-s-Blocky-Adventure/blob/master/src/main/java/com/novarch/jojomod/entities/stands/kingCrimson/EntityKingCrimson.java,

and the debug.log: https://gist.github.com/Novarch129/38e8edc698dcafd745e05e7bb04d7d7e.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

14 minutes ago, Novârch said:

That log looks like it ends prematurely

 

*edit: also, are you sure that this code is only running on the client? Minecraft is a client-only class I do believe. I would set breakpoints and walk through the code to see what is happening.

Edited by Ugdhar

  • Author
27 minutes ago, diesieben07 said:

Minecraft is a client-only class. You cannot access it from common code (your entity).

Then how should I run that code? The entire mod is entity classes and I don't think I can change that.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Author
Just now, diesieben07 said:

What are you trying to do there even? What's the end goal?

Eventually add effects to all entites and remove their attack targets.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Author
1 minute ago, diesieben07 said:

And you do that within an entity class, because...?

It's only supposed to happen while the entity is summoned and under certain conditions, all the variables are stored within the class the entity extends, if there's a better way to do do it I would be glad to change it.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Novârch changed the title to [SOLVED] Crash on world.getAllEntities

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.