Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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 ?

  • Author

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

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

  • Author

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

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

 

 

 

  • Author

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!!!!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.