@Override public void decorate(World world, Random random, Chunk source) { if (random.nextInt(type == Material.STATIONARY_WATER ? 4 : 8) == 0) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = random .nextInt(type == Material.STATIONARY_WATER ? 256 : random.nextInt(248) + 8); if (type == Material.STATIONARY_LAVA && (sourceY >= world.getSeaLevel() || random.nextInt(10) > 0)) { return; } while (world.getBlockAt(sourceX, sourceY, sourceZ).isEmpty() && sourceY > 5) { sourceY--; } if (sourceY >= 5) { new Lake(type).generate(world, random, sourceX, sourceY, sourceZ); } } } }
@Override public void populate(World world, Random random, Chunk source) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = random.nextInt(world.getSeaLevel() << 1); for (int i = 0; i < 64; i++) { int x = sourceX + random.nextInt(8) - random.nextInt(8); int z = sourceZ + random.nextInt(8) - random.nextInt(8); int y = sourceY + random.nextInt(4) - random.nextInt(4); if (world.getBlockAt(x, y, z).getType() == Material.AIR && world.getBlockAt(x, y - 1, z).getType() == Material.GRASS) { BlockState state = world.getBlockAt(x, y, z).getState(); state.setType(Material.MELON_BLOCK); state.setData(new MaterialData(Material.MELON_BLOCK)); state.update(true); } } } }
/** * Creates a random temple or witch hut. * * @param world the world to generate in * @param random the PRNG that will choose this temple's orientation * @param chunkX the chunk X coordinate * @param chunkZ the chunk Z coordinate */ public GlowTemple(World world, Random random, int chunkX, int chunkZ) { this(world, chunkX, chunkZ); int x = chunkX << 4; int z = chunkZ << 4; Biome biome = world.getBiome(x + 8, z + 8); if (types.containsKey(biome)) { switch (types.get(biome)) { case JUNGLE_TEMPLE: addPiece(new GlowJungleTemple(random, new Location(world, x, world.getSeaLevel(), z))); break; case WITCH_HUT: addPiece( new GlowWitchHut(random, new Location(world, x, world.getSeaLevel(), z))); break; default: addPiece(new GlowDesertTemple(random, new Location(world, x, world.getSeaLevel(), z))); } wrapAllPieces(); } }
Biome biome, double surfaceNoise) { int seaLevel = world.getSeaLevel();
int seaLevel = world.getSeaLevel();
protected void adjustHorizPos(World world) { if (horizPos >= 0) { return; } int sumY = 0; int blockCount = 0; for (int x = boundingBox.getMin().getBlockX(); x <= boundingBox.getMax().getBlockX(); x++) { for (int z = boundingBox.getMin().getBlockZ(); z <= boundingBox.getMax().getBlockZ(); z++) { int y = world.getHighestBlockYAt(x, z); Material type = world.getBlockAt(x, y - 1, z).getType(); while ((type == Material.LEAVES || type == Material.LEAVES_2 || type == Material.LOG || type == Material.LOG_2) && y > 1) { y--; type = world.getBlockAt(x, y - 1, z).getType(); } sumY += Math.max(world.getSeaLevel(), y + 1); blockCount++; } } horizPos = sumY / blockCount; boundingBox.offset(new Vector(0, horizPos - boundingBox.getMin().getBlockY(), 0)); }
private ChunkData generateRawTerrain(World world, int chunkX, int chunkZ) { generateTerrainDensity(world, chunkX, chunkZ); int seaLevel = world.getSeaLevel();
public BukkitWorld(World w) { this(w.getName(), w.getMaxHeight(), w.getSeaLevel(), w.getEnvironment()); setWorldLoaded(w); new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP); } public BukkitWorld(String name, int height, int sealevel, World.Environment env) {
public int getSeaLevel(World world) { Integer overrideValue = this.config_seaLevelOverride.get(world.getName()); if(overrideValue == null || overrideValue == -1) { return world.getSeaLevel(); } else { return overrideValue; } }
@Override public int getSeaLevel() { return getHandle().getSeaLevel(); }
/** * Only allow sea-level blocks to flow if they are below the custom sea-level * - Track any new blocks originating from sea-level blocks */ @EventHandler public void onBlockFromToEvent(BlockFromToEvent event) { if (event.getBlock().hasMetadata(SEALEVEL_BLOCK)) { boolean isWaterFixed = isOverride; if (!isWaterFixed) { final World world = event.getBlock().getWorld(); final WorldClimateEngine climateEngine = ClimateEngine.getInstance().getClimateEngine(world.getUID()); final int baseSeaLevel = world.getSeaLevel() - 1; final int deltaSeaLevel = (int) seaMap.getValue(climateEngine.getTemperature()); final int customSeaLevel = baseSeaLevel + deltaSeaLevel; isWaterFixed = event.getBlock().getY() > customSeaLevel; } if (isWaterFixed) { event.setCancelled(true); } else { event.getToBlock().setMetadata(SEALEVEL_BLOCK, BLOCK_TAG); } } }
public ShapeProvider_Astral(CityWorldGenerator generator, Odds odds) { super(generator, odds); World world = generator.getWorld(); long seed = generator.getWorldSeed(); landShape1 = new SimplexOctaveGenerator(seed, 4); landShape1.setScale(landHorizontalScale1); landShape2 = new SimplexOctaveGenerator(seed, 6); landShape2.setScale(landHorizontalScale2); seaShape = new SimplexOctaveGenerator(seed + 2, 8); seaShape.setScale(seaHorizontalScale); noiseShape = new SimplexOctaveGenerator(seed + 3, 16); noiseShape.setScale(noiseHorizontalScale); featureShape = new SimplexOctaveGenerator(seed + 4, 2); featureShape.setScale(featureHorizontalScale); // caveShape = new SimplexNoiseGenerator(seed); ecoShape = new SimplexNoiseGenerator(seed + 5); // get ranges height = world.getMaxHeight(); seaLevel = world.getSeaLevel(); landRange = height - seaLevel - fudgeVerticalScale + landFlattening; seaRange = seaLevel - fudgeVerticalScale + seaFlattening; constructMin = seaLevel; constructRange = height - constructMin; }
public ShapeProvider_Normal(CityWorldGenerator generator, Odds odds) { super(generator, odds); World world = generator.getWorld(); long seed = generator.getWorldSeed(); landShape1 = new SimplexOctaveGenerator(seed, 4); landShape1.setScale(landHorizontalScale1); landShape2 = new SimplexOctaveGenerator(seed, 6); landShape2.setScale(landHorizontalScale2); seaShape = new SimplexOctaveGenerator(seed + 2, 8); seaShape.setScale(seaHorizontalScale); noiseShape = new SimplexOctaveGenerator(seed + 3, 16); noiseShape.setScale(noiseHorizontalScale); featureShape = new SimplexOctaveGenerator(seed + 4, 2); featureShape.setScale(featureHorizontalScale); caveShape = new SimplexNoiseGenerator(seed); mineShape = new SimplexNoiseGenerator(seed + 1); // get ranges height = world.getMaxHeight(); seaLevel = world.getSeaLevel(); landRange = height - seaLevel - fudgeVerticalScale + landFlattening; seaRange = seaLevel - fudgeVerticalScale + seaFlattening; constructMin = seaLevel; constructRange = height - constructMin; }
config.append("Difficulty", world.getDifficulty()); config.append("Max Height", world.getMaxHeight()); config.append("Sea Level", world.getSeaLevel()); report.append(config.getTitle(), config);
final int baseSeaLevel = world.getSeaLevel() - 1; final int deltaSeaLevel = (int) seaMap.getValue(climateEngine.getTemperature()); final int customSeaLevel = baseSeaLevel + deltaSeaLevel;