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.12.2] Can't get all loaded entities when out of development environment

Featured Replies

Posted

I am currently working on a mod in 1.12.2 where I need to loop through a list of all loaded entities in the world.

The code works perfectly when running it in eclipse but as when I run it by itself in forge outside of the development environment I do not get any entities printed. I have ruled out it being an issue with sides because it works fine when running both the server and client in eclipse. Is there something I'm missing? 

 

Code:

FMLLog.log.info("Looking for entities... isRemote: %b", world.isRemote);
    for(Chunk c : ((WorldServer)this.world).getChunkProvider().getLoadedChunks()) {
        for(ClassInheritanceMultiMap<Entity> list : c.getEntityLists()) {
            if (!list.isEmpty()){
                for (Entity entity : list){
                    FMLLog.log.info(entity.getClass().toString());
                    // More code
                }
            }
        }
    }
}

 

In dev environment:

[19:56:46] [Server thread/INFO] [FML]: Looking for entities... isRemote: %b
[19:56:46] [Server thread/INFO] [FML]: class net.minecraft.entity.passive.EntityVillager
[19:56:46] [Server thread/INFO] [FML]: class net.minecraft.entity.passive.EntitySquid
[19:56:46] [Server thread/INFO] [FML]: class net.minecraft.entity.passive.EntitySquid
...

 

Outside of dev environment: (only the one line)

[19:54:39] [Server thread/INFO] [FML]: Looking for entities... isRemote: false

Thanks!

  • Author

I tried World#loadedEntityList  first but it had the same issue I have now. So then I switch to what I have now (I got the code from World#getEntitiesWithinAABB  and just removed the AABB code). I agree it is usually a bad idea but I basically need to update every villager. I can update all the ones not loaded by using when they load with EntityJoinWorldEvent but I need to update the ones already loaded.

Edited by DaemonUmbra
Fixed Formatting

You can attach IntelliJ’s debugger to non-development minecraft and debug it. Eclipse might have something similar

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

  • Author

Thanks for the help both of y'all. Turns out I had the world object of a different dimension than the overworld and now that I changed that it is fixed.

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.