Jump to content

Recommended Posts

Posted

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

Posted

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 ?

Posted
  On 1/6/2013 at 9:35 PM, SpeakersMind said:

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());"

Posted

well if you want, you dont need a newWorldGenMinable, you could create a new class that does the exact same but make a parameter for metadata :) Hope this helps!

The Korecraft Mod

Posted
  On 1/7/2013 at 10:53 PM, Kore said:

well if you want, you dont need a newWorldGenMinable, you could create a new class that does the exact same but make a parameter for metadata :) Hope this helps!

 

i get what you mean just dont know how to do it but thanks very much

Posted

this is a part out of my world gen :

 

 

  Reveal hidden contents

 

if you do it like this

 

  Reveal hidden contents

 

Posted

this is my gen code now:

 

 

  Reveal hidden contents

 

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

Posted

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);
}
}

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.