Jump to content

Recommended Posts

Posted

Hi, im a bit new to modding and i have hit a bit of a dead end when it comes to generating ores in the world. I have looked at some other threads with similar problems but none of them have seemed to help me. I also looked through some of the FML code with some generation programs but some of the parameters like the chunkprovider dont really ring a bell for me. Any help's nice

 

Also, I have trouble with opening a GUI when it comes to right clicking on a block.

The error report says that it is missing a mapping and i dont know what that means.

 

              --Vem

Posted

For ore generation:

1. Register you world generator in main mod class(@Init)

GameRegistry.registerWorldGenerator(new MyReallyCoolAndEpicWorldGenerator());

2. Create himself...

package <you mod package>;

import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenMinable; // Import earth generator
import cpw.mods.fml.common.IWorldGenerator;

public class MyReallyCoolAndEpicWorldGenerator implements IWorldGenerator {

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
switch(world.provider.dimensionId) { // Checking world
case -1:
generateNether(world, random, chunkX*16, chunkZ*16); // Nether
break;
case 0:
generateSurface(world, random, chunkX*16, chunkZ*16); // Earth(normal world)
break;
case 1:
generateEnd(world, random, chunkX*16, chunkZ*16); // End(with dragon)
break;
}
}

public void generateNether(World par1World, Random rand, int par3, int par5) {} // Nether 

public void generateSurface() { // Earth
    for(int i = 0; i < 7; i++) // "7" max ore per chunk
    {
        int randPosX = par3 + rand.nextInt(16);
        int randPosY = rand.nextInt(128); // Ore generation up to 128 layer(y coordinate)
        int randPosZ = par5 + rand.nextInt(16);
        (new WorldGenMinable(<you block>.blockID, 10)).generate(par1World, rand, randPosX, randPosY, randPosZ); // "10" is max ore per correct place
    }
   // Finally we have 70(7*10) ore per chunk
}

public void generateEnd() {} // End generation
}

P.S. Sorry for bad english

Posted

Show me the relevant code and I'm sure we will be able to sort out the GUI stuff :)

Relevent code files(use paste.mincraftforge.net):

BlockFile

MainModFile

ClientProxy

 

If you guys dont get it.. then well ya.. try harder...

Posted

For ore generation:

1. Register you world generator in main mod class(@Init)

GameRegistry.registerWorldGenerator(new MyReallyCoolAndEpicWorldGenerator());

2. Create himself...

package <you mod package>;

import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenMinable; // Import earth generator
import cpw.mods.fml.common.IWorldGenerator;

public class MyReallyCoolAndEpicWorldGenerator implements IWorldGenerator {

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
switch(world.provider.dimensionId) { // Checking world
case -1:
generateNether(world, random, chunkX*16, chunkZ*16); // Nether
break;
case 0:
generateSurface(world, random, chunkX*16, chunkZ*16); // Earth(normal world)
break;
case 1:
generateEnd(world, random, chunkX*16, chunkZ*16); // End(with dragon)
break;
}
}

public void generateNether(World par1World, Random rand, int par3, int par5) {} // Nether 

public void generateSurface() { // Earth
    for(int i = 0; i < 7; i++) // "7" max ore per chunk
    {
        int randPosX = par3 + rand.nextInt(16);
        int randPosY = rand.nextInt(128); // Ore generation up to 128 layer(y coordinate)
        int randPosZ = par5 + rand.nextInt(16);
        (new WorldGenMinable(<you block>.blockID, 10)).generate(par1World, rand, randPosX, randPosY, randPosZ); // "10" is max ore per correct place
    }
   // Finally we have 70(7*10) ore per chunk
}

public void generateEnd() {} // End generation
}

P.S. Sorry for bad english

 

Thanks!

Posted

Show me the relevant code and I'm sure we will be able to sort out the GUI stuff :)

Relevent code files(use paste.mincraftforge.net):

BlockFile

MainModFile

ClientProxy

 

Umm... What's a client proxy :)

Posted

You need common proxy and Client proxy in order to seperate server and client side logic, all GUI's are client side only :)

Reffer to this for how to setup the basics of your mod like the common and client proxy: http://www.minecraftforge.net/wiki/Basic_Modding

 

And then take a look at this for GUI's, this one is for container GUI, like chests and such but can easly be changed :)

http://www.minecraftforge.net/wiki/Containers_and_GUIs

If you guys dont get it.. then well ya.. try harder...

Posted

inn your mod file where @mod is located, you should have an @instance annotation above a variable named instance, thats the one you want to pass into the method.

If you guys dont get it.. then well ya.. try harder...

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.