Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.penumbral.steelworks.world;
- import java.util.Random;
- import net.minecraft.block.Block;
- import net.minecraft.block.BlockStone;
- import net.minecraft.block.state.IBlockState;
- 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;
- import com.penumbral.steelworks.init.SteelworksBlocks;
- public class OreGeneration 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 * 16, chunkZ * 16); break;
- case 0:
- generateOverworld(world, random, chunkX * 16, chunkZ * 16); break;
- case -1:
- generateNether(world, random, chunkX * 16, chunkZ * 16); break;
- }
- }
- private void generateEnd(World world, Random random, int x, int z) {
- }
- public void generateOverworld(World world, Random random, int x, int z) {
- generateOre(SteelworksBlocks.fire_clayblock, world, random, x, z, 4, 8, 100, 10, 64);
- }
- private void generateNether(World world, Random random, int x, int z) {
- }
- public void generateOre(Block block, World world, Random random, int posX, int posZ, int minVein, int maxVein, int spawnChance, int minY, int maxY)
- {
- WorldGenMinable gen = new WorldGenMinable(block.getDefaultState(), (minVein + random.nextInt(maxVein - minVein)), BlockHelper.forBlock(Blocks.stone));
- for (int i = 0; i < spawnChance; i++) {
- int xPos = posX + random.nextInt(16);
- int yPos = minY + random.nextInt(maxY - minY);
- int zPos = posZ + random.nextInt(16);
- gen.generate(world, random, new BlockPos(xPos, yPos, zPos));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement