papillon88 / tectonicus

Automatically exported from code.google.com/p/tectonicus
0 stars 0 forks source link

NullPointer when chunks are missing a BiomeId #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using McEdit, save any world (Existing or new) after making a few changes
2. Run Tectonicus against that world
3. NullPointer exception will occur on RawChunk.getBiomeId().

This is a joint issue, and I've reported it on Mcedit as well. McEdit doesn't 
seem to be correctly outputting the new Anvil format biomeid's. When I looked 
through the source, I noticed that RawChunk checks if a Biome tag was returned 
from the NbtUtil. If it was null, it does not initial the biomes byte array.

RawChunk.getBiomeId() does not check if biomes is null, leading to the 
exception.

I made the following tweak to fix:

    public int getBiomeId(final int x, final int y, final int z)
    {
        if(biomes != null)
            return biomes[x][z];
        else
            return BiomeIds.UNKNOWN; 
    }

I'll continue looking at McEdit to see if maybe I can fix the biome tag output 
as well, but felt I should post an issue here as well.

Original issue reported on code.google.com by ferret9...@gmail.com on 15 Aug 2012 at 4:21

GoogleCodeExporter commented 9 years ago
I went ahead and added your code to getBiomeId().  I don't know if McEdit still 
has the problem you mention but it seems like a good idea to check for a null 
BiomeId just in case.

Original comment by skoeven on 28 Nov 2012 at 6:38

GoogleCodeExporter commented 9 years ago

Original comment by skoeven on 19 Jun 2013 at 7:09