Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Commit

Permalink
NotSoFlat-1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroliu committed Jun 17, 2015
1 parent db4d7f7 commit a718912
Show file tree
Hide file tree
Showing 9 changed files with 1,021 additions and 0 deletions.
Binary file added Media/Notsoflat-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
157 changes: 157 additions & 0 deletions NotSoFlat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
NotSoFlat
=======

* Summary: An alternative world generator
* Dependency Plugins: n/a
* PocketMine-MP version: 1.4 - API 1.6.0, 1.5 - API 1.12.0
* DependencyPlugins: -
* OptionalPlugins: -
* Categories: World Generators
* Plugin Access:
* WebSite: [github](https://github.com/alejandroliu/bad-plugins/tree/master/NotSoFlat/)

Overview
--------

This is a simple [PocketMine-MP][3] Terrain Generator. It is based on the
Superflat Generator, but mixes in the [Simplex Noise][1] algorithm
to generate decent looking terrain.


Documentation
-------------

### Usage

Copy to your plugins directory to install. Use `ManyWorlds` to
generate new worlds.

If using `ManyWorlds` use the command:

/mw create testworld 4994 notsoflat

`4994` is the seed, and you can change it to any number you want.
`testworld` is the new world being created, replace as appropriate.

### Configuration

You can configure the generator using the presets string.
The presets strings can be configured in your `server.properties`
file under the key `generator-settings`.

You can either use a predefined config or use a preset string similar
to the one used by [Superflat][2]

The following are the available pre-defined config preset strints:

- overworld
- plains
- ocean
- hills
- mountains
- flatland
- hell
- desert
- mesa
- desert hills

It is possible to control de terrain generation with greater
detail using a preset configuration string:

nsfv1 ; blocks ; biome ; options

Where:

- nsfv1 : it is a preset version string. It is ignored.
- blocks : it is an extended block preset configuration. You can
especify one or more strata structures by using a "`:`" as
separator. You can also use a predefined string. Predefined
block strings:
- temperate : mostly grassy tile set
- arid : a harsh, mostly desert tile set
- hell : nettherrack all around
- biome : this is ignored
- options : additional settings to tweak the terrain generator.

Because some of the code is based on PocketMine-MP Superflat
generator, it recognizes the following options:

- decoration : Will decorate the terrain with the specified objects:
- grasscount : tall grass or flowers
- treecount : trees

The terrain generation itself can be configured using the `dsq` option.
_(This is an extension to the Superflat generator)_

### dsq

- waterblock : What block to use instead of water. Could be used
configure a lava (Block 11) sea or an ice sea.
- strata : A list of `:` (colon) separated numbers used to select
the different strata structures.
- hell : If set, it will create a roof of Netherrack and Bedrock at
the top of the world.

### References

- [Simplex Noise][1]
- [Minecraft Superflat generator][2]
- [PocketMine-MP][3]

[1]: http://en.wikipedia.org/wiki/Simplex_noise "Wikipedia"
[2]: http://minecraft.gamepedia.com/Superflat "Superflat Generator"
[3]: http://www.pocketmine.net/ "PocketMine-MP"

Changes
-------

* 1.1.0 : Fixes for PM1.5
* 1.0.0 : Updated to PM1.4 API
* Changed from DiamodSquares to Simplex Noise
* Removed:
- decoration:
- spawn : This will create a circle around the spawn using the
specified block. The following sub-options are used:
- radius : size of the spawn circle
- block : block type.
- dsq:
- min : minimum height of terrain
- max : maximum height of terrain
- water : water level
- off : how quickly terrain will vary
- dotsz : averages the terrain so it is not as rough.
- fn : Applies a function to the height map. Available functions:
- exp : Exponential.
- linear : This doesn't do anything
- fndat : Values to pass to the `fn` function.
* 0.3 : New features
- multiple ground configs depending of height
- cactus and weeds generation on sand
- fn and dotsz settings to tweak the look of the environment
- richer set of presets
* 0.2 : Updates
- Updated API level
- Misc typos/bug-fixes
- Fixed tree generation
- tweaked defaults a bit
* 0.1 : Initial release

Copyright
---------

NotSoFlat
Copyright (C) 2015 Alejandro Liu
All Rights Reserved.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
48 changes: 48 additions & 0 deletions NotSoFlat/notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Simplex(Random,octaves,frequency,amplitude)
Simplex:
(OCTAVES #:int) (FREQUENCY #:float) (AMPLITUDE #:float -- Int?)

OCTAVES is the number of octaves of noise to sample,
The number of octaves control the amount of detail of Perlin
noise. Adding more octaves increases the detail of Perlin noise, with
the added drawback of increasing the calculation time.

FREQUENCY is the frequency of the first octave, The number of cycles
per unit length that a specific coherent-noise function outputs.


AMPLITUDE is the amplitude of the first octave. Max abs value that
can be output. (-n to +n? or just 0 to n)


* More complex terrain: Based on normal
- Height - (Normal has *base*)
- Incline - Multiplier to height (to generate more ruggged terrain)

- Altitude (computed)
- Precipitation -
- Temperature - (softer)
- Diversity - Changes the selection of stuff

High Temp

Alt \ Precp High Medium Low
High Mesa Mesa DesHill
Medium Jungle Savan Desert
Low Swamp Savan Desert


Medium Temp

Alt \ Precp High Medium Low
High SnowHll Hills Mesa
Medium Forest Plains Savanna
Low Jungle Swamps Beach

Low Temp

Alt \ Precp High Medium Low
High SnowHil ColdHill Taiga
Medium SnowPla SnowPlain Taiga
Low IcePlai ColdBeach IcePla

6 changes: 6 additions & 0 deletions NotSoFlat/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: NotSoFlat
main: aliuly\notsoflat\Main
load: STARTUP
api: [1.6.0,1.12.0]
version: 1.1.0
author: aliuly
61 changes: 61 additions & 0 deletions NotSoFlat/src/aliuly/notsoflat/DesertPlant.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace aliuly\notsoflat;

use pocketmine\block\Block;
use pocketmine\level\ChunkManager;
use pocketmine\utils\Random;
use pocketmine\level\generator\populator\Populator;

class DesertPlant extends Populator{
/** @var ChunkManager */
private $level;
private $randomAmount;
private $baseAmount;

public function setRandomAmount($amount){
$this->randomAmount = $amount;
}

public function setBaseAmount($amount){
$this->baseAmount = $amount;
}

public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){
$this->level = $level;
$amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount;
for($i = 0; $i < $amount; ++$i){
$x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);
$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);
for($size = 30; $size > 0; --$size){
$xx = $x - 7 + $random->nextRange(0, 15);
$zz = $z - 7 + $random->nextRange(0, 15);
$yy = $this->getHighestWorkableBlock($xx, $zz);

if($yy !== -1 and $this->canTallGrassStay($xx, $yy, $zz)){
$this->level->setBlockIdAt($xx, $yy, $zz, Block::CACTUS);
$this->level->setBlockDataAt($xx, $yy, $zz, 1);
}
}
}
}

private function canTallGrassStay($x, $y, $z){
return $this->level->getBlockIdAt($x, $y, $z) === Block::AIR and $this->level->getBlockIdAt($x, $y - 1, $z) === Block::SAND;
}

private function getHighestWorkableBlock($x, $z){
for($y = 128; $y > 0; --$y){
$b = $this->level->getBlockIdAt($x, $y, $z);
if($b === Block::AIR or $b === Block::LEAVES){
if(--$y <= 0){
return -1;
}
}else{
break;
}
}

return ++$y;
}
}
18 changes: 18 additions & 0 deletions NotSoFlat/src/aliuly/notsoflat/Main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
namespace aliuly\notsoflat;

use pocketmine\plugin\PluginBase;
use pocketmine\level\generator\Generator;
use pocketmine\utils\TextFormat;

class Main extends PluginBase{
public function onEnable(){
$api = $this->getServer()->getApiVersion();
if (version_compare($api,"1.12.0") >= 0) {
$this->getLogger()->info(TextFormat::RED."WARNING: PMv1.5 support is experimental!");
Generator::addGenerator(NotSoFlat::class, "notsoflat");
} else {
Generator::addGenerator(NotSoFlatOld::class, "notsoflat");
}
}
}
Loading

0 comments on commit a718912

Please sign in to comment.