Tropicraft

Tropicraft

9M Downloads

Bamboo gen crashes the world

Sunconure11 opened this issue ยท 11 comments

commented

Issue Description

Upon generating a new world in SMP, I am greeted with a crash.

Steps to Reproduce

  1. Generate a world in SMP
  2. ???
  3. https://pastebin.com/jzT5nstn

Tropicraft Version: 7.1.3.62
Forge Version: 14.23.2.2652

Crash log

https://pastebin.com/jzT5nstn
commented

Looking at this code, setting a min patch size below 2 will mean that there's a chance that the spread value is set a negative value:

If amount is calculated to be 1 then (int)(Math.sqrt(amount) / 2) evaluates to 0.
This means that int spread = rand.nextInt(3) - 1 + (int)(Math.sqrt(amount) / 2); may evaluate to -1
This will cause line 49 to throw an Exception

commented

It appears this is connected to editing bamboo gen rates, or the config in some way. This is the old config I used:

https://pastebin.com/AedrZtQe

commented

Hi,
This issue is caused by a negative number being in the config. As it's a percentage chance for it to spawn, having a negative number would naturally not work.

commented

By default, the chance for palms to spawn is set to -1, in a clean config. Clearing the old config fixed this though, even though I was not using a negative number.

commented

Hi again,

My bad, jumped the gun a bit. This error is actually caused by I:maxBambooPerPatchOverworld being higher than I:minBambooPerPatchOverworld, as the min value is taken from the max value as seen here.

int amount = rand.nextInt(maxBamboo - minBamboo) + minBamboo;

commented

Which version are you using? @evhub

commented

With the config

generation {
    B:genBambooInOverworld=true
    B:genOverworldPalmsInBeachOnly=false
    B:genPalmsInOverworld=true
    B:genPineapplesInOverworld=true
    B:genTropicraftEIHInOverworld=true
    B:genTropicraftFlowersInOverworld=true

    # If false, no Tropicraft generation will occur at all in the overworld.
    B:genTropicraftInOverworld=true
    I:maxBambooPerPatchOverworld=30
    I:maxBambooPerPatchTropics=120
    I:minBambooPerPatchOverworld=10
    I:minBambooPerPatchTropics=60
    I:palmChanceOfGenInOverworld=-1
    I:palmPopulationFactorInOverworld=3
}

I get the crash here. This config certainly seems valid to me, though maybe I'm misinterpreting something.

commented

@Twrist 7.1.3.62

commented

Appears to be happening again, with vanilla settings.

https://pastebin.com/wpCizxpm

The kicker is that I'm trying to make a new world. On a server.

commented

tropicraft-MC1.12.2-7.1.3.62
forge-1.12.2-14.23.3.2673-installer-win

Crash in Tropicraft dimension:
crash-2018-05-03_21.25.12-server.txt

Copy of config file:
tropicraft.zip

commented

It would help to change the config to a min size and a growth size or something where max size = min + growth, or maybe just a condition in the code that, when it sees max is less than min, spits out a warn in the log and then just sets max to what min is set to. It's kind of weird how the config file max value has a range in brackets that appears to change to match the min value but only after a session (or world?) loads. Maybe just state that this must be greater than what min is set to, but no more than 1001?