java.lang.NullPointerException

Mojang JIRA | Pepijn Schmitz | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Minecraft crashes when populating a chunk which has empty columns ("void columns"), i.e. colums with just air blocks, no bedrock, such as can for instance be generated by creating a Superflat world with preset {noformat}2;0;1;decoration{noformat} I have attached the crash report. I don't have access to the Minecraft source code, but using the Minecraft Coder Pack for Minecraft 1.7.2 I've traced it to the following code in BiomeDecorator.java (method func_150513_a(BiomeGenBase), lines 160-166): {code} for(var3 = 0; var3 < this.grassPerChunk; ++var3) { var4 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; var5 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; var6 = this.randomGenerator.nextInt(this.currentWorld.getHeightValue(var4, var5) * 2); WorldGenerator var10 = p_150513_1_.getRandomWorldGenForGrass(this.randomGenerator); var10.generate(this.currentWorld, this.randomGenerator, var4, var6, var5); } {code} It takes the height at a particular x,z coordinate and feeds the result (times two) to Random.nextInt(int). Unfortunately that method throws an exception when passed a value of zero. One way to fix this would be to change those lines to something like: {code} for(var3 = 0; var3 < this.grassPerChunk; ++var3) { var4 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; var5 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; int height = this.currentWorld.getHeightValue(var4, var5); if (height > 0) { var6 = this.randomGenerator.nextInt(height * 2); WorldGenerator var10 = p_150513_1_.getRandomWorldGenForGrass(this.randomGenerator); var10.generate(this.currentWorld, this.randomGenerator, var4, var6, var5); } } {code} The same would have to be done for the other loops in that method.

    Mojang JIRA | 3 years ago | Pepijn Schmitz
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at net.minecraft.server.MinecraftServer.n()
    2. MC Server
      MinecraftServer.n
      1. net.minecraft.server.MinecraftServer.n(SourceFile:299)[1.7.4.jar:?]
      1 frame
    3. Unknown
      btk.n
      1. btk.n(SourceFile:230)[1.7.4.jar:?]
      1 frame
    4. MC Server
      MinecraftServer.run
      1. net.minecraft.server.MinecraftServer.run(SourceFile:389)[1.7.4.jar:?]
      1 frame
    5. Unknown
      lb.run
      1. lb.run(SourceFile:616)[1.7.4.jar:?]
      1 frame