rutgerkok / WorldGeneratorApi

Minecraft Spigot plugin that enables other plugins to customize world generation
MIT License
96 stars 9 forks source link

"Custom biome generators be stored in a config file" #14

Closed MichaelHilus closed 4 years ago

MichaelHilus commented 4 years ago

Describe the bug When a world with a custom biome generator is about to be stored, the server crashes with UnsupportedOperationException: Custom biome generators be stored in a config file.

To Reproduce Steps to reproduce the behavior:

  1. Create a biome generator like in the examples that sets everywhere the biome to DESERT.
  2. Use the WorldGeneratorInitEvent approach to set your generator: event.getWorldGenerator().setBiomeGenerator(new CustomBiomeGenerator())
  3. Use Multiverse to generate a new world
  4. Fly around the world
  5. Stop the server

The exception raises whenever the world is going to be persisted. This happens eigher while flying around, or at server stop. I could too find this exception raised when deleting the world with /mv delete <yourworld>.

MichaelHilus commented 4 years ago

While digging in WorldGeneratorApis code, I found that the InjectedBiomeGenerator.a() method is throwing that exception by default. So will this method not be called when using a config file? If so, can this be fixed with an empty config file, or are there some required properties that need to be placed in that file?

rutgerkok commented 4 years ago

For some reason, I cannot reproduce this. I tried it as you described, with Multiverse and a plugin that uses the WorldGeneratorIntEvent. However, Minecraft never calls this .a() method and just saves the world with the default biome generator stored in the level.dat.

Maybe it depends on the custom settings of your world? Do you have a stack trace?

rutgerkok commented 4 years ago

Tried to address this. Without being able to reproduce this, I cannot test if it actually worked.

romsto commented 4 years ago

Hey I got the same problem, step to reproduce: generate few chunks with a custom biome generator and the call World#save. I hope you'll be able to test it cause this is a problem when it comes to save generated world

rutgerkok commented 4 years ago

So that means that the latest dev build ( https://ci.codemc.io/job/rutgerkok/job/WorldGeneratorApi/ ) doesn't fix the issue?

If not, I'll try that!

romsto commented 4 years ago

Not tested yet, i'll tell you more today

romsto commented 4 years ago

Update: The old error is now replace with a cast error. https://prnt.sc/tlhgf2 c.f. issue opened

rutgerkok commented 4 years ago

Second attempt! Build 11 (available soon) at https://ci.codemc.io/job/rutgerkok/job/WorldGeneratorApi/ should fix this.