Advertisement
MrCyberdragon

Untitled

Mar 6th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. public class WorldGenCustomOres implements IWorldGenerator {
  2. @Override
  3. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
  4. if(world.provider.getDimension()== 0) {
  5. generateOre(ModBlocks.ORE_OVERWORLD_MEGONIUM.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 0, 30, random.nextInt(4) + 1, 5);
  6. } else if(world.provider.getDimension()== -1) {
  7. generateOre(ModBlocks.ORE_NETHER_MEGONIUM.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 0, 200, random.nextInt(4) + 1, 5, BlockMatcher.forBlock(Blocks.NETHERRACK));
  8. } else if(world.provider.getDimension()== 1) {
  9. generateOre(ModBlocks.ORE_END_MEGONIUM.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 0, 200, random.nextInt(4) + 1, 5, BlockMatcher.forBlock(Blocks.END_STONE));
  10. }
  11. }
  12.  
  13. private void generateOre(IBlockState ore, World world, Random random,int x, int z, int minY, int maxY, int size, int chances, Predicate<IBlockState> BlockToReplace){
  14. int deltaY = maxY - minY;
  15. for(int i = 0; i < chances; i++) {
  16. BlockPos pos = new BlockPos(x + random.nextInt(16), minY + random.nextInt(deltaY), z + random.nextInt(16));
  17.  
  18. WorldGenMinable generator = new WorldGenMinable(ore, size, BlockToReplace);
  19. generator.generate(world, random, pos);
  20.  
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement