Minecraft
  1. Minecraft
  2. MC-46082

Crashes when populating a chunk with empty (void) columns

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.7.4, Minecraft 1.7.5, Minecraft 1.7.9, Minecraft 14w21b, Minecraft 14w25b, Minecraft 1.7.10, Minecraft 14w28b, Minecraft 14w29a, Minecraft 14w29b, Minecraft 14w30a, Minecraft 14w30b, Minecraft 14w33c
    • Fix Version/s: Minecraft 1.8-pre2
    • Security Level: Minecraft - Public (Viewable by everyone)
    • Labels:
      None
    • Environment:

      Ubuntu 13.04 64-bit
      java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

    • Confirmation Status:
      Confirmed

      Description

      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

      2;0;1;decoration

      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):

            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);
            }
      

      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:

            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);
               }
            }
      

      The same would have to be done for the other loops in that method.

      1. crash-2014-01-25_17.33.43-server.txt
        3 kB
        Pepijn Schmitz
      2. crash-2014-01-25_19.58.57-server.txt
        3 kB
        Pepijn Schmitz
      3. crash-2014-02-22_10.51.54-server.txt
        3 kB
        Seann Giffin
      4. crash-2014-02-22_14.29.12-server.txt
        3 kB
        Pepijn Schmitz
      5. crash-2014-07-11_14.34.04-server.txt
        3 kB
        ShadowofElements
      6. crash-2014-07-16_12.07.32-server.txt
        3 kB
        ShadowofElements
      7. crash-2014-07-17_20.29.06-server.txt
        3 kB
        ShadowofElements
      8. crash-2014-07-23_15.21.20-server.txt
        3 kB
        ShadowofElements

        Issue Links

          Activity

          Hide
          Sonic added a comment -

          1.8 is already prereleased, but 1.8-pre2 is expected today.

          Show
          Sonic added a comment - 1.8 is already prereleased, but 1.8-pre2 is expected today.
          Hide
          Samg_is_a_Ninja added a comment -

          Thank you so much Mojang! I am glad this bug was fixed,, now the map that it made in 1.6, people can download and use 1.8.

          Show
          Samg_is_a_Ninja added a comment - Thank you so much Mojang! I am glad this bug was fixed,, now the map that it made in 1.6, people can download and use 1.8.
          Hide
          ShadowofElements added a comment -

          Thanks Mojang!

          Show
          ShadowofElements added a comment - Thanks Mojang!
          Hide
          Pepijn Schmitz added a comment -

          Unfortunately it seems that the bug has only been fixed for Superflat mode.

          Is there any chance of getting it fixed for all world types, to fix the use case where people want Minecraft to populate the world with trees, etc. but want it to contain void as well?

          Show
          Pepijn Schmitz added a comment - Unfortunately it seems that the bug has only been fixed for Superflat mode. Is there any chance of getting it fixed for all world types, to fix the use case where people want Minecraft to populate the world with trees, etc. but want it to contain void as well?
          Hide
          redstonehelper added a comment -

          Can you post a preset which includes empty columns? (or some other way to reproduce)

          Show
          redstonehelper added a comment - Can you post a preset which includes empty columns? (or some other way to reproduce)

            People

            • Assignee:
              [Mojang] Mog (Ryan Holtz)
              Reporter:
              Pepijn Schmitz
            • Votes:
              40 Vote for this issue
              Watchers:
              28 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                CHK: