AlmuraDev / SGCraft

Stargates mod for Minecraft
https://www.almuramc.com/sgcraft/SGCraft.html
MIT License
31 stars 29 forks source link

Ore generation crash #101

Closed LemADEC closed 5 years ago

LemADEC commented 5 years ago

As of 2.0.1, setting any of genIsolatedOdds, genUnderLavaOdds, maxIsolatedNodes or maxNodesUnderLava to 0 will crash the server during world generation. In other words, we can't have only isolated or lava nodes without another mods doing the world generation.

Here's an example of crash from this:

java.lang.IllegalArgumentException: bound must be positive
    at java.util.Random.nextInt(Unknown Source)
    at gcewing.sg.generator.NaquadahOreWorldGen.odds(NaquadahOreWorldGen.java:124)
    at gcewing.sg.generator.NaquadahOreWorldGen.generateChunk(NaquadahOreWorldGen.java:142)
    at gcewing.sg.generator.NaquadahOreWorldGen.generate(NaquadahOreWorldGen.java:62)
    at net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:167)
    at net.minecraft.world.chunk.Chunk.func_186034_a(Chunk.java:1020)
    at net.minecraft.world.chunk.Chunk.func_186030_a(Chunk.java:999)
    at net.minecraft.world.gen.ChunkProviderServer.func_186025_d(ChunkProviderServer.java:157)
    at net.minecraft.server.MinecraftServer.func_71222_d(MinecraftServer.java:344)
    at net.minecraft.server.integrated.IntegratedServer.func_71247_a(IntegratedServer.java:142)
    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(Unknown Source)
Dockter commented 5 years ago

With setting this to zero what is your goal?

LemADEC commented 5 years ago

In my case, I want to have ore generating only inside lava, not 'isolated'. By setting those to 0, I expect to disable that part of the ore generation.

Dockter commented 5 years ago

Fixed this in build 2.0.2 by doing a check like this:

if (genIsolatedOdds > 0 && odds(genIsolatedOdds)) {