Solved Empty BlockPopulator crashing server

Discussion in 'Plugin Development' started by Zombie__Hunter, Jun 8, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    Zombie__Hunter

    I'm trying to change the material and store the location of certain blocks when a chunk is populated. This worked perfectly in 1.18.2 however after updating my plugin and server to 1.19 it crashes every time a chunk is loaded, even after I've removed every piece of code from the populator. Are populators currently bugged or am I missing something?

    Description: Exception generating new chunk

    java.lang.NullPointerException: Cannot invoke "net.minecraft.util.RandomSource.b(long)" because "this.random" is null
    at org.bukkit.craftbukkit.v1_19_R1.util.RandomSourceWrapper$RandomWrapper.setSeed(RandomSourceWrapper.java:75)
    at java.base/java.util.Random.<init>(Random.java:145)
    at java.base/java.util.Random.<init>(Random.java:108)
    at org.bukkit.craftbukkit.v1_19_R1.util.RandomSourceWrapper$RandomWrapper.<init>(RandomSourceWrapper.java:69)
    at net.minecraft.world.level.chunk.ChunkGenerator.applyBiomeDecoration(ChunkGenerator.java:631)
    at net.minecraft.world.level.chunk.ChunkGenerator.a(ChunkGenerator.java:614)
    at net.minecraft.world.level.chunk.ChunkStatus.lambda$11(ChunkStatus.java:148)
    at net.minecraft.world.level.chunk.ChunkStatus.a(ChunkStatus.java:275)
    at net.minecraft.server.level.PlayerChunkMap.lambda$31(PlayerChunkMap.java:701)
    at com.mojang.datafixers.util.Either$Left.map(Either.java:38)
    at net.minecraft.server.level.PlayerChunkMap.lambda$30(PlayerChunkMap.java:699)
    at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
    at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
    at net.minecraft.server.level.ChunkTaskQueueSorter.b(SourceFile:62)
    at net.minecraft.util.thread.ThreadedMailbox.h(SourceFile:91)
    at net.minecraft.util.thread.ThreadedMailbox.a(SourceFile:146)
    at net.minecraft.util.thread.ThreadedMailbox.run(SourceFile:102)
    at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

    emptypop.png

    worldinit.png
     
  2. Offline

    KarimAKL

    @Zombie__Hunter I don't know much about world generation, but the exception message states that "this.random" is null, so I would try initializing it.
    The parameters 'worldInfo', 'random' and 'limitedRegion' all have the @NotNull annotation, so if possible, you should probably make sure all of those are initialized.
     
  3. Offline

    Zombie__Hunter

    I wish I could but the error takes place in a method inside the craftbukkit jar. I tried setting the random to a new one if it equaled null in the populate() method but it didn't change anything.
     
  4. Offline

    KarimAKL

    @Zombie__Hunter You can try using reflection to initialize it before you add the populator to your world.
    Apart from that, I would try building a new server jar in case it's a bug with the latest non-stable release.
     
  5. Offline

    Zombie__Hunter

    I've never used reflection so far but I could look into it. Definitely going to try building a new jar though that's a good idea.

    Making a new server with a new jar fixed the issue!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 22, 2022
Thread Status:
Not open for further replies.

Share This Page