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 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 :(

  • Author

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 :(

  • Author

I mean with "only 1 ore is spawning", I have implemented 10 new Ores (PlatinumOre, SilverOre,....),

but only 1 (for example: PlatinumOre) is Spawning

 

  • Author

I mean with "only 1 ore is spawning", I have implemented 10 new Ores (PlatinumOre, SilverOre,....),

but only 1 (for example: PlatinumOre) is Spawning

 

  • Author

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);

  • Author

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);

  • Author

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));

}

}

}

 

  • Author

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

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.