Jump to content

[SOLVED]Glow-Stone Generation


tamanor

Recommended Posts

Hi how would i go about making more than two type's of glow stone generate in the nether i have my red Glow-Stone working but can not figure out how to get more after that. because when i add more to the code for each glow stone it starts to only spawn only one at a time

 

Glow-Stone Generation

 

 

package net.TMP.worldgen;

import java.util.Random;

import net.TMP.block.TMPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;

public class tmpNetherGlowStoneGen extends WorldGenerator
{
    private Block field_150519_a;
    /** The number of blocks to generate. */
    private int numberOfBlocks;
    private Block field_150518_c;
    private static final String __OBFID = "CL_00000426";
    private int mineableBlockMeta;

    public tmpNetherGlowStoneGen(Block p_i45459_1_, int p_i45459_2_)
    {
//        this(p_i45459_1_, p_i45459_2_, Blocks.glowstone);
    }

    public tmpNetherGlowStoneGen(Block p_i45460_1_, int p_i45460_2_, Block p_i45460_3_)
    {
        this.field_150519_a = p_i45460_1_;
        this.numberOfBlocks = p_i45460_2_;
        this.field_150518_c = p_i45460_3_;
    }

    public tmpNetherGlowStoneGen(Block block, int meta, int number, Block target)
    {
        this(block, number, target);
        this.mineableBlockMeta = meta;
    }

    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    {
        if (!par1World.isAirBlock(par3, par4, par5))
        {
            return false;
        }
        else if (par1World.getBlock(par3, par4 + 1, par5) != Blocks.netherrack)
        {
            return false;
        }
        else
        {
            par1World.setBlock(par3, par4, par5, TMPBlocks.redGlowStone, 0, 2);

            for (int l = 0; l < 1500; ++l)
            {
                int i1 = par3 + par2Random.nextInt( - par2Random.nextInt(;
                int j1 = par4 - par2Random.nextInt(12);
                int k1 = par5 + par2Random.nextInt( - par2Random.nextInt(;

                if (par1World.getBlock(i1, j1, k1).getMaterial() == Material.air)
                {
                    int l1 = 0;

                    for (int i2 = 0; i2 < 6; ++i2)
                    {
                        Block block = null;

                        if (i2 == 0)
                        {
                            block = par1World.getBlock(i1 - 1, j1, k1);
                        }

                        if (i2 == 1)
                        {
                            block = par1World.getBlock(i1 + 1, j1, k1);
                        }

                        if (i2 == 2)
                        {
                            block = par1World.getBlock(i1, j1 - 1, k1);
                        }

                        if (i2 == 3)
                        {
                            block = par1World.getBlock(i1, j1 + 1, k1);
                        }

                        if (i2 == 4)
                        {
                            block = par1World.getBlock(i1, j1, k1 - 1);
                        }

                        if (i2 == 5)
                        {
                            block = par1World.getBlock(i1, j1, k1 + 1);
                        }

                        if (block == TMPBlocks.redGlowStone)
                        {
                            ++l1;
                        }
                    }

                    if (l1 == 1)
                    {
                        par1World.setBlock(i1, j1, k1, TMPBlocks.redGlowStone, 0, 2);
                    }
                }
            }

            return true;
        }
    
    }
}

 

 

World Generation

 

package net.TMP.worldgen;

import java.util.Random;

import net.TMP.block.TMPBlocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;

public class tmpWorldGeneration implements IWorldGenerator

{

@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider) 
{

	switch(world.provider.dimensionId) {
	case -1:
	generateNether(world, random, chunkX*16, chunkZ*16);
	break;
	case 0:
	generateSurface(world, random, chunkX*16, chunkZ*16);
	break;
	case 1:
	generateEnd(world, random, chunkX*16, chunkZ*16);
	break;
	}


}

private void generateEnd(World world, Random random, int i, int j) {
	// TODO Auto-generated method stub

}

private void generateSurface(World world, Random random, int i, int j) {
	// TODO Auto-generated method stub

}

private void generateNether(World world, Random random, int i, int j) {

	for (int k = 0; k < 25; k++) {
		int chunkX1 = i + random.nextInt(16);
		int chunkY1 = random.nextInt(256);
		int chunkZ1 = j + random.nextInt(16);

		(new tmpNetherGlowStoneGen(TMPBlocks.redGlowStone, 50)).generate(world, random, chunkX1, chunkY1, chunkZ1);

	}
}



}

 

Link to comment
Share on other sites

just copy your for loop in the generateNether and change the random.nextInt() values and change the block it spawns in (new ... ) and you should be good to go....

 

Thanks i got it working now i was doing something similar but i was only copying the "(new tmpNetherGlowStoneGen(TMPBlocks.redGlowStone, 50)).generate(world, random, chunkX1, chunkY1, chunkZ1);" bit of if and not the full loop xD

 

 

Thanks Again

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.

Announcements



×
×
  • Create New...

Important Information

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