Jump to content

Recommended Posts

Posted

Hello, and as the title suggests I am new to modding and would like to know how to add ore generation to my minecraft mod.

I have found mod tutorials for 1.7.2 but I'm not sure if they are working for 1.7.10 and they all have different file structures than mine. Any and all help would be appreciated, and if I need to give any more information I will gladly do so :)

Posted

Nothing changed regarding the file structure since 1.7.2, I believe. How is your file structure different from the tutorials, and - assuming a sensible file structure - how is this a problem?

 

If you're not sure the tutorials work for 1.7.10, why not give them a go and see if they do? :)

Posted

Here's how to generate ores in 1.7.10 (assuming you already have made the block to be your ore)

In your mod's main class, type in this before the @EventHandler:

 

public static MyBlockWG myblockwg = new MyBlockWG();

 

You can call myblockwg and MyBlockWG anything you want, but make sure that both instances of MyBlockWG are the same. After the @EventHandler add this:

 

GameRegistry.registerWorldGenerator(myblockwg, 1);

 

Make sure that myblockwg is the same as what you changed myblockwg to in the first line. Now make a new class called whatever you changed MyBlockWG to (in this demo it'll be MyBlockWG) and copy and paste this over everything:

 

package com.toastrackengima.mymod; //Change to your package's name

 

//Import stuff

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 LoadOreWG implements IWorldGenerator {

 

@Override

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

IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

 

                        //Do different things to generate / not generate in the overworld, the nether and the end

switch(world.provider.dimensionId) {

case -1 :

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

break;

case 0 :

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

break;

case 1 :

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

break;

 

}

 

}

 

public void generateInEnd(World world, Random random, int x, int y) {

//Since we don't want it in the end, this is empty

 

}

 

public void generateInOverworld(World world, Random random, int x, int z) {

for(int i=0; i<6; i++) { //The number after i (in this case 6) is how many veins spawn per chunk (16*16*16 area)

int xcoord = x + random.nextInt(16); //Sets random coords for the x axis

int ycoord =  random.nextInt(256); //Sets random coords for the y axis

int zcoord = z + random.nextInt(16); //Sets random coords for the z axis

new WorldGenMinable(MainMod.loadore, 15).generate(world, random, xcoord, ycoord, zcoord); //Generates it (the number in the World Gen Minable function (in this case 15) is the max amount of blocks in each vein).

}

 

}

 

public void generateInNether(World world, Random random, int x, int y) {

//Since we don't want it in the nether, this is empty

}

 

}

 

Hope this helps :)

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.