Applied Energistics 2

Applied Energistics 2

137M Downloads

Loading ME-containing chunks can cause a crash

skwirl42 opened this issue · 4 comments

commented

At src/main/java/appeng/me/cache/StatisticsCache.java:136 the code assumes that it is running on the server. This happens when returning to an area with ME-containing chunks, and for whatever reason it gets executed on the client side. I have solid repro steps in my world, and can provide the world data if desired.

From a quick look at the code, perhaps the function should check if the world is actually a ServerWorld before casting the value to that.

[14Mar2021 17:42:45.931] [Server thread/ERROR] [net.minecraft.server.MinecraftServer/]: Encountered an unexpected exception
java.lang.ClassCastException: net.minecraft.client.world.ClientWorld cannot be cast to net.minecraft.world.server.ServerWorld
at appeng.me.cache.StatisticsCache.addChunk(StatisticsCache.java:136) ~[?:8.3.0-alpha.1]
at appeng.me.cache.StatisticsCache.addNode(StatisticsCache.java:79) ~[?:8.3.0-alpha.1]
at appeng.me.GridCacheWrapper.addNode(GridCacheWrapper.java:48) ~[?:8.3.0-alpha.1]
at appeng.me.Grid.add(Grid.java:175) ~[?:8.3.0-alpha.1]
at appeng.me.GridNode.setGrid(GridNode.java:226) ~[?:8.3.0-alpha.1]
at appeng.me.Grid.(Grid.java:68) ~[?:8.3.0-alpha.1]
at appeng.me.GridNode.getInternalGrid(GridNode.java:138) ~[?:8.3.0-alpha.1]
at appeng.me.GridNode.updateState(GridNode.java:195) ~[?:8.3.0-alpha.1]
at appeng.me.helpers.AENetworkProxy.getNode(AENetworkProxy.java:135) ~[?:8.3.0-alpha.1]
at appeng.me.helpers.AENetworkProxy.onReady(AENetworkProxy.java:128) ~[?:8.3.0-alpha.1]
at appeng.parts.AEBasePart.addToWorld(AEBasePart.java:255) ~[?:8.3.0-alpha.1]
at appeng.parts.CableBusContainer.addToWorld(CableBusContainer.java:524) ~[?:8.3.0-alpha.1]
at appeng.tile.networking.CableBusTileEntity.onReady(CableBusTileEntity.java:189) ~[?:8.3.0-alpha.1]
at appeng.hooks.TickHandler.onServerTick(TickHandler.java:234) ~[?:8.3.0-alpha.1]
at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.fml.hooks.BasicEventHooks.onPostServerTick(BasicEventHooks.java:120) ~[?:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:828) ~[?:?]
at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:78) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642) ~[?:?]
at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:232) ~[?:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_74]

commented

As I recall, the last time this exception appeared, there was a third bit of code implicated. The full crash report instead of the stack trace would be useful.

commented

@skwirl42 Are you repro-ing this only with AE2? Can you provide a modlist?

commented

Duplicate

commented

@skwirl42 Are you repro-ing this only with AE2? Can you provide a modlist?

It’s the latest direwolf20 pack.

I’m not sure where it puts the crash reports when using the FTB launcher.