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

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++) {

 

}

 

}

 

}

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

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.