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

I Can't get my ore to generate in the nether i Have the same coding as my ruby ore generation but i cant seem to get the ore to generate in the nether:

 

package com.moreoresmod.main.worldgeneration;

 

import java.util.Random;

 

import com.moreoresmod.main.init.MoreOresModBlocks;

 

import net.minecraft.block.Block;

import net.minecraft.init.Blocks;

import net.minecraft.util.BlockPos;

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

import net.minecraft.world.gen.feature.WorldGenMinable;

import net.minecraftforge.fml.common.IWorldGenerator;

 

public class NetherDiamondGeneration implements IWorldGenerator {

@Override

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

switch(world.provider.getDimensionId()){

case 1:

generateEnd(world, random, chunkX, chunkZ);

break;

case 0:

generateOverworld(world, random, chunkX, chunkZ);

break;

case -1:

generateNether(world, random, chunkX, chunkZ);

break;

}

}

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

 

}

 

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

 

}

 

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

generateOre(MoreOresModBlocks.nether_diamond, world, random, x, z, 2, 8, 50, 2, 256, Blocks.netherrack);

}

 

public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance , int minY, int maxY, Block generateIn){

int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);

int hightRange = maxY - minY;

WorldGenMinable gen = new WorldGenMinable(block.getDefaultState(), vienSize);

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

int xRand = chunkX * 16 + random.nextInt(16);

int yRand = random.nextInt(hightRange) + minY;

int zRand = chunkZ * 16 + random.nextInt(16);

gen.generate(world, random,new BlockPos(xRand, yRand, zRand));

}

}

}

 

  • Author

Will It Work Now?

 

package com.moreoresmod.main.worldgeneration;

 

import java.util.Random;

 

import akka.japi.Predicate;

 

import com.moreoresmod.main.init.MoreOresModBlocks;

 

import net.minecraft.block.Block;

import net.minecraft.block.state.pattern.BlockHelper;

import net.minecraft.init.Blocks;

import net.minecraft.util.BlockPos;

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

import net.minecraft.world.gen.feature.WorldGenMinable;

import net.minecraftforge.fml.common.IWorldGenerator;

 

public class NetherDiamondGeneration implements IWorldGenerator {

@Override

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

BlockHelper.forBlock(Blocks.netherrack);

switch(world.provider.getDimensionId()){

case 1:

generateEnd(world, random, chunkX, chunkZ);

break;

case 0:

generateOverworld(world, random, chunkX, chunkZ);

break;

case -1:

generateNether(world, random, chunkX, chunkZ);

break;

}

}

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

 

}

 

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

 

}

 

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

generateOre(MoreOresModBlocks.nether_diamond, world, random, x, z, 2, 8, 50, 2, 256, Blocks.netherrack);

}

 

public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance , int minY, int maxY, Block generateIn){

int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);

int hightRange = maxY - minY;

WorldGenMinable gen = new WorldGenMinable(block.getDefaultState(), vienSize);

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

int xRand = chunkX * 16 + random.nextInt(16);

int yRand = random.nextInt(hightRange) + minY;

int zRand = chunkZ * 16 + random.nextInt(16);

gen.generate(world, random,new BlockPos(xRand, yRand, zRand));

}

}

}

  • Author

it works now but you could have said in the constructor WorldGenMinable you put BlockHelper.forBlock(Blocks.netherrack);

  • 3 years later...
42 minutes ago, EOT3000 said:

What would I use instead of BlockHelper.forBlock in forge 1.12.2?

Please do not necro a thread. Make your own thread.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Guest locked this topic
Guest
This topic is now closed to further replies.

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.