Jump to content

Repeated call of onLoad in tileEntity crashes server and client.


Raycoms

Recommended Posts

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?

Link to comment
Share on other sites

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:?]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Losing a significant amount of money to scammers can be a bizarre experience that leaves you feeling helpless and betrayed. This was the situation I found myself in after investing over a hundred thousand dollars in a crypto platform that turned out to be a scam. I was introduced to this platform by a friend of my cousin, and everything seemed legitimate until it was too late for me to realize that I had been duped. The days following the realization of my loss were some of the darkest I have ever experienced. I was consumed by feelings of depression and desperation as I tried everything in my power to retrieve my hard-earned money. I reached out to various authorities and sought advice from friends and family, but it seemed like there was no way to recover what I had lost. It was during this time that a friend mentioned a platform called Wizard Web Recovery that specialized in recovering funds lost to scams. At first, I was skeptical and hesitant to trust another company with my money, but I was running out of options and decided to give them a chance. Looking back, this decision turned out to be the best one I could have made. From the moment I contacted Wizard Web Recovery, I was impressed by their dedication to helping me recover my funds. Their team of experts guided me through the process step by step, explaining each stage clearly and answering all of my questions along the way. They kept me informed of their progress and worked tirelessly to ensure that my case was given the attention it deserved. I was amazed at how quickly Wizard Web Recovery was able to track down the scammers and retrieve my money. Within a relatively short period, I received the news that my funds had been successfully recovered, and I couldn't believe it. It felt like a weight had been lifted off my shoulders, and I was filled with gratitude for the team at Wizard Web Recovery who had made it possible.    
    • my game crashed and I have no idea why here is a link to the pastebin of the crash https://pastebin.com/vv89r9vC
    • ok apparently the issue is even stupider than that. the folder the server was in was called "𝓯𝓻𝓮𝓪𝓴𝔂 server" and apparently the special characters in the folder name break the whole damn thing. this is the stupidest thing in the history of ever
    • Thanks, but now I have the 3d model in hand (and in inventory bcz I won't need that anymore) but now when I try to throw it, it doesnt rotate and its just the end of the trident not the head part. Edit: I removed the 3d custom model. I use the original minecraft files. Json and etc. In minecraft the rendering is made in code. I sent the code in the first message. I have mostly the code. But I don't know how to register the renderers like minecraft do. For example, in minecraft there are 2 jsons: trident_in_hand and trident_throwing , I have both of them. They don't render while I have the item in hand. That's the main problem. I checked the code but I still can't figure out how to register and render the entity basically, in hand
  • Topics

×
×
  • Create New...

Important Information

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