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 have some code in my tileEntity:

 

   @Override
    public void onLoad()
    {
        super.onLoad();
        final World world = getWorld();

        if (world != null)
        {
            @Nullable final Colony colony = ColonyManager.getColony(world, pos);

            if (colony != null && colony.getField(pos) == null)
            {
                @Nullable final Entity entity = EntityUtils.getEntityFromUUID(world, colony.getPermissions().getOwner());

                if (entity instanceof EntityPlayer)
                {
                    colony.addNewField(this, ((EntityPlayer) entity).inventory, pos, world);
                }
            }
        }
    }

 

Which creates a field which loops like 20 times through some loop(pretty cheap operation).

 

And this really never created any problems. Out of the nothing, now when I login to our server this onLoad is called like a hundred times until server and client say goodbye.

 

Did I do something wrong?

  • Author

And it just goes on like this forever:

 

[19:35:44] [server thread/ERROR]: Encountered an unexpected exception

java.lang.StackOverflowError

at java.util.zip.Inflater.<init>(Inflater.java:102) ~[?:1.8.0_101]

at java.util.zip.Inflater.<init>(Inflater.java:110) ~[?:1.8.0_101]

at java.util.zip.InflaterInputStream.<init>(InflaterInputStream.java:108) ~[?:1.8.0_101]

at net.minecraft.world.chunk.storage.RegionFile.func_76704_a(RegionFile.java:182) ~[ath.class:?]

at net.minecraft.world.chunk.storage.RegionFileCache.func_76549_c(SourceFile:89) ~[ati.class:?]

at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadChunk__Async(AnvilChunkLoader.java:94) ~[atj.class:?]

at net.minecraftforge.common.chunkio.ChunkIOProvider.run(ChunkIOProvider.java:68) ~[ChunkIOProvider.class:?]

at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:92) ~[ChunkIOExecutor.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:115) ~[lr.class:?]

at net.minecraft.world.gen.ChunkProviderServer.func_186028_c(ChunkProviderServer.java:86) ~[lr.class:?]

at net.minecraft.world.gen.ChunkProviderServer.func_186025_d(ChunkProviderServer.java:132) ~[lr.class:?]

at net.minecraft.world.World.func_72964_e(World.java:303) ~[aid.class:?]

at net.minecraft.world.World.func_175726_f(World.java:298) ~[aid.class:?]

at net.minecraft.world.World.func_180495_p(World.java:78) ~[aid.class:?]

at net.minecraft.world.World.func_175623_d(World.java:223) ~[aid.class:?]

at com.minecolonies.entity.ai.citizen.farmer.Field.isNoPartOfField(Field.java:374) ~[Field.class:?]

at com.minecolonies.entity.ai.citizen.farmer.Field.searchNextBlock(Field.java:358) ~[Field.class:?]

at com.minecolonies.entity.ai.citizen.farmer.Field.calculateSize(Field.java:341) ~[Field.class:?]

at com.minecolonies.entity.ai.citizen.farmer.Field.<init>(Field.java:233) ~[Field.class:?]

at com.minecolonies.colony.Colony.addNewField(Colony.java:1003) ~[Colony.class:?]

at com.minecolonies.tileentities.ScarecrowTileEntity.onLoad(ScarecrowTileEntity.java:119) ~[scarecrowTileEntity.class:?]

at net.minecraft.world.chunk.Chunk.func_177426_a(Chunk.java:821) ~[asv.class:?]

at net.minecraft.world.chunk.Chunk.func_150813_a(Chunk.java:798) ~[asv.class:?]

at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:490) ~[atj.class:?]

at net.minecraftforge.common.chunkio.ChunkIOProvider.syncCallback(ChunkIOProvider.java:96) ~[ChunkIOProvider.class:?]

at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:94) ~[ChunkIOExecutor.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:115) ~[lr.class:?]

at net.minecraft.world.gen.ChunkProviderServer.func_186028_c(ChunkProviderServer.java:86) ~[lr.class:?]

at net.minecraft.world.gen.ChunkProviderServer.func_186025_d(ChunkProviderServer.java:132) ~[lr.class:?]

at net.minecraft.world.World.func_72964_e(World.java:303) ~[aid.class:?]

at net.minecraft.world.World.func_175726_f(World.java:298) ~[aid.class:?]

at net.minecraft.world.World.func_180495_p(World.java:78) ~[aid.class:?]

at net.minecraft.world.World.func_175623_d(World.java:223) ~[aid.class:?]

at com.minecolonies.entity.ai.citizen.farmer.Field.isNoPartOfField(Field.java:374) ~[Field.class:?]

at com.minecolonies.entity.ai.citizen.farmer.Field.searchNextBlock(Field.java:358) ~[Field.class:?]

at com.minecolonies.entity.ai.citizen.farmer.Field.calculateSize(Field.java:341) ~[Field.class:?]

at com.minecolonies.entity.ai.citizen.farmer.Field.<init>(Field.java:233) ~[Field.class:?]

at com.minecolonies.colony.Colony.addNewField(Colony.java:1003) ~[Colony.class:?]

at com.minecolonies.tileentities.ScarecrowTileEntity.onLoad(ScarecrowTileEntity.java:119) ~[scarecrowTileEntity.class:?]

at net.minecraft.world.chunk.Chunk.func_177426_a(Chunk.java:821) ~[asv.class:?]

at net.minecraft.world.chunk.Chunk.func_150813_a(Chunk.java:798) ~[asv.class:?]

at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:490) ~[atj.class:?]

at net.minecraftforge.common.chunkio.ChunkIOProvider.syncCallback(ChunkIOProvider.java:96) ~[ChunkIOProvider.class:?]

at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:94) ~[ChunkIOExecutor.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:115) ~[lr.class:?]

at net.minecraft.world.gen.ChunkProviderServer.func_186028_c(ChunkProviderServer.java:86) ~[lr.class:?]

at net.minecraft.world.gen.ChunkProviderServer.func_186025_d(ChunkProviderServer.java:132) ~[lr.class:?]

at net.minecraft.world.World.func_72964_e(World.java:303) ~[aid.class:?]

at net.minecraft.world.World.func_175726_f(World.java:298) ~[aid.class:?]

at net.minecraft.world.World.func_180495_p(World.java:78) ~[aid.class:?]

at net.minecraft.world.World.func_175623_d(World.java:223) ~[aid.class:?]

This line:

colony.addNewField(this, ((EntityPlayer) entity).inventory, pos, world);

Calls a method that does this:

 

Field.calculateSize()

Field.searchNextBlock()

Field.isNoPartOfField()

 

These methods then make calls into world, asking for more data from the chunk in a way that causes the chunk to be read from disk again (because it hasn't finished loading) that causes your TE to load again which begins the cycle anew.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

And is there a way to get something like an "outdated world object" which won't cause that additional loading?

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.