Jump to content

Custom Dimension Caves arnt working


GhostSnyperRecon

Recommended Posts

please help me with this, ive got the files done but i cant get it to work :(

 

 

MapGenCavesWarp.java

 

 

package mod.warp;

 

import java.util.Random;

 

import net.minecraft.src.Block;

import net.minecraft.src.MapGenBase;

import net.minecraft.src.MathHelper;

import net.minecraft.src.World;

 

public class MapGenCavesWarp extends MapGenBase

{

    /**

    * Generates a larger initial cave node than usual. Called 25% of the time.

    */

    protected void generateLargeCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10)

    {

        this.generateCaveNode(par1, par3, par4, par5ArrayOfByte, par6, par8, par10, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D);

    }

 

    /**

    * Generates a node in the current cave system recursion tree.

    */

    protected void generateCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17)

    {

        double var19 = (double)(par3 * 16 + 8);

        double var21 = (double)(par4 * 16 + 8);

        float var23 = 0.0F;

        float var24 = 0.0F;

        Random var25 = new Random(par1);

 

        if (par16 <= 0)

        {

            int var26 = this.range * 16 - 16;

            par16 = var26 - var25.nextInt(var26 / 4);

        }

 

        boolean var54 = false;

 

        if (par15 == -1)

        {

            par15 = par16 / 2;

            var54 = true;

        }

 

        int var27 = var25.nextInt(par16 / 2) + par16 / 4;

 

        for (boolean var28 = var25.nextInt(6) == 0; par15 < par16; ++par15)

        {

            double var29 = 1.5D + (double)(MathHelper.sin((float)par15 * (float)Math.PI / (float)par16) * par12 * 1.0F);

            double var31 = var29 * par17;

            float var33 = MathHelper.cos(par14);

            float var34 = MathHelper.sin(par14);

            par6 += (double)(MathHelper.cos(par13) * var33);

            par8 += (double)var34;

            par10 += (double)(MathHelper.sin(par13) * var33);

 

            if (var28)

            {

                par14 *= 0.92F;

            }

            else

            {

                par14 *= 0.7F;

            }

 

            par14 += var24 * 0.1F;

            par13 += var23 * 0.1F;

            var24 *= 0.9F;

            var23 *= 0.75F;

            var24 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 2.0F;

            var23 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 4.0F;

 

            if (!var54 && par15 == var27 && par12 > 1.0F && par16 > 0)

            {

                this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D);

                this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D);

                return;

            }

 

            if (var54 || var25.nextInt(4) != 0)

            {

                double var35 = par6 - var19;

                double var37 = par10 - var21;

                double var39 = (double)(par16 - par15);

                double var41 = (double)(par12 + 2.0F + 16.0F);

 

                if (var35 * var35 + var37 * var37 - var39 * var39 > var41 * var41)

                {

                    return;

                }

 

                if (par6 >= var19 - 16.0D - var29 * 2.0D && par10 >= var21 - 16.0D - var29 * 2.0D && par6 <= var19 + 16.0D + var29 * 2.0D && par10 <= var21 + 16.0D + var29 * 2.0D)

                {

                    int var55 = MathHelper.floor_double(par6 - var29) - par3 * 16 - 1;

                    int var36 = MathHelper.floor_double(par6 + var29) - par3 * 16 + 1;

                    int var57 = MathHelper.floor_double(par8 - var31) - 1;

                    int var38 = MathHelper.floor_double(par8 + var31) + 1;

                    int var56 = MathHelper.floor_double(par10 - var29) - par4 * 16 - 1;

                    int var40 = MathHelper.floor_double(par10 + var29) - par4 * 16 + 1;

 

                    if (var55 < 0)

                    {

                        var55 = 0;

                    }

 

                    if (var36 > 16)

                    {

                        var36 = 16;

                    }

 

                    if (var57 < 1)

                    {

                        var57 = 1;

                    }

 

                    if (var38 > 120)

                    {

                        var38 = 120;

                    }

 

                    if (var56 < 0)

                    {

                        var56 = 0;

                    }

 

                    if (var40 > 16)

                    {

                        var40 = 16;

                    }

 

                    boolean var58 = false;

                    int var42;

                    int var45;

 

                    for (var42 = var55; !var58 && var42 < var36; ++var42)

                    {

                        for (int var43 = var56; !var58 && var43 < var40; ++var43)

                        {

                            for (int var44 = var38 + 1; !var58 && var44 >= var57 - 1; --var44)

                            {

                                var45 = (var42 * 16 + var43) * 128 + var44;

 

                                if (var44 >= 0 && var44 < 128)

                                {

                                    if (par5ArrayOfByte[var45] == Block.waterMoving.blockID || par5ArrayOfByte[var45] == Block.waterStill.blockID)

                                    {

                                        var58 = true;

                                    }

 

                                    if (var44 != var57 - 1 && var42 != var55 && var42 != var36 - 1 && var43 != var56 && var43 != var40 - 1)

                                    {

                                        var44 = var57;

                                    }

                                }

                            }

                        }

                    }

 

                    if (!var58)

                    {

                        for (var42 = var55; var42 < var36; ++var42)

                        {

                            double var59 = ((double)(var42 + par3 * 16) + 0.5D - par6) / var29;

 

                            for (var45 = var56; var45 < var40; ++var45)

                            {

                                double var46 = ((double)(var45 + par4 * 16) + 0.5D - par10) / var29;

                                int var48 = (var42 * 16 + var45) * 128 + var38;

                                boolean var49 = false;

 

                                if (var59 * var59 + var46 * var46 < 1.0D)

                                {

                                    for (int var50 = var38 - 1; var50 >= var57; --var50)

                                    {

                                        double var51 = ((double)var50 + 0.5D - par8) / var31;

 

                                        if (var51 > -0.7D && var59 * var59 + var51 * var51 + var46 * var46 < 1.0D)

                                        {

                                            byte var53 = par5ArrayOfByte[var48];

 

                                            if (var53 == WarpCraft.warpStoneBlock.blockID)

                                            {

                                                var49 = true;

                                            }

 

                                            if (var53 == WarpCraft.warpStoneBlock.blockID || var53 == Block.dirt.blockID || var53 == Block.grass.blockID)

                                            {

                                                if (var50 < 10)

                                                {

                                                    par5ArrayOfByte[var48] = (byte)Block.lavaMoving.blockID;

                                                }

                                                else

                                                {

                                                    par5ArrayOfByte[var48] = 0;

 

                                                    if (var49 && par5ArrayOfByte[var48 - 1] == Block.dirt.blockID)

                                                    {

                                                        par5ArrayOfByte[var48 - 1] = this.worldObj.getBiomeGenForCoords(var42 + par3 * 16, var45 + par4 * 16).topBlock;

                                                    }

                                                }

                                            }

                                        }

 

                                        --var48;

                                    }

                                }

                            }

                        }

 

                        if (var54)

                        {

                            break;

                        }

                    }

                }

            }

        }

    }

 

    /**

    * Recursively called by generate() (generate) and optionally by itself.

    */

    protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, byte[] par6ArrayOfByte)

    {

        int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(40) + 1) + 1);

 

        if (this.rand.nextInt(15) != 0)

        {

            var7 = 0;

        }

 

        for (int var8 = 0; var8 < var7; ++var8)

        {

            double var9 = (double)(par2 * 16 + this.rand.nextInt(16));

            double var11 = (double)this.rand.nextInt(this.rand.nextInt(120) + 8);

            double var13 = (double)(par3 * 16 + this.rand.nextInt(16));

            int var15 = 1;

 

            if (this.rand.nextInt(4) == 0)

            {

                this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13);

                var15 += this.rand.nextInt(4);

            }

 

            for (int var16 = 0; var16 < var15; ++var16)

            {

                float var17 = this.rand.nextFloat() * (float)Math.PI * 2.0F;

                float var18 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F;

                float var19 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat();

 

                if (this.rand.nextInt(10) == 0)

                {

                    var19 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F;

                }

 

                this.generateCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13, var19, var17, var18, 0, 0, 1.0D);

            }

        }

    }

}

 

 

 

 

ChunkProviderWarp.java

 

 

package mod.warp;

 

import java.util.List;

import java.util.Random;

 

import net.minecraft.src.BiomeGenBase;

import net.minecraft.src.Block;

import net.minecraft.src.BlockSand;

import net.minecraft.src.Chunk;

import net.minecraft.src.ChunkPosition;

import net.minecraft.src.EnumCreatureType;

import net.minecraft.src.IChunkProvider;

import net.minecraft.src.IProgressUpdate;

import net.minecraft.src.MapGenBase;

import net.minecraft.src.MapGenCaves;

import net.minecraft.src.MapGenCavesHell;

import net.minecraft.src.MapGenRavine;

import net.minecraft.src.MapGenScatteredFeature;

import net.minecraft.src.MapGenStronghold;

import net.minecraft.src.MathHelper;

import net.minecraft.src.NoiseGeneratorOctaves;

import net.minecraft.src.SpawnerAnimals;

import net.minecraft.src.World;

import net.minecraft.src.WorldGenDungeons;

import net.minecraft.src.WorldGenFire;

import net.minecraft.src.WorldGenFlowers;

import net.minecraft.src.WorldGenGlowStone1;

import net.minecraft.src.WorldGenHellLava;

import net.minecraft.src.WorldGenLakes;

 

public class ChunkProviderWarp implements IChunkProvider

{

    /** RNG. */

    private Random rand;

 

    /** A NoiseGeneratorOctaves used in generating terrain */

    private NoiseGeneratorOctaves noiseGen1;

 

    /** A NoiseGeneratorOctaves used in generating terrain */

    private NoiseGeneratorOctaves noiseGen2;

 

    /** A NoiseGeneratorOctaves used in generating terrain */

    private NoiseGeneratorOctaves noiseGen3;

 

    /** A NoiseGeneratorOctaves used in generating terrain */

    private NoiseGeneratorOctaves noiseGen4;

 

    /** A NoiseGeneratorOctaves used in generating terrain */

    public NoiseGeneratorOctaves noiseGen5;

 

    /** A NoiseGeneratorOctaves used in generating terrain */

    public NoiseGeneratorOctaves noiseGen6;

    public NoiseGeneratorOctaves mobSpawnerNoise;

 

    /** Reference to the World object. */

    private World worldObj;

 

    /** are map structures going to be generated (e.g. strongholds) */

    private final boolean mapFeaturesEnabled;

 

    /** Holds the overall noise array used in chunk generation */

    private double[] noiseArray;

    private double[] stoneNoise = new double[256];

    private MapGenBase caveGenerator = new MapGenCavesWarp();

 

    /** Holds StronghoFld Generator */

    private MapGenStronghold strongholdGenerator = new MapGenStronghold();

   

    private MapGenVillagesWarp villageswarpGenerator = new MapGenVillagesWarp(0);

 

    /** Holds Village Generator */

 

    /** Holds Mineshaft Generator */

    private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();

 

    /** Holds ravine generator */

    private MapGenBase ravineGenerator = new MapGenRavine();

 

    /** The biomes that are used to generate the chunk */

    private BiomeGenBase[] biomesForGeneration;

 

    /** A double array that hold terrain noise from noiseGen3 */

    double[] noise3;

 

    /** A double array that hold terrain noise */

    double[] noise1;

 

    /** A double array that hold terrain noise from noiseGen2 */

    double[] noise2;

 

    /** A double array that hold terrain noise from noiseGen5 */

    double[] noise5;

 

    /** A double array that holds terrain noise from noiseGen6 */

    double[] noise6;

 

    /**

    * Used to store the 5x5 parabolic field that is used during terrain generation.

    */

    float[] parabolicField;

    int[][] field_73219_j = new int[32][32];

 

    public ChunkProviderWarp(World par1World, long par2, boolean par4)

    {

        this.worldObj = par1World;

        this.mapFeaturesEnabled = true;

        this.rand = new Random(par2);

        this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16);

        this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16);

        this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 8);

        this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4);

        this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);

        this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);

        this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);

    }

 

    /**

    * Generates the shape of the terrain for the chunk though its all stone though the water is frozen if the

    * temperature is low enough

    */

    public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte)

    {

        byte var4 = 4;

        byte var5 = 16;

        byte var6 = 63;

        int var7 = var4 + 1;

        byte var8 = 17;

        int var9 = var4 + 1;

        this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, var7 + 5, var9 + 5);

        this.noiseArray = this.initializeNoiseField(this.noiseArray, par1 * var4, 0, par2 * var4, var7, var8, var9);

 

        for (int var10 = 0; var10 < var4; ++var10)

        {

            for (int var11 = 0; var11 < var4; ++var11)

            {

                for (int var12 = 0; var12 < var5; ++var12)

                {

                    double var13 = 0.125D;

                    double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0];

                    double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0];

                    double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0];

                    double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0];

                    double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13;

                    double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13;

                    double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13;

                    double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13;

 

                    for (int var31 = 0; var31 < 8; ++var31)

                    {

                        double var32 = 0.25D;

                        double var34 = var15;

                        double var36 = var17;

                        double var38 = (var19 - var15) * var32;

                        double var40 = (var21 - var17) * var32;

 

                        for (int var42 = 0; var42 < 4; ++var42)

                        {

                            int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 8 + var31;

                            short var44 = 128;

                            var43 -= var44;

                            double var45 = 0.25D;

                            double var49 = (var36 - var34) * var45;

                            double var47 = var34 - var49;

 

                            for (int var51 = 0; var51 < 4; ++var51)

                            {

                                if ((var47 += var49) > 0.0D)

                                {

                                    par3ArrayOfByte[var43 += var44] = (byte)WarpCraft.warpStoneBlock.blockID;

                                }

                                else if (var12 * 8 + var31 < var6)

                                {

                                    par3ArrayOfByte[var43 += var44] = (byte)Block.waterStill.blockID;

                                }

                                else

                                {

                                    par3ArrayOfByte[var43 += var44] = 0;

                                }

                            }

 

                            var34 += var38;

                            var36 += var40;

                        }

 

                        var15 += var23;

                        var17 += var25;

                        var19 += var27;

                        var21 += var29;

                    }

                }

            }

        }

    }

 

    /**

    * Replaces the stone that was placed in with blocks that match the biome

    */

    public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)

    {

        byte var5 = 63;

        double var6 = 0.03125D;

        this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, var6 * 2.0D, var6 * 2.0D, var6 * 2.0D);

 

        for (int var8 = 0; var8 < 16; ++var8)

        {

            for (int var9 = 0; var9 < 16; ++var9)

            {

                BiomeGenBase var10 = par4ArrayOfBiomeGenBase[var9 + var8 * 16];

                float var11 = var10.getFloatTemperature();

                int var12 = (int)(this.stoneNoise[var8 + var9 * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D);

                int var13 = -1;

                byte var14 = var10.topBlock;

                byte var15 = var10.fillerBlock;

 

                for (int var16 = 127; var16 >= 0; --var16)

                {

                    int var17 = (var9 * 16 + var8) * 128 + var16;

 

                    if (var16 <= 0 + this.rand.nextInt(5))

                    {

                        par3ArrayOfByte[var17] = (byte)Block.bedrock.blockID;

                    }

                    else

                    {

                        byte var18 = par3ArrayOfByte[var17];

 

                        if (var18 == 0)

                        {

                            var13 = -1;

                        }

                        else if (var18 != WarpCraft.warpStoneBlock.blockID)

                        {

                            if (var13 == -1)

                            {

                                if (var12 == 0)

                                {

                                    var14 = 0;

                                    var15 = (byte)WarpCraft.warpStoneBlock.blockID;

                                }

                                else if (var16 >= var5 - 4 && var16 <= var5 + 1)

                                {

                                    var14 = var10.topBlock;

                                    var15 = var10.fillerBlock;

                                }

 

                                if (var16 < var5 && var14 == 0)

                                {

                                    if (var11 < 0.15F)

                                    {

                                        var14 = (byte)Block.ice.blockID;

                                    }

                                    else

                                    {

                                        var14 = (byte)Block.waterStill.blockID;

                                    }

                                }

 

                                var13 = var12;

 

                                if (var16 >= var5 - 1)

                                {

                                    par3ArrayOfByte[var17] = var14;

                                }

                                else

                                {

                                    par3ArrayOfByte[var17] = var15;

                                }

                            }

                            else if (var13 > 0)

                            {

                                --var13;

                                par3ArrayOfByte[var17] = var15;

 

                                if (var13 == 0 && var15 == Block.sand.blockID)

                                {

                                    var13 = this.rand.nextInt(4);

                                    var15 = (byte)Block.sandStone.blockID;

                                }

                            }

                        }

                    }

                }

            }

        }

    }

 

    /**

    * loads or generates the chunk at the chunk location specified

    */

    public Chunk loadChunk(int par1, int par2)

    {

        return this.provideChunk(par1, par2);

    }

 

    /**

    * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the

    * specified chunk from the map seed and chunk seed

    */

    public Chunk provideChunk(int par1, int par2)

    {

    BlockWarpStone warpstoneblock = WarpCraft.warpStoneBlock;

        this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);

        byte[] var3 = new byte[32768];

        this.generateTerrain(par1, par2, var3);

        this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);

        this.replaceBlocksForBiome(par1, par2, var3, this.biomesForGeneration);

        byte[] warpstoneblock1 = new byte[32768];

        this.caveGenerator.generate(this, this.worldObj, par1, par2, warpstoneblock1);

        this.ravineGenerator.generate(this, this.worldObj, par1, par2, var3);

 

        if (this.mapFeaturesEnabled)

        {

        this.villageswarpGenerator.generate(this, this.worldObj, par1, par2, var3);

            this.strongholdGenerator.generate(this, this.worldObj, par1, par2, var3);

            this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, var3);

        }

 

        Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);

        byte[] var5 = var4.getBiomeArray();

 

        var4.generateSkylightMap();

        return var4;

    }

 

   

    /**

    * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the

    * size.

    */

    private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7)

    {

        if (par1ArrayOfDouble == null)

        {

            par1ArrayOfDouble = new double[par5 * par6 * par7];

        }

 

        if (this.parabolicField == null)

        {

            this.parabolicField = new float[25];

 

            for (int var8 = -2; var8 <= 2; ++var8)

            {

                for (int var9 = -2; var9 <= 2; ++var9)

                {

                    float var10 = 10.0F / MathHelper.sqrt_float((float)(var8 * var8 + var9 * var9) + 0.2F);

                    this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10;

                }

            }

        }

 

        double var44 = 684.412D;

        double var45 = 684.412D;

        this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D);

        this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D);

        this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2, par3, par4, par5, par6, par7, var44 / 80.0D, var45 / 160.0D, var44 / 80.0D);

        this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, var44, var45, var44);

        this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, var44, var45, var44);

        boolean var43 = false;

        boolean var42 = false;

        int var12 = 0;

        int var13 = 0;

 

        for (int var14 = 0; var14 < par5; ++var14)

        {

            for (int var15 = 0; var15 < par7; ++var15)

            {

                float var16 = 0.0F;

                float var17 = 0.0F;

                float var18 = 0.0F;

                byte var19 = 2;

                BiomeGenBase var20 = this.biomesForGeneration[var14 + 2 + (var15 + 2) * (par5 + 5)];

 

                for (int var21 = -var19; var21 <= var19; ++var21)

                {

                    for (int var22 = -var19; var22 <= var19; ++var22)

                    {

                        BiomeGenBase var23 = this.biomesForGeneration[var14 + var21 + 2 + (var15 + var22 + 2) * (par5 + 5)];

                        float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (var23.minHeight + 2.0F);

 

                        if (var23.minHeight > var20.minHeight)

                        {

                            var24 /= 2.0F;

                        }

 

                        var16 += var23.maxHeight * var24;

                        var17 += var23.minHeight * var24;

                        var18 += var24;

                    }

                }

 

                var16 /= var18;

                var17 /= var18;

                var16 = var16 * 0.9F + 0.1F;

                var17 = (var17 * 4.0F - 1.0F) / 8.0F;

                double var47 = this.noise6[var13] / 8000.0D;

 

                if (var47 < 0.0D)

                {

                    var47 = -var47 * 0.3D;

                }

 

                var47 = var47 * 3.0D - 2.0D;

 

                if (var47 < 0.0D)

                {

                    var47 /= 2.0D;

 

                    if (var47 < -1.0D)

                    {

                        var47 = -1.0D;

                    }

 

                    var47 /= 1.4D;

                    var47 /= 2.0D;

                }

                else

                {

                    if (var47 > 1.0D)

                    {

                        var47 = 1.0D;

                    }

 

                    var47 /= 8.0D;

                }

 

                ++var13;

 

                for (int var46 = 0; var46 < par6; ++var46)

                {

                    double var48 = (double)var17;

                    double var26 = (double)var16;

                    var48 += var47 * 0.2D;

                    var48 = var48 * (double)par6 / 16.0D;

                    double var28 = (double)par6 / 2.0D + var48 * 4.0D;

                    double var30 = 0.0D;

                    double var32 = ((double)var46 - var28) * 12.0D * 128.0D / 128.0D / var26;

 

                    if (var32 < 0.0D)

                    {

                        var32 *= 4.0D;

                    }

 

                    double var34 = this.noise1[var12] / 512.0D;

                    double var36 = this.noise2[var12] / 512.0D;

                    double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D;

 

                    if (var38 < 0.0D)

                    {

                        var30 = var34;

                    }

                    else if (var38 > 1.0D)

                    {

                        var30 = var36;

                    }

                    else

                    {

                        var30 = var34 + (var36 - var34) * var38;

                    }

 

                    var30 -= var32;

 

                    if (var46 > par6 - 4)

                    {

                        double var40 = (double)((float)(var46 - (par6 - 4)) / 3.0F);

                        var30 = var30 * (1.0D - var40) + -10.0D * var40;

                    }

 

                    par1ArrayOfDouble[var12] = var30;

                    ++var12;

                }

            }

        }

 

        return par1ArrayOfDouble;

    }

 

    /**

    * Checks to see if a chunk exists at x, y

    */

    public boolean chunkExists(int par1, int par2)

    {

        return true;

    }

 

 

    /**

    * Populates chunk with ores etc etc

    */

    public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)

    {

        BlockSand.fallInstantly = true;

        int var4 = par2 * 16;

        int var5 = par3 * 16;

        BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16);

        this.rand.setSeed(this.worldObj.getSeed());

        long var7 = this.rand.nextLong() / 2L * 2L + 1L;

        long var9 = this.rand.nextLong() / 2L * 2L + 1L;

        this.rand.setSeed((long)par2 * var7 + (long)par3 * var9 ^ this.worldObj.getSeed());

        boolean var11 = false;

 

        if (this.mapFeaturesEnabled)

        {

        this.villageswarpGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);

            this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);

            this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);

        }

 

        int var12;

        int var13;

        int var14;

 

        if (!var11 && this.rand.nextInt(4) == 0)

        {

            var12 = var4 + this.rand.nextInt(16) + 8;

            var13 = this.rand.nextInt(128);

            var14 = var5 + this.rand.nextInt(16) + 8;

            (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var12, var13, var14);

        }

 

        if (!var11 && this.rand.nextInt(8) == 0)

        {

            var12 = var4 + this.rand.nextInt(16) + 8;

            var13 = this.rand.nextInt(this.rand.nextInt(120) + 8);

            var14 = var5 + this.rand.nextInt(16) + 8;

 

            if (var13 < 63 || this.rand.nextInt(10) == 0)

            {

                (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var12, var13, var14);

            }

        }

 

        for (var12 = 0; var12 < 8; ++var12)

        {

            var13 = var4 + this.rand.nextInt(16) + 8;

            var14 = this.rand.nextInt(128);

            int var15 = var5 + this.rand.nextInt(16) + 8;

 

            if ((new WorldGenDungeons()).generate(this.worldObj, this.rand, var13, var14, var15))

            {

                ;

            }

        }

 

        var6.decorate(this.worldObj, this.rand, var4, var5);

        SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand);

        var4 += 8;

        var5 += 8;

 

        for (var12 = 0; var12 < 16; ++var12)

        {

            for (var13 = 0; var13 < 16; ++var13)

            {

                var14 = this.worldObj.getPrecipitationHeight(var4 + var12, var5 + var13);

 

                if (this.worldObj.isBlockFreezable(var12 + var4, var14 - 1, var13 + var5))

                {

                    this.worldObj.setBlockWithNotify(var12 + var4, var14 - 1, var13 + var5, Block.ice.blockID);

                }

 

                if (this.worldObj.canSnowAt(var12 + var4, var14, var13 + var5))

                {

                    this.worldObj.setBlockWithNotify(var12 + var4, var14, var13 + var5, Block.snow.blockID);

                }

            }

        }

       

        if (this.rand.nextInt(1) == 0)

        {

            var12 = var4 + this.rand.nextInt(16) + 8;

            var13 = this.rand.nextInt(128);

            var14 = var5 + this.rand.nextInt(16) + 8;

            (new WorldGenWarpBush()).generate(this.worldObj, this.rand, var12, var13, var14);

        }

       

        WorldGenTreesWarp worldgentreeswarp = new WorldGenTreesWarp();

        {

        var12 = var4 + this.rand.nextInt(16) + 8;

        var14 = var5 + this.rand.nextInt(16) + 8;

        var13 = this.rand.nextInt(128);

            worldgentreeswarp.generate(this.worldObj, this.rand, var12, var13, var14);

        }

       

 

        BlockSand.fallInstantly = false;

    }

    /**

    * Two modes of operation: if passed true, save all Chunks in one go.  If passed false, save up to two chunks.

    * Return true if all chunks have been saved.

    */

    public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)

    {

        return true;

    }

 

    /**

    * Unloads the 100 oldest chunks from memory, due to a bug with chunkSet.add() never being called it thinks the list

    * is always empty and will not remove any chunks.

    */

    public boolean unload100OldestChunks()

    {

        return false;

    }

 

    /**

    * Returns if the IChunkProvider supports saving.

    */

    public boolean canSave()

    {

        return true;

    }

 

    /**

    * Converts the instance data to a readable string.

    */

    public String makeString()

    {

        return "RandomLevelSource";

    }

 

    /**

    * Returns a list of creatures of the specified type that can spawn at the given location.

    */

    public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)

    {

        BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4);

        return var5 == null ? null : var5.getSpawnableList(par1EnumCreatureType);

    }

 

    /**

    * Returns the location of the closest structure of the specified type. If not found returns null.

    */

    public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5)

    {

        return "Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(par1World, par3, par4, par5) : null;

    }

 

    public int getLoadedChunkCount()

    {

        return 16;

    }

}

 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://mclo.gs/4UC49Ao
    • Way back in the Forge 1.17 days, work started for adding JPMS (Java Platform Module Support) to ModLauncher and ForgeModLoader. This has been used internally by Forge and some libraries for a while now, but mods (those with mods.toml specifically) have not been able to take advantage of it. As of Forge 1.21.1 and 1.21.3, this is now possible!   What is JPMS and what does it mean for modders? JPMS is the Java Platform Module System, introduced in Java 9. It allows you to define modules, which are collections of packages and resources that can be exported or hidden from other modules. This allows for much more fine-tuned control over visibility, cleaner syntax for service declarations and support for sealed types across packages. For example, you might have a mod with a module called `com.example.mod` that exports `com.example.mod.api` and `com.example.mod.impl` to other mods, but hides `com.example.mod.internal` from them. This would allow you to have a clean API for other mods to use, while keeping your internal implementation details hidden from IDE hints, helping prevent accidental usage of internals that might break without prior notice. This is particularly useful if you'd like to use public records with module-private constructors or partially module-private record components, as you can create a sealed interface that only your record implements, having the interface be exported and the record hidden. It's also nice for declaring and using services, as you'll get compile-time errors from the Java compiler for typos and the like, rather than deferring to runtime errors. In more advanced cases, you can also have public methods that are only accessible to specific other modules -- handy if you want internal interactions between multiple of your own mods.   How do I bypass it? We understand there may be drama in implementing a system that prevents mods from accessing each other's internals when necessary (like when a mod is abandoned or you need to fix a compat issue) -- after all, we are already modding a game that doesn't have explicit support for Java mods yet. We have already thought of this and are offering APIs from day one to selectively bypass module restrictions. Let me be clear: Forge mods are not required to use JPMS. If you don't want to use it, you don't have to. The default behaviour is to have fully open, fully exported automatic modules. In Java, you can use the `Add-Opens` and `Add-Exports` manifest attributes to selectively bypass module restrictions of other mods at launch time, and we've added explicit support for these when loading your Forge mods. At compile-time, you can use existing solutions such as the extra-java-module-info Gradle plugin to deal with non-modular dependencies and add extra opens and exports to other modules. Here's an example on how to make the internal package `com.example.examplemod.internal` open to your mod in your build.gradle: tasks.named('jar', Jar) { manifest { attributes([ 'Add-Opens' : 'com.example.examplemod/com.example.examplemod.internal' 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors // (...) ]) } } With the above in your mod's jar manifest, you can now reflectively access the classes inside that internal package. Multiple entries are separated with a space, as per Java's official spec. You can also use Add-Exports to directly call without reflection, however you'd need to use the Gradle plugin mentioned earlier to be able to compile. The syntax for Add-Exports is the same as Add-Opens, and instructions for the compile-time step with the Gradle plugin are detailed later in this post. Remember to prefer the opens and exports keywords inside module-info.java for sources you control. The Add-Opens/Add-Exports attributes are only intended for forcing open other mods.   What else is new with module support? Previously, the runtime module name was always forced to the first mod ID in your `mods.toml` file and all packages were forced fully open and exported. Module names are now distinguished from mod IDs, meaning the module name in your module-info.java can be different from the mod ID in your `mods.toml`. This allows you to have a more descriptive module name that doesn't have to be the same as your mod ID, however we strongly recommend including your mod ID as part of your module name to aid troubleshooting. The `Automatic-Module-Name` manifest attribute is now also honoured, allowing you to specify a module name for your mod without needing to create a `module-info.java` file. This is particularly useful for mods that don't care about JPMS features but want to have a more descriptive module name and easier integration with other mods that do use JPMS.   How do I use it? The first step is to create a `module-info.java` file in your mod's source directory. This file should be in the same package as your main mod class, and should look something like this: open module com.example.examplemod { requires net.minecraftforge.eventbus; requires net.minecraftforge.fmlcore; requires net.minecraftforge.forge; requires net.minecraftforge.javafmlmod; requires net.minecraftforge.mergetool.api; requires org.slf4j; requires logging; } For now, we're leaving the whole module open to reflection, which is a good starting point. When we know we want to close something off, we can remove the open modifier from the module and open or export individual packages instead. Remember that you need to be open to Forge (module name net.minecraftforge.forge), otherwise it can't call your mod's constructor. Next is fixing modules in Gradle. While Forge and Java support modules properly, Gradle does not put automatic modules on the module path by default, meaning that the logging module (from com.mojang:logging) is not found. To fix this, add the Gradle plugin and add a compile-time module definition for that Mojang library: plugins { // (...) id 'org.gradlex.extra-java-module-info' version "1.9" } // (...) extraJavaModuleInfo { failOnMissingModuleInfo = false automaticModule("com.mojang:logging", "logging") } The automatic module override specified in your build.gradle should match the runtime one to avoid errors. You can do the same for any library or mod dependency that is missing either a module-info or explicit Automatic-Module-Name, however be aware that you may need to update your mod once said library adds one. That's all you need to get started with module support in your mods. You can learn more about modules and how to use them at dev.java.
    • Faire la mise à jour grâce à ce lien m'a aider personnellement, merci à @Paint_Ninja. https://www.amd.com/en/support 
    • When I came across the 'Exit Code: I got a 1 error in my Minecraft mods, so I decided to figure out what was wrong. First, I took a look at the logs. In the mods folder (usually where you'd find logs or crash reports), I found the latest.log file or the corresponding crash report. I read it through carefully, looking for any lines with errors or warnings. Then I checked the Minecraft Forge support site, where you can often find info on what causes errors and how to fix them. I then disabled half of my mods and tried running the game. If the error disappeared, it meant that the problem was with the disabled mod. I repeated this several times to find the problem mod.
    • I have no idea - switch to a pre-configured modpack and use it as working base    
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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