Jump to content

MODDING HELP (GENERATING METADATA BLOCKS)


sidthesloth123

Recommended Posts

by the title you can tell im trying to gen metadata blocks here is my gen class.

 

OreGasWorldGenerator:

package es_common.sidthesloth.main;

import java.util.Random;

import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;

import cpw.mods.fml.common.IWorldGenerator;

public class OreGasWorldGenerator 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();
break;
case 0:
generateSurface(world, random, chunkX*16, chunkZ*16);
break;
case 1:
generateEnd();
break;
}
}

public void generateNether() {
//we're not doing ore ore in the nether
}

public void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
for (int i = 0; i < 30; i++) {
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(64);
int randPosZ = chunkZ + rand.nextInt(16);

(new WorldGenMinable(es_main_blocks.blockOremeta.blockID,7, 10)).generate(world, rand,
randPosX, randPosY, randPosZ);
}
}

public void generateEnd() {
//we're not going to generate in the end either
}
}

 

 

if anyone can help id be very greatful

Link to comment
Share on other sites

I think there is nothing wrong with this code.. but here is the generation part of mine

 

[embed=425,349](new WorldGenMinable(ItemAndBlockHandler.BlockResources.blockID, 0, 8)).generate(w, rand, x, y, z);[/embed]

 

but i originally derp'd on Registering the World Generator, have you done that ?

Link to comment
Share on other sites

I think there is nothing wrong with this code.. but here is the generation part of mine

 

[embed=425,349](new WorldGenMinable(ItemAndBlockHandler.BlockResources.blockID, 0, 8)).generate(w, rand, x, y, z);[/embed]

 

but i originally derp'd on Registering the World Generator, have you done that ?

 

yes i did in my @init load "GameRegistry.registerWorldGenerator(new OreGasWorldGenerator());"

Link to comment
Share on other sites

this is a part out of my world gen :

 

 

 

int randPosX = (chunkX * 16) + rand.nextInt(16);

            int randPosY = rand.nextInt(64);

            int randPosZ = (chunkZ * 16) + rand.nextInt(16);

            int randSize = rand.nextInt(12);

//first ore                   

            (new WorldGenMinable(Dyeing.WhiteDyeOre.blockID, 3)).generate(world, rand, randPosX, randPosY, randPosZ);

// second ore with same prop

            randPosY = rand.nextInt(64);

            (new WorldGenMinable(Dyeing.OrangeDyeOre.blockID, 3)).generate(world, rand, randPosX, randPosY, randPosZ);

 

 

if you do it like this

 

 

int randPosX = (chunkX * 16) + rand.nextInt(16);

            int randPosY = rand.nextInt(64);

            int randPosZ = (chunkZ * 16) + rand.nextInt(16);

            int randSize = rand.nextInt(12);

 

            (new WorldGenMinable(Dyeing.OrangeDyeOre.blockID, 3)).generate(world, rand, randPosX, randPosY, randPosZ);

            (new WorldGenMinable(Dyeing.WhiteDyeOre.blockID, 3)).generate(world, rand, randPosX, randPosY, randPosZ);

// the ore will spawn in one vein together

 

 

 

Link to comment
Share on other sites

this is my gen code now:

 

 

package es_common.sidthesloth.main;

import java.util.Random;

import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;

import cpw.mods.fml.common.IWorldGenerator;

public class OreGasWorldGenerator 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();
break;
case 0:
generateSurface(world, random, chunkX*16, chunkZ*16);
break;
case 1:
generateEnd();
break;
}
}

public void generateNether() {
//we're not doing ore ore in the nether
}

public void generateSurface(World world, Random rand, int chunkX, int chunkZ) {

int randPosX = (chunkX * 16) + rand.nextInt(16);
    int randPosY = rand.nextInt(64);
    int randPosZ = (chunkZ * 16) + rand.nextInt(16);
    int randSize = rand.nextInt(12);
//the 18 is ment to be the blockOremeta.blockID, metadata
(new WorldGenMinable(es_main_blocks.blockOremeta.blockID, 18, 50)).generate(world, rand,
randPosX, randPosY, randPosZ);
}

public void generateEnd() {
//we're not going to generate in the end either
}
}

 

but now i cant find it in test worlds and im still not sure still how to gen meta data blocks help!!!!

Link to comment
Share on other sites

You are doing metadata correct, but wrap the generation code in a for loop and loop it like 50 times and than it should spawn more, because as far as i can see, your code only spawns one group of ores in each chunk

 

try this one, lower the 50 in the for loop too your needs

public void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
int randPosX, randPosY, randPosZ, randSize;
for(int i = 0; i < 50; i++){
randPosX = (chunkX * 16) + rand.nextInt(16);
randPosY = rand.nextInt(64);
randPosZ = (chunkZ * 16) + rand.nextInt(16);
randSize = rand.nextInt(12);
//the 18 is ment to be the blockOremeta.blockID, metadata
(new WorldGenMinable(es_main_blocks.blockOremeta.blockID, 18, 50)).generate(world, rand,
randPosX, randPosY, randPosZ);
}
}

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.