RFTools

RFTools

74M Downloads

[Crash][Mod Incompatibility] getModdedBiomeGenerators does not fire necessary event

ReikaKalseki opened this issue ยท 9 comments

commented

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.

commented

Will check it out. Thanks for letting me know

commented

http://pastebin.com/tKMScTEp

It only happens in RFTools worlds.

commented

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

commented

Would it not then crash for all cases?

commented

Yes so I'm not sure why that isn't happening in other cases. I'm still investigating though

commented

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

commented

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

commented

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)...

commented

In 4.22 I worked around this issue by catching the exception. Now that Climate Control is also going to provide a solution by passing dummies in the biomegen I'm going to consider this bug fixed twice :-)