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

Commit a718912

Browse files
committed
NotSoFlat-1.1.0
1 parent db4d7f7 commit a718912

File tree

9 files changed

+1021
-0
lines changed

9 files changed

+1021
-0
lines changed

Media/Notsoflat-icon.png

1.1 KB
Loading

NotSoFlat/README.md

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
NotSoFlat
2+
=======
3+
4+
* Summary: An alternative world generator
5+
* Dependency Plugins: n/a
6+
* PocketMine-MP version: 1.4 - API 1.6.0, 1.5 - API 1.12.0
7+
* DependencyPlugins: -
8+
* OptionalPlugins: -
9+
* Categories: World Generators
10+
* Plugin Access:
11+
* WebSite: [github](https://github.com/alejandroliu/bad-plugins/tree/master/NotSoFlat/)
12+
13+
Overview
14+
--------
15+
16+
This is a simple [PocketMine-MP][3] Terrain Generator. It is based on the
17+
Superflat Generator, but mixes in the [Simplex Noise][1] algorithm
18+
to generate decent looking terrain.
19+
20+
21+
Documentation
22+
-------------
23+
24+
### Usage
25+
26+
Copy to your plugins directory to install. Use `ManyWorlds` to
27+
generate new worlds.
28+
29+
If using `ManyWorlds` use the command:
30+
31+
/mw create testworld 4994 notsoflat
32+
33+
`4994` is the seed, and you can change it to any number you want.
34+
`testworld` is the new world being created, replace as appropriate.
35+
36+
### Configuration
37+
38+
You can configure the generator using the presets string.
39+
The presets strings can be configured in your `server.properties`
40+
file under the key `generator-settings`.
41+
42+
You can either use a predefined config or use a preset string similar
43+
to the one used by [Superflat][2]
44+
45+
The following are the available pre-defined config preset strints:
46+
47+
- overworld
48+
- plains
49+
- ocean
50+
- hills
51+
- mountains
52+
- flatland
53+
- hell
54+
- desert
55+
- mesa
56+
- desert hills
57+
58+
It is possible to control de terrain generation with greater
59+
detail using a preset configuration string:
60+
61+
nsfv1 ; blocks ; biome ; options
62+
63+
Where:
64+
65+
- nsfv1 : it is a preset version string. It is ignored.
66+
- blocks : it is an extended block preset configuration. You can
67+
especify one or more strata structures by using a "`:`" as
68+
separator. You can also use a predefined string. Predefined
69+
block strings:
70+
- temperate : mostly grassy tile set
71+
- arid : a harsh, mostly desert tile set
72+
- hell : nettherrack all around
73+
- biome : this is ignored
74+
- options : additional settings to tweak the terrain generator.
75+
76+
Because some of the code is based on PocketMine-MP Superflat
77+
generator, it recognizes the following options:
78+
79+
- decoration : Will decorate the terrain with the specified objects:
80+
- grasscount : tall grass or flowers
81+
- treecount : trees
82+
83+
The terrain generation itself can be configured using the `dsq` option.
84+
_(This is an extension to the Superflat generator)_
85+
86+
### dsq
87+
88+
- waterblock : What block to use instead of water. Could be used
89+
configure a lava (Block 11) sea or an ice sea.
90+
- strata : A list of `:` (colon) separated numbers used to select
91+
the different strata structures.
92+
- hell : If set, it will create a roof of Netherrack and Bedrock at
93+
the top of the world.
94+
95+
### References
96+
97+
- [Simplex Noise][1]
98+
- [Minecraft Superflat generator][2]
99+
- [PocketMine-MP][3]
100+
101+
[1]: http://en.wikipedia.org/wiki/Simplex_noise "Wikipedia"
102+
[2]: http://minecraft.gamepedia.com/Superflat "Superflat Generator"
103+
[3]: http://www.pocketmine.net/ "PocketMine-MP"
104+
105+
Changes
106+
-------
107+
108+
* 1.1.0 : Fixes for PM1.5
109+
* 1.0.0 : Updated to PM1.4 API
110+
* Changed from DiamodSquares to Simplex Noise
111+
* Removed:
112+
- decoration:
113+
- spawn : This will create a circle around the spawn using the
114+
specified block. The following sub-options are used:
115+
- radius : size of the spawn circle
116+
- block : block type.
117+
- dsq:
118+
- min : minimum height of terrain
119+
- max : maximum height of terrain
120+
- water : water level
121+
- off : how quickly terrain will vary
122+
- dotsz : averages the terrain so it is not as rough.
123+
- fn : Applies a function to the height map. Available functions:
124+
- exp : Exponential.
125+
- linear : This doesn't do anything
126+
- fndat : Values to pass to the `fn` function.
127+
* 0.3 : New features
128+
- multiple ground configs depending of height
129+
- cactus and weeds generation on sand
130+
- fn and dotsz settings to tweak the look of the environment
131+
- richer set of presets
132+
* 0.2 : Updates
133+
- Updated API level
134+
- Misc typos/bug-fixes
135+
- Fixed tree generation
136+
- tweaked defaults a bit
137+
* 0.1 : Initial release
138+
139+
Copyright
140+
---------
141+
142+
NotSoFlat
143+
Copyright (C) 2015 Alejandro Liu
144+
All Rights Reserved.
145+
146+
This program is free software: you can redistribute it and/or modify
147+
it under the terms of the GNU General Public License as published by
148+
the Free Software Foundation, either version 2 of the License, or
149+
(at your option) any later version.
150+
151+
This program is distributed in the hope that it will be useful,
152+
but WITHOUT ANY WARRANTY; without even the implied warranty of
153+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
154+
GNU General Public License for more details.
155+
156+
You should have received a copy of the GNU General Public License
157+
along with this program. If not, see <http://www.gnu.org/licenses/>.

NotSoFlat/notes.txt

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Simplex(Random,octaves,frequency,amplitude)
2+
Simplex:
3+
(OCTAVES #:int) (FREQUENCY #:float) (AMPLITUDE #:float -- Int?)
4+
5+
OCTAVES is the number of octaves of noise to sample,
6+
The number of octaves control the amount of detail of Perlin
7+
noise. Adding more octaves increases the detail of Perlin noise, with
8+
the added drawback of increasing the calculation time.
9+
10+
FREQUENCY is the frequency of the first octave, The number of cycles
11+
per unit length that a specific coherent-noise function outputs.
12+
13+
14+
AMPLITUDE is the amplitude of the first octave. Max abs value that
15+
can be output. (-n to +n? or just 0 to n)
16+
17+
18+
* More complex terrain: Based on normal
19+
- Height - (Normal has *base*)
20+
- Incline - Multiplier to height (to generate more ruggged terrain)
21+
22+
- Altitude (computed)
23+
- Precipitation -
24+
- Temperature - (softer)
25+
- Diversity - Changes the selection of stuff
26+
27+
High Temp
28+
29+
Alt \ Precp High Medium Low
30+
High Mesa Mesa DesHill
31+
Medium Jungle Savan Desert
32+
Low Swamp Savan Desert
33+
34+
35+
Medium Temp
36+
37+
Alt \ Precp High Medium Low
38+
High SnowHll Hills Mesa
39+
Medium Forest Plains Savanna
40+
Low Jungle Swamps Beach
41+
42+
Low Temp
43+
44+
Alt \ Precp High Medium Low
45+
High SnowHil ColdHill Taiga
46+
Medium SnowPla SnowPlain Taiga
47+
Low IcePlai ColdBeach IcePla
48+

NotSoFlat/plugin.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: NotSoFlat
2+
main: aliuly\notsoflat\Main
3+
load: STARTUP
4+
api: [1.6.0,1.12.0]
5+
version: 1.1.0
6+
author: aliuly
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
namespace aliuly\notsoflat;
4+
5+
use pocketmine\block\Block;
6+
use pocketmine\level\ChunkManager;
7+
use pocketmine\utils\Random;
8+
use pocketmine\level\generator\populator\Populator;
9+
10+
class DesertPlant extends Populator{
11+
/** @var ChunkManager */
12+
private $level;
13+
private $randomAmount;
14+
private $baseAmount;
15+
16+
public function setRandomAmount($amount){
17+
$this->randomAmount = $amount;
18+
}
19+
20+
public function setBaseAmount($amount){
21+
$this->baseAmount = $amount;
22+
}
23+
24+
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){
25+
$this->level = $level;
26+
$amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount;
27+
for($i = 0; $i < $amount; ++$i){
28+
$x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);
29+
$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);
30+
for($size = 30; $size > 0; --$size){
31+
$xx = $x - 7 + $random->nextRange(0, 15);
32+
$zz = $z - 7 + $random->nextRange(0, 15);
33+
$yy = $this->getHighestWorkableBlock($xx, $zz);
34+
35+
if($yy !== -1 and $this->canTallGrassStay($xx, $yy, $zz)){
36+
$this->level->setBlockIdAt($xx, $yy, $zz, Block::CACTUS);
37+
$this->level->setBlockDataAt($xx, $yy, $zz, 1);
38+
}
39+
}
40+
}
41+
}
42+
43+
private function canTallGrassStay($x, $y, $z){
44+
return $this->level->getBlockIdAt($x, $y, $z) === Block::AIR and $this->level->getBlockIdAt($x, $y - 1, $z) === Block::SAND;
45+
}
46+
47+
private function getHighestWorkableBlock($x, $z){
48+
for($y = 128; $y > 0; --$y){
49+
$b = $this->level->getBlockIdAt($x, $y, $z);
50+
if($b === Block::AIR or $b === Block::LEAVES){
51+
if(--$y <= 0){
52+
return -1;
53+
}
54+
}else{
55+
break;
56+
}
57+
}
58+
59+
return ++$y;
60+
}
61+
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
namespace aliuly\notsoflat;
3+
4+
use pocketmine\plugin\PluginBase;
5+
use pocketmine\level\generator\Generator;
6+
use pocketmine\utils\TextFormat;
7+
8+
class Main extends PluginBase{
9+
public function onEnable(){
10+
$api = $this->getServer()->getApiVersion();
11+
if (version_compare($api,"1.12.0") >= 0) {
12+
$this->getLogger()->info(TextFormat::RED."WARNING: PMv1.5 support is experimental!");
13+
Generator::addGenerator(NotSoFlat::class, "notsoflat");
14+
} else {
15+
Generator::addGenerator(NotSoFlatOld::class, "notsoflat");
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)