Jump to content

Recommended Posts

Posted

Hey so I am now trying to get my ore to generate in the world and he guy in the video started to confuse me. I was able to get a start on the code but I was unable to finish it. Can someone help me finish up this code so my ore will generate? Thanks.

 

package net.Cristalore.mod;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

import cpw.mods.fml.common.IWorldGenerator;

 

public class cristalGen implements IWorldGenerator {

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world,

IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

switch(world.provider.dimensionId) {

case 0 :

//Generate

generateSurface(world, random, chunkX*16, chunkZ*16);

}

 

 

}

 

private void generateSurface(World world, Random random, int x, int z) {

this.addOreSpawn(cristalore.Blockcristalore, world, random, x, z, 16, 16, 4+random.nextInt(6), 25, 38, 100);

 

}

 

private void addOreSpawn(Block blockcristalore, World world, Random random,

int x, int z, int i, int j, int k, int l, int m, int n) {

for(int i = 0; 1 < k; i++) {

 

}

 

}

 

}

Posted

Hello, first use code blocks (its the # in the editor bar) and spoilers for long pieces of code, makes it cleaner.

Next, your missing a key part.

 

In your "addOreSpawn" you need to call the WorldGenMineable.generate method.

Heres and example from my mod.

private void generateSurface(World world, Random rand, int baseX, int baseZ)
    {
        // rarity -smaller number = rarer
        for (int x = 0; x < 50; x++)
        {
            int Xcoord = baseX + rand.nextInt(16);
            int Zcoord = baseZ + rand.nextInt(16);
            int Ycoord = rand.nextInt(30);
            // Max Vein Size
            new WorldGenMinable(LabStuffMain.blockCopperOre, 4).generate(world, rand, Xcoord, Ycoord, Zcoord);
        }
}

 

Just copy the for loop for each ore. The x in the for loop is commonisity, smaller number, less common.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

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.