Skip to content

Instantly share code, notes, and snippets.

Created August 16, 2015 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/ec147ae3650d84d95800 to your computer and use it in GitHub Desktop.
Save anonymous/ec147ae3650d84d95800 to your computer and use it in GitHub Desktop.
package com.drunksmanknife.harshnature.init;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTallGrass;
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.minecraft.world.gen.feature.WorldGenTallGrass;
import net.minecraftforge.fml.common.IWorldGenerator;
public class HarshNatureRegen implements IWorldGenerator {
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
switch(world.provider.getDimensionId()){
case -1:
GenerateNeather(world, chunkX * 16, chunkZ *16, random);
break;
case 0:
GenerateOverworld(world, chunkX * 16, chunkZ *16, random);
break;
case 1:
GenerateEnd(world, chunkX * 16, chunkZ *16, random);
break;
}
}
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 Xpos = posX + random.nextInt(defaultChunkSize);
int Ypos = minY + random.nextInt(maxY - minY);
int Zpos = posZ + random.nextInt(defaultChunkSize);
IBlockState state = block.getDefaultState();
BlockPos blockPos = new BlockPos(Xpos, Ypos, Zpos);
BlockPos topBlock = world.getTopSolidOrLiquidBlock(new BlockPos(Xpos, Ypos, Zpos));
new WorldGenTallGrass(DontKnowWhatToPassHere).generate(world, random, blockPos);
}
}
private void GenerateEnd(World world, int i, int j, Random random) {
}
private void GenerateOverworld(World world, int i, int j, Random random) {
addOre(HarshNatureBlocks.BerryBush,Blocks.stone, random, world, i, j, 15, 100, 4, 8, 40);
}
private void GenerateNeather(World world, int i, int j, Random random) {
// TODO Auto-generated method stub
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment