Draylar / battle-towers

Populates the world with large towers filled with monsters and loot.
https://www.curseforge.com/minecraft/mc-mods/draylars-battle-towers
MIT License
7 stars 8 forks source link

Add check so that separation value is never greater than spacing value for structure #31

Closed TelepathicGrunt closed 3 years ago

TelepathicGrunt commented 4 years ago

Fun fact, due to how getStartChunk is coded, setting the spacing to 0 will crash Math.floorDiv(chunkX, i) due to divide by 0 and setting separation equal to or greater than spacing will crash placementRandom.nextInt(i - j); due to bounds must be positive.

image

Since your config allows users to control both spacing and separation, you should add a failsafe to automatically set separation to be 1 less than spacing and warn users of the invalid values. Just giving you a heads up as I just helped someone figure out a crash because they set spacing and separation to be equal which led to placementRandom.nextInt(0); crashing lol

Draylar commented 3 years ago

Just added some config validation/warnings in the latest update. Thanks for the info and insight!