Jump to content

1.7.2 Forge Dimension generation Block[] over 4068


OwnAgePau

Recommended Posts

Hi there,

 

I had a custom dimension with multilple biomes and lots of things working for quite some time, but the new update to 1.7.2 seem to have broken it. I have highlighted the part where it crashes, it seems to go out of bounds of the Block[]. I can't seem to figure out why while looking through the code from the minecraft ChunkProviderHell. I hope some of you can provide me some insight why. This would be much appreciated.

 

 

 

    /**
     * Generates the shape of the terrain in the nether.
     */
    public void generateNetherTerrain(int par1, int par2, Block[] abyte)
    {

        byte b0 = 4;
        byte b1 = 32;
        int k = b0 + 1;
        byte b2 = 17;
        int l = b0 + 1;
        BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
        float t = biomegenbase.getFloatTemperature(k, 16, l);
        this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, k + 5, l + 5);
        this.noiseField = this.initializeNoiseField(this.noiseField, par1 * b0, 0, par2 * b0, k, b2, l);

        for (int i1 = 0; i1 < b0; ++i1)
        {
            for (int j1 = 0; j1 < b0; ++j1)
            {
                for (int k1 = 0; k1 < 16; ++k1)
                {
                    double d0 = 0.125D;
                    double d1 = this.noiseField[((i1 + 0) * l + j1 + 0) * b2 + k1 + 0];
                    double d2 = this.noiseField[((i1 + 0) * l + j1 + 1) * b2 + k1 + 0];
                    double d3 = this.noiseField[((i1 + 1) * l + j1 + 0) * b2 + k1 + 0];
                    double d4 = this.noiseField[((i1 + 1) * l + j1 + 1) * b2 + k1 + 0];
                    double d5 = (this.noiseField[((i1 + 0) * l + j1 + 0) * b2 + k1 + 1] - d1) * d0;
                    double d6 = (this.noiseField[((i1 + 0) * l + j1 + 1) * b2 + k1 + 1] - d2) * d0;
                    double d7 = (this.noiseField[((i1 + 1) * l + j1 + 0) * b2 + k1 + 1] - d3) * d0;
                    double d8 = (this.noiseField[((i1 + 1) * l + j1 + 1) * b2 + k1 + 1] - d4) * d0;

                    for (int l1 = 0; l1 < 8; ++l1)
                    {
                        double d9 = 0.25D;
                        double d10 = d1;
                        double d11 = d2;
                        double d12 = (d3 - d1) * d9;
                        double d13 = (d4 - d2) * d9;

                        for (int i2 = 0; i2 < 4; ++i2)
                        {
                            int j2 = i2 + i1 * 4 << 11 | 0 + j1 * 4 << 7 | k1 * 8 + l1;
                            short short1 = 128;
                            double d14 = 0.25D;
                            double d15 = d10;
                            double d16 = (d11 - d10) * d14; 

                            for (int k2 = 0; k2 < 4; ++k2)
                            {
                                Block l2 = null;

                                if (k1 * 8 + l1 < b1)
                                {
                                	l2 = SoulBlocks.SoulWater.get();
                                }
                                else if (d15 > 0.0D)
                                {
                                	l2 = SoulBlocks.Porphyry.get();
                                }
                                else
                                {
                                	l2 = null;
                                }
                                abyte[j2] = l2;
                                j2 += short1;
                                d15 += d16;
                            }

                            d10 += d12;
                            d11 += d13;
                        }

                        d1 += d5;
                        d2 += d6;
                        d3 += d7;
                        d4 += d8;
                    }
                }
            }
        }
    }

 

 

Link to comment
Share on other sites

Hi

 

That's curious because in the 1.7.2 version I have, ChunkProviderHell initialises that array to be 32768

 

        Block[] ablock = new Block[32768];

 

I gather that your two blocks are being allocated an ID > 4068, presumably < 32768.

So why is the caller to your function providing a Blocks array of only 4068 instead of 32768?  If you can figure that out you might get a step closer to the underlying problem.

 

I do remember something about 1.6.4 you couldn't use ores with an ID greater than 255 in the generators.  Perhaps this is something similar?

 

Pure guesswork unfortunately...

 

-TGG

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.