Jump to content

Ore/World Generation Help {SOLVED}


EscapeMC

Recommended Posts

Hello! I am new to modding with 1.9.4 and 1.10.2, and need some help. I put all my code from my 1.8 version of my mod and fixed all errors I got, along with the axe changes. My world generation code did not bring up any errors, or anything, but I cannot find the ores anywhere!

 

Here is my code for world gen:

 

package com.escapemc.teammadnessmod.world;

import java.util.Random;

import com.escapemc.teammadnessmod.init.TeamMadnessModBlocks;

import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;

public class world_gen implements IWorldGenerator {
    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {   
    switch (world.provider.getDimension()) {
    case 0: //Overworld
        this.runGenerator(this.gen_escapemc_ore, world, random, chunkX, chunkZ, 8, 0, 64);
        this.runGenerator(this.gen_mushrromstew_ore, world, random, chunkX, chunkZ, 8, 0, 64);
        this.runGenerator(this.gen_epicbudder22_ore, world, random, chunkX, chunkZ, 8, 0, 64);
        this.runGenerator(this.gen_jonahjoe2002_ore, world, random, chunkX, chunkZ, 8, 0, 64);
        this.runGenerator(this.gen_ms, world, random, chunkX, chunkZ, 6, 0, 40);
        this.runGenerator(this.gen_madness_ore, world, random, chunkX, chunkZ, 6, 0, 64);
        
        break;
    case -1: //Nether

        break;
    case 1: //End

        break;
    	}
    }
    private WorldGenerator gen_escapemc_ore;
    private WorldGenerator gen_mushrromstew_ore;
    private WorldGenerator gen_epicbudder22_ore;
    private WorldGenerator gen_jonahjoe2002_ore;
    private WorldGenerator gen_ms;
    private WorldGenerator gen_madness_ore;


    public world_gen() {
        this.gen_escapemc_ore = new WorldGenMinable(TeamMadnessModBlocks.escapemc_ore.getDefaultState(), ;
        this.gen_mushrromstew_ore = new WorldGenMinable(TeamMadnessModBlocks.mushrromstew_ore.getDefaultState(), ;
        this.gen_epicbudder22_ore = new WorldGenMinable(TeamMadnessModBlocks.epicbudder22_ore.getDefaultState(), ;
        this.gen_jonahjoe2002_ore = new WorldGenMinable(TeamMadnessModBlocks.jonahjoe2002_ore.getDefaultState(), ;
        this.gen_ms = new WorldGenMinable(TeamMadnessModBlocks.ms.getDefaultState(), 4);
        this.gen_madness_ore = new WorldGenMinable(TeamMadnessModBlocks.madness_ore.getDefaultState(), 4);

    }

    private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
        if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
            throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");

        int heightDiff = maxHeight - minHeight + 1;
        for (int i = 0; i < chancesToSpawn; i ++) {
            int x = chunk_X * 16 + rand.nextInt(16);
            int y = minHeight + rand.nextInt(heightDiff);
            int z = chunk_Z * 16 + rand.nextInt(16);
            generator.generate(world, rand, new BlockPos(x, y, z));
        }
    }

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {

}
}

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

1. You should really name your classes using PascalCase as is Java convention.

2. Show how you're registering your world generator.

 

1. What is PascalCase ecaxtly? like ItemExampleItem?

 

2.

	    GameRegistry.registerWorldGenerator(new world_gen(), 0);

 

 

EDIT: I registered it in the FMLInitializationEvent, if that means anything

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

Where do you call the registering of the world generator?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Where do you call the registering of the world generator?

 

In the FMLInitializationEvent in my main class

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

You have 2

generate

methods in your class. You implemented everything in the wrong one, you should be using the one with @Override above the method.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

You have 2

generate

methods in your class. You implemented everything in the wrong one, you should be using the one with @Override above the method.

 

So what should I exactly do to fix this problem of mine?

 

Make it

import java.util.Random;

import com.escapemc.teammadnessmod.init.TeamMadnessModBlocks;

import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;

public class world_gen implements IWorldGenerator {
   @Override
   public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {   
    switch (world.provider.getDimension()) {

 

Or where do I add @Override?

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

   switch (world.provider.getDimension()) {
    case 0: //Overworld

 

In 1.10, the getDimension() method no longer returns -1, 0 1. It now returns an enum. I don't even use it. My example:

 

   if (w.provider instanceof WorldProviderHell) {    ...                        

 

You should identify the world provider classes or else switch the enum values.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

You have 2

generate

methods in your class. You implemented everything in the wrong one, you should be using the one with @Override above the method.

 

So what should I exactly do to fix this problem of mine?

 

Make it

import java.util.Random;

import com.escapemc.teammadnessmod.init.TeamMadnessModBlocks;

import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;

public class world_gen implements IWorldGenerator {
   @Override
   public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {   
    switch (world.provider.getDimension()) {

 

Or where do I add @Override?

The fifth parameter isn't of type
IChunkProvider

, but it should be

IChunkGenerator

.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

   switch (world.provider.getDimension()) {
    case 0: //Overworld

 

In 1.10, the getDimension() method no longer returns -1, 0 1. It now returns an enum. I don't even use it. My example:

 

   if (w.provider instanceof WorldProviderHell) {    ...                        

 

You should identify the world provider classes or else switch the enum values.

   switch (world.provider.getDimension()) {
    case 0: //Overworld

 

In 1.10, the getDimension() method no longer returns -1, 0 1. It now returns an enum. I don't even use it. My example:

 

   if (w.provider instanceof WorldProviderHell) {    ...                        

 

You should identify the world provider classes or else switch the enum values.

 

Thank you so so so so so much! The both of you, I now have the problem solved. I owe you all my thanks!

 

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

Link to comment
Share on other sites

Here is a much more simple and customizeable version of what you got  which uses af unction to input the vein size, min and max ore blocks size and depth etc. https://github.com/trollworkout/technorcery/blob/master/src/main/java/com/technorcery/common/WorldGen.java

 

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

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.