Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void init(FMLInitializationEvent event){
- ......
- if(ConfigDivergentUnderground.enableFossils){
- GameRegistry.registerWorldGenerator(new FossilGenerator(), 0);
- }
- ......
- }
- /\/\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- public class FossilGenerator implements IWorldGenerator{
- @Override
- public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
- if (world.provider.getDimension() == 0) {
- generateOverworld(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
- }
- }
- private void generateOverworld(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
- generateOre(ModBlocks.FOSSIL.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 0, 48, 1 + random.nextInt(2), ConfigDivergentUnderground.fossilTries);
- }
- private void generateOre(IBlockState ore, World world, Random random, int x, int z, int minY, int maxY, int size, int chances) {
- int deltaY = maxY - minY;
- for (int i = 0; i < chances; i++) {
- BlockPos pos = new BlockPos(x + random.nextInt(16), minY + random.nextInt(deltaY), z + random.nextInt(16));
- WorldGenMinable generator = new WorldGenMinable(ore, size);
- generator.generate(world, random, pos);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement