Raycoms Posted October 25, 2016 Share Posted October 25, 2016 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? Quote Link to comment Share on other sites More sharing options...
Raycoms Posted October 25, 2016 Author Share Posted October 25, 2016 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:?] Quote Link to comment Share on other sites More sharing options...
Draco18s Posted October 25, 2016 Share Posted October 25, 2016 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. Quote 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 More sharing options...
Raycoms Posted October 25, 2016 Author Share Posted October 25, 2016 And is there a way to get something like an "outdated world object" which won't cause that additional loading? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.