Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void generateStructures(WorldGenerator generator, World world, Random random, int chunkX, int chunkZ, int chance, Block topBlock, Class<?>... classes)
- {
- HighQualityRandom highQualityRandom = new HighQualityRandom();
- ArrayList<Class<?>> classesList = new ArrayList<Class<?>>(Arrays.asList(classes));
- int x = (chunkX * 16) + highQualityRandom.nextInt(15);
- int z = (chunkZ * 16) + highQualityRandom.nextInt(15);
- float y = 0;
- for (int xSize = 0; xSize < 9; x++)
- {
- for (int zSize = 0; zSize < 7; z++)
- {
- int oldY = Math.round(y);
- y += calculateGenerationHeight(world, x, z, topBlock);
- y /= 2;
- if (Math.round(y) != oldY){ return; }
- }
- }
- int struc_y = (int)y - 1;
- BlockPos pos = new BlockPos(x, struc_y, z);
- Class<?> biome = world.provider.getBiomeForCoords(pos).getClass();
- if (world.getWorldType() != WorldType.FLAT) {
- if (classesList.contains(biome) || classesList.isEmpty()) {
- if (highQualityRandom.nextInt(chance) == 0)
- {
- generator.generate(world, highQualityRandom, pos);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement