Jump to content

Recommended Posts

Posted

Hey Forge Community,

My Problem is, that the second Parameter of the registerWorldGenerator method is "modGenerationWeight", so my problem is, I implemented more than 1 ore, but only one spawning, when I test the Mod.

I know (through testing) that its affected by the "modGenerationWeight", but in every Test, only 1 is spawning.

So how can I get every ore spawning?

sry for my bad english :(

Posted

Hey Forge Community,

My Problem is, that the second Parameter of the registerWorldGenerator method is "modGenerationWeight", so my problem is, I implemented more than 1 ore, but only one spawning, when I test the Mod.

I know (through testing) that its affected by the "modGenerationWeight", but in every Test, only 1 is spawning.

So how can I get every ore spawning?

sry for my bad english :(

Posted

Here is a part of the FMLInitializationEvent:

(sry: erz=ore in english)

 

GameRegistry.registerWorldGenerator(new BlockGenerator(eiserz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(endererz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(erdeerz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(feuererz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(lufterz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(magieerz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(naturerz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(nethererz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(untergrunderz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(wassererz.getDefaultState(), 15, 500), 6);

Posted

Here is a part of the FMLInitializationEvent:

(sry: erz=ore in english)

 

GameRegistry.registerWorldGenerator(new BlockGenerator(eiserz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(endererz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(erdeerz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(feuererz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(lufterz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(magieerz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(naturerz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(nethererz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(untergrunderz.getDefaultState(), 15, 500), 6);

GameRegistry.registerWorldGenerator(new BlockGenerator(wassererz.getDefaultState(), 15, 500), 6);

Posted

package generation;

 

import java.util.Random;

 

import net.minecraft.block.state.IBlockState;

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.minecraftforge.fml.common.IWorldGenerator;

 

public class BlockGenerator extends WorldGenMinable implements IWorldGenerator{

private int frequency;

 

public BlockGenerator(IBlockState state, int blockCount, int frequency) {

super(state, blockCount);

this.frequency = frequency;

}

 

@Override

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

IChunkProvider chunkProvider) {

for(int i = 0; i < frequency; i++) {

int offsetX = random.nextInt(16);

int offsetZ = random.nextInt(16);

 

int posX = chunkX * 16 + offsetX;

int posZ = chunkZ * 16 + offsetZ;

int posY = random.nextInt(50);

generate(world, random, new BlockPos(posX, posY, posZ));

}

}

}

 

Posted

package generation;

 

import java.util.Random;

 

import net.minecraft.block.state.IBlockState;

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.minecraftforge.fml.common.IWorldGenerator;

 

public class BlockGenerator extends WorldGenMinable implements IWorldGenerator{

private int frequency;

 

public BlockGenerator(IBlockState state, int blockCount, int frequency) {

super(state, blockCount);

this.frequency = frequency;

}

 

@Override

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

IChunkProvider chunkProvider) {

for(int i = 0; i < frequency; i++) {

int offsetX = random.nextInt(16);

int offsetZ = random.nextInt(16);

 

int posX = chunkX * 16 + offsetX;

int posZ = chunkZ * 16 + offsetZ;

int posY = random.nextInt(50);

generate(world, random, new BlockPos(posX, posY, posZ));

}

}

}

 

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.