Crash upon calling BuildingInfo.getBuildingInfo during world loading
Thutmose opened this issue ยท 0 comments
This report is for Minecraft 1.15.2, lost cities 3.0.1-alpha
I have support for spawning different mobs in the various lost cities structures, and I do this by checking the BuildingInfo to see what building is at a location.
Lately, I have had this crash while loading the world:
https://gist.github.com/Thutmose/99022349546b04dc5409750d88eac41e
Specifically:
java.lang.ClassCastException: net.minecraft.world.server.ServerWorld cannot be cast to net.minecraft.world.gen.WorldGenRegion
at mcjty.lostcities.worldgen.LostCityTerrainFeature.makeDummyChunk(LostCityTerrainFeature.java:1072) ~[?:1.15-3.0.1-alpha] {re:classloading}
at mcjty.lostcities.worldgen.LostCityTerrainFeature.getHeightmap(LostCityTerrainFeature.java:1058) ~[?:1.15-3.0.1-alpha] {re:classloading}
at mcjty.lostcities.worldgen.DefaultDimensionInfo.getHeightmap(DefaultDimensionInfo.java:80) ~[?:1.15-3.0.1-alpha] {re:classloading}
at mcjty.lostcities.worldgen.lost.BuildingInfo.isVoidChunk(BuildingInfo.java:957) ~[?:1.15-3.0.1-alpha] {re:classloading}
at mcjty.lostcities.worldgen.lost.BuildingInfo.isCityRaw(BuildingInfo.java:457) ~[?:1.15-3.0.1-alpha] {re:classloading}
at mcjty.lostcities.worldgen.lost.BuildingInfo.getChunkCharacteristics(BuildingInfo.java:364) ~[?:1.15-3.0.1-alpha] {re:classloading}
at mcjty.lostcities.worldgen.lost.BuildingInfo.<init>(BuildingInfo.java:696) ~[?:1.15-3.0.1-alpha] {re:classloading}
at mcjty.lostcities.worldgen.lost.BuildingInfo.getBuildingInfo(BuildingInfo.java:666) ~[?:1.15-3.0.1-alpha] {re:classloading}
at pokecube.compat.lostcities.Impl$LostCityTerrainChecker.getSubBiome(Impl.java:91) ~[?:2.7.9] {re:classloading}
The section of code in my end responsible is here:
https://github.com/Pokecube-Development/Pokecube-Issues-and-Wiki/blob/1.14/src/main/java/pokecube/compat/lostcities/Impl.java#L87-L91
final IDimensionInfo dimInfo = Registration.LOSTCITY_FEATURE.getDimensionInfo(world);
if (dimInfo == null) break check;
final BlockPos pos = v.getPos();
final ChunkPos pos_chunk = new ChunkPos(pos);
final BuildingInfo info = BuildingInfo.getBuildingInfo(pos_chunk.x, pos_chunk.z, dimInfo);
Where I first check if there is dimension info, and if so, try to find the building info to go with it.