Streams

Streams

13M Downloads

OTG v7 (WIP) / streams crash

RikAzerion opened this issue ยท 1 comments

commented

Hey there,

I've been testing OTG v7 with streams and I'm getting an exception when creating a new world:

java.lang.NullPointerException: Exception generating new chunk
	at com.pg85.otg.forge.generator.OTGChunkGenerator.<init>(OTGChunkGenerator.java:72)
	at farseek.world.gen.structure.StructureGenerationChunkProvider.<init>(StructureGenerationChunkProvider.scala:39)
	at farseek.world.gen.structure.StructureGenerationChunkProvider$$anonfun$apply$1.apply(StructureGenerationChunkProvider.scala:74)
	at farseek.world.gen.structure.StructureGenerationChunkProvider$$anonfun$apply$1.apply(StructureGenerationChunkProvider.scala:74)
	at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:188)
	at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:80)
	at farseek.world.gen.structure.StructureGenerationChunkProvider$.apply(StructureGenerationChunkProvider.scala:74)
	at streams.world.gen.structure.RiverGenerator.generate(RiverGenerator.scala:30)
	at farseek.world.gen.structure.StructureGenerator.onChunkGeneration(StructureGenerator.scala:44)
	at farseek.world.gen.structure.StructureGenerator.onChunkGeneration(StructureGenerator.scala:37)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_13_StructureGenerator_onChunkGeneration_ReplaceBiomeBlocks.invoke(.dynamic)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
	at net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(ForgeEventFactory.java:740)
	at net.minecraft.world.gen.ChunkGeneratorOverworld.func_185977_a(ChunkGeneratorOverworld.java:187)
	at net.minecraft.world.gen.ChunkGeneratorOverworld.func_185932_a(ChunkGeneratorOverworld.java:207)
	at net.minecraft.world.gen.ChunkProviderServer.func_186025_d(ChunkProviderServer.java:143)
	at net.minecraft.world.World.func_72964_e(World.java:310)
	at net.minecraft.world.World.func_175726_f(World.java:305)
	at net.minecraft.world.World.func_180495_p(World.java:911)
	at net.minecraft.world.World.func_175623_d(World.java:230)
	at net.minecraft.world.World.func_184141_c(World.java:210)
	at net.minecraft.world.WorldProvider.func_76566_a(WorldProvider.java:76)
	at net.minecraft.world.WorldServer.func_73052_b(WorldServer.java:944)
	at net.minecraft.world.WorldServer.func_72963_a(WorldServer.java:866)
	at net.minecraft.server.integrated.IntegratedServer.func_71247_a(IntegratedServer.java:123)
	at net.minecraft.server.integrated.IntegratedServer.func_71197_b(IntegratedServer.java:156)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)
	at java.lang.Thread.run(Thread.java:745)

I'm not sure why streams is calling OTGChunkGenerator's constructor? The ForgeWorld parameter is being passed as null, which is causing this problem. There is no public parameterless constructur for OTGChunkGenerator atm as it's not intended to be used that way.

Thanks and cheers

commented

Hi PG85,

I just tested Streams with the latest OTG 7 build and it seems to work fine, perhaps you've resolved the issue on your end. Could you re-test and confirm?

Some context on the Streams/OTG interaction:

Streams needs its own copy of the world's chunk generator so that it can pre-generate raw terrain within a certain range, without triggering recursive terrain generation from structure gen as the main generator would. Generally this is done by calling WorldProvider.createChunkGenerator(), but some mods like SpongeForge and OTG require special treatment. This is why Streams is calling the OTGChunkGenerator constructor here. This is a bit of an ugly hack that uses reflection and has to work around package-private code in OTG, but it's the only way I could make it work.

There's an additional hook into OTG that ensures the ReplaceBiomeBlocks Forge event is sent like in Vanilla, since Streams needs it. Would it be possible for you to implement sending this event in OTG, so I can get rid of that hack?

p.s. both of these functions will be refactored to fix an interaction between Farseek, OTG and the latest SpongeForge as part of a bugfix release planned for the next few days, but the basic principle remains the same.

Let me know if you have any questions or suggestions. Thanks!