[Crash][Mod Incompatibility] getModdedBiomeGenerators does not fire necessary event
ReikaKalseki opened this issue ยท 9 comments
GenericWorldChunkManager.getModdedBiomeGenerators
does not fire net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens
events, meaning that many other mods that work with BiomeGenLayer objects are not properly notified or initialized. In particular, we have found a crash with ClimateControl and normal-type RFTools dimensions.
It only happens in RFTools worlds.
ClimateControl GenLayerRiverMixWrapper constructor does this:
public GenLayerRiverMixWrapper(long baseSeed) {
super(baseSeed,null,null);
voronoi = new GenLayerVoronoiZoom(baseSeed,this);
}
So it passes 'null', 'null' to the superclass: GenLayerRiverMix
So when later on zoomLayer.initWorldGenSeed(seed) is called this causes a null pointer exception because GenLayerRiverMix does:
public void initWorldGenSeed(long p_75905_1_)
{
this.biomePatternGeneratorChain.initWorldGenSeed(p_75905_1_);
this.riverPatternGeneratorChain.initWorldGenSeed(p_75905_1_);
super.initWorldGenSeed(p_75905_1_);
}
I'm not exactly sure who is at fault here as I'm not 100% sure I understand what is going on in this situation. Can you clarify what should happen? Thanks
Yes so I'm not sure why that isn't happening in other cases. I'm still investigating though
At first glance I would say that this bug is actually in climate control. It seems the vanilla GenLayerRiverMix is not intended to be used with biomePatternGeneratorChain and riverPatternGeneratorChain equal to null. I still am not sure why this doesn't produce problems outside of RFTools dimensions however
Actually this is not true. GenericWorldChunkManager calls super.getModdedBiomeGenerators() on line 29 and that one calls the InitBiomeGens event so this should be fine. Perhaps the crash is caused by something else? Maybe a log would help
As I'm planning to release an update of rftools I am considering adding a workaround for this (basically doing a try/catch around the offending code)...