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.

jedijoe

Members
  • Joined

  • Last visited

  1. I'm pretty sure this is closer to what you meant. I know I still managed to mess it up. public class Worldgen implements IWorldGenerator { private WorldGenerator ATOMICORE; public Worldgen() { } @Override public void generate(Random random, int blockXPos, int blockZPos, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.getDimension()) { case 0: addOreSpawn(ModBlocks.AtomicO.getDefaultState(), world, random, blockXPos, blockZPos, 16, 16, 50, 30, 10, 100, BlockMatcher.forBlock(Blocks.STONE)); break; default: break; } } private void genSurface(World world, Random random, int chunkX, int chunkZ){ addOreSpawn(ModBlocks.AtomicO.getDefaultState(), world, random, chunkX, chunkZ, 16, 16, 50, 20, 10, 100, BlockMatcher.forBlock(Blocks.STONE)); } private void addOreSpawn(IBlockState defaultState, World world, Random random, int chunkX, int chunkZ, int maxX, int maxZ, int maxVeinSize, int chance, int minY, int maxY, Predicate<IBlockState> Stone) { int defaultchunksize = 16; int diffMinMaxY = maxY - minY; for (int x = 0; x < chance; x++) { int blockXpos = chunkX << 4; int blockZpos = chunkZ << 4; int posX = blockXpos + random.nextInt(maxX); int posY = minY + random.nextInt(diffMinMaxY); int posZ = blockZpos + random.nextInt(maxZ); (new WorldGenMinable(defaultState, maxVeinSize, Stone)).generate(world, random, new BlockPos(posX, posY, posZ)); } } }
  2. I adjusted it to swap out the chunk variables for the block variables, and matched the syntax, however these changes did not fix the issue where no ore is generating package jedijoe.mods.init; import java.util.Random; import com.google.common.base.Predicate; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.DimensionType; 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 Worldgen implements IWorldGenerator { private WorldGenerator ATOMICORE; public Worldgen() { } @Override public void generate(Random random, int blockXpos, int blockZpos, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.getDimension()) { case 0: addOreSpawn(ModBlocks.AtomicO.getDefaultState(), world, random, blockXpos, blockZpos, 16, 16, 50, 30, 10, 100, BlockMatcher.forBlock(Blocks.STONE)); break; default: break; } } private void genSurface(World world, Random random, int blockXpos, int blockZpos){ addOreSpawn(ModBlocks.AtomicO.getDefaultState(), world, random, blockXpos, blockZpos, 16, 16, 50, 20, 10, 100, BlockMatcher.forBlock(Blocks.STONE)); } private void addOreSpawn(IBlockState defaultState, World world, Random random, int blockXpos, int blockZpos, int maxX, int maxZ, int maxVeinSize, int chance, int minY, int maxY, Predicate<IBlockState> Stone) { int diffMinMaxY = maxY - minY; for (int x = 0; x < chance; x++) { int posX = blockXpos + random.nextInt(maxX); int posY = minY + random.nextInt(diffMinMaxY); int posZ = blockZpos + random.nextInt(maxZ); (new WorldGenMinable(defaultState, maxVeinSize, Stone)).generate(world, random, new BlockPos(posX, posY, posZ)); } } }
  3. Alright, I got it to stop spitting errors at me, but now I just can't get it to generate the ores I am telling it to, and I am quite sure it's probably some giant mistake I am not seeing here package jedijoe.mods.init; import java.util.Random; import com.google.common.base.Predicate; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.DimensionType; 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 Worldgen implements IWorldGenerator { private WorldGenerator ATOMICORE; public Worldgen() { } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.getDimension()) { case 0: addOreSpawn(ModBlocks.AtomicO.getDefaultState(), world, random, chunkX, chunkZ, 16, 16, 50, 30, 10, 100, BlockMatcher.forBlock(Blocks.STONE)); break; default: break; } } private void genSurface(World world, Random random, int chunkX, int chunkZ){ addOreSpawn(ModBlocks.AtomicO.getDefaultState(), world, random, chunkX, chunkZ, 16, 16, 50, 20, 10, 100, BlockMatcher.forBlock(Blocks.STONE)); } private void addOreSpawn(IBlockState defaultState, World world, Random random, int blockXpos, int blockZpos, int maxX, int maxZ, int maxVeinSize, int chance, int minY, int maxY, Predicate<IBlockState> Stone) { int diffMinMaxY = maxY - minY; for (int x = 0; x < chance; x++) { int posX = blockXpos + random.nextInt(maxX); int posY = minY + random.nextInt(diffMinMaxY); int posZ = blockZpos + random.nextInt(maxZ); (new WorldGenMinable(defaultState, maxVeinSize, Stone)).generate(world, random, new BlockPos(posX, posY, posZ)); } } }
  4. The WorldGenMineable line here is popping a syntax error at generateIn saying that it can not be resolved to a variable, removing it causes bigger errors, following the path of errors and trying to resolve them via the suggested methods by eclipse just causes more errors. I tried removing the line entirely, but of course that just prevents ores from spawning entirely. WorldGenMinable gen = new WorldGenMinable(block, veinSize, generateIn);
  5. So I ported my 1.7 ore generation to a 1.11.2 workspace, but I can't seem to figure out how to properly impliment the WorldGenMineable variable, can someone tell me what I'm doing wrong here? package jedijoe.mods.worldgen; import java.util.Random; import jedijoe.mods.init.ModBlocks; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.DimensionType; 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 Ore implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.getDimensionType()) { case OVERWORLD: generateOverWorld(random, chunkX * 16, chunkZ * 16, world); break; case THE_END: generateEnd(random, chunkX * 16, chunkZ * 16, world); break; case NETHER: generateNether(random, chunkX * 16, chunkZ * 16, world); break; } } private void generateNether(Random random, int i, int j, World world) { // TODO Auto-generated method stub } private void generateEnd(Random random, int chunkX, int chunkZ, World world) { addOre(ModBlocks.EAtomicO, Blocks.END_STONE, random, world, chunkX, chunkZ, 5, 12, 2, 4, 4); } private void generateOverWorld(Random random, int i, int j, World world) { // TODO Auto-generated method stub } private void addOre(Block block, Block blockspawn, Random random, World world, int posX, int posZ, int minY, int maxY, int minVein, int maxVein, int spawnChance) { for(int i = 0; i < spawnChance; i++) { int defaultChunkSize = 16; int veinSize = minVein + random.nextInt(maxVein - minVein); int heightRange = maxY - minY; int xPos= posX + random.nextInt(defaultChunkSize); int yPos = minY + random.nextInt(maxY - minY); int zPos= posZ + random.nextInt(defaultChunkSize); WorldGenMinable gen = new WorldGenMinable(block, veinSize, generateIn); } } }

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.