Storage Drawers: Natura Pack

Storage Drawers: Natura Pack

9M Downloads

Storage drawer controller causing chunks to be loaded

tornewuff opened this issue ยท 2 comments

commented

I'm trying to debug issues on my server with chunks being constantly loaded and unloaded when no players are online and no chunkloaders are in use, and after writing a small mod to log chunk load events with stack traces it appears that one of the (several) mods doing this is Storage Drawers. The stack I see repeatedly in the log is:

at net.minecraft.world.chunk.Chunk.onLoad(Chunk.java:920)
at net.minecraftforge.common.chunkio.ChunkIOProvider.syncCallback(ChunkIOProvider.java:105)
at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:94)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:130)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:101)
at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:147)
at net.minecraft.world.World.getChunkFromChunkCoords(World.java:361)
at net.minecraft.world.World.getChunkFromBlockCoords(World.java:353)
at net.minecraft.world.World.getBlockState(World.java:994)
at com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController.populateNodes(TileEntityController.java:516)
at com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController.updateCache(TileEntityController.java:353)
at com.jaquadro.minecraft.storagedrawers.block.BlockController.updateTick(BlockController.java:186)
at net.minecraft.world.WorldServer.tickUpdates(WorldServer.java:772)
at net.minecraft.world.WorldServer.tick(WorldServer.java:232)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:829)
at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:414)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590)
at java.lang.Thread.run(Thread.java:748)

The chunks are unloaded after the usual cache timeout and then reloaded the next time the drawers tick. It looks like it's not checking if the chunk is already loaded before updating its cache?

I'm running Storage Drawers 1.12.2-5.3.4 on Forge 1.12.2-14.23.1.2587.

commented

Experimented further and looked at the code, and Storage Drawers is only a secondary contributor to the problem. If the chunk containing the controller isn't loaded, Storage Drawers doesn't do anything (as expected) - but if the chunk containing the controller is loaded, then populateNodes (from the stack above) will search through connected drawer blocks, and in the process if it happens to cross a chunk boundary it will cause the chunk on the other side to be loaded. It should probably check if the chunk is loaded already before calling getBlockState?

commented

This should be getting checked now in 5.3.5.