184 Commits

Author SHA1 Message Date
Dylan K. Taylor
478a131aa5 Flat: separate logic of parsing preset and generating base chunk
now always generates the base chunk on init, because the generator won't be created unless there is generation to be done.
2018-07-14 11:51:49 +01:00
Dylan K. Taylor
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
Dylan K. Taylor
3be6665e3d AsyncWorker IDs now start from 0 instead of 1
this now matches their IDs in the AsyncWorker pool, as used by submitTask().
2018-06-11 11:58:24 +01:00
Dylan K. Taylor
88d83e0fca AsyncPool: Lazy-start AsyncWorkers when they are needed only
This changes how the AsyncPool works so that it does not immediately always start all of the workers in the pool.
Instead, workers will be started only when an idle worker was not found.
This allows for significant memory footprint reductions while idle.

In effect the async-workers setting in pocketmine.yml now dictates a _maximum_ pool size, not a fixed pool size.
2018-06-11 10:23:46 +01:00
Dylan K. Taylor
c4c6c58615 Added some missing typehints 2018-06-10 17:18:55 +01:00
Dylan K. Taylor
8cd311bcb4 GroundCover: don't replace liquid with can-be-flowed-into blocks
fixes snow layers generating underwater
2018-06-08 11:15:19 +01:00
Dylan K. Taylor
78ec3937bf BiomeSelector: drastically simplified implementation and made more robust
- Doesn't need to be pre-populated with biomes prior to calculating the heatmap - now population of biomes is entirely dependent on the lookup function, improving consistency
- Uses an abstract class method for lookup instead of callback (use anonymous class instead)
- Faster because the heatmap is directly populated with biomes instead of biome IDs, removing an unnecessary lookup.
2018-06-08 10:19:08 +01:00
Dylan K. Taylor
c8a87b14d5
PopulationTask: actually fix locks not getting released in generation errors 2018-06-07 23:53:59 +01:00
Dylan K. Taylor
8fca7cc68d Apply some typehints to generators 2018-06-07 20:22:35 +01:00
Dylan K. Taylor
45f940681a Make Normal->pickBiome() private 2018-06-07 20:21:26 +01:00
Dylan K. Taylor
e3c97d7d5e Flat: clean up more garbage 2018-06-07 20:18:04 +01:00
Dylan K. Taylor
172abef2a7 Flat: clean up generation of base chunk 2018-06-07 20:11:29 +01:00
Dylan K. Taylor
709abb02e6 Generator: remove more dead incomplete code
again, this can be added when and if it's actually implemented.
2018-06-07 19:54:51 +01:00
Dylan K. Taylor
428ca29e4b Remove dead bedrockDepth fields from generator
yes, this is not implemented yet. fields for this can be added when proper bedrock generation is implemented. For now, it's just dead code.
2018-06-07 19:52:56 +01:00
Dylan K. Taylor
f61ad20f6b Remove a whole bunch of dead copy-pasted code from Nether generator 2018-06-07 19:51:27 +01:00
Dylan K. Taylor
3c9af5cd6d Generator: small reduction of code duplication 2018-06-07 19:49:51 +01:00
Dylan K. Taylor
996935e9b2 Cleaned up level seed handling 2018-06-07 19:39:24 +01:00
Dylan K. Taylor
083a1e1ff6 GeneratorManager: Make addGenerator() throw exceptions instead of returning false 2018-06-07 14:34:26 +01:00
Dylan K. Taylor
17b58357fb GeneratorManager: add documentation for functions 2018-06-07 14:30:19 +01:00
Dylan K. Taylor
96a4dbb7d8 GeneratorManager: add typehints 2018-06-07 14:24:01 +01:00
Dylan K. Taylor
5eec683110 Generator: Moved generator registering things to a separate GeneratorManager class
this isolates the concerns of the Generator class, and also removes cyclic dependencies between the Generator class and its descendents.
2018-06-07 13:48:01 +01:00
Dylan K. Taylor
0bca3cd481 Generator: Move static noise functions to Noise instance methods 2018-06-07 13:40:10 +01:00
Dylan K. Taylor
b331f8e1c9 AsyncWorker: added removeFromThreadStore()
and use it instead of overwriting with null things, which still occupies memory
2018-06-07 10:12:50 +01:00
Dylan K. Taylor
7b17a83227 Level: fix chunk locks not getting released on generation errors 2018-06-06 11:42:29 +01:00
Dylan K. Taylor
6047810113 Level: remove useless null checks for fastDeserialize() returns 2018-06-01 17:02:29 +01:00
Dylan K. Taylor
c493d0e6ac Level: Stop unnecessarily initializing the generator on the main thread
this is just slowing down startup times for no good reason.
2018-05-31 10:22:44 +01:00
Dylan K. Taylor
6d53350291 Level: Moved LightPopulationTask out of generator namespace 2018-05-29 11:20:27 +01:00
Dylan K. Taylor
ed65e91a3c Tree: avoid astonishing behaviour with dark-oak and acacia saplings
ref #1973, these should simply not grow at all since they are not implemented yet.
2018-05-12 10:03:20 +01:00
Dylan K. Taylor
dfa6cd2b7e Biome: Moved biome classes from level\generator\* to level\biome 2018-05-01 14:07:46 +01:00
Dylan K. Taylor
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
Dylan K. Taylor
e48ec9fb71 Ore: replaced a sub-optimal multiply()->divide() on Vector2 2018-03-18 18:06:04 +00:00
Dylan K. Taylor
95606b6e04 Generator: fixed a couple of hardcoded block IDs 2018-03-18 18:03:23 +00:00
Dylan K. Taylor
3f7b14bf59 Level: Remove dead generator leftovers
This is all handled by the population mechanism now. Nothing uses these things anymore since years.
2018-03-11 13:56:41 +00:00
Dylan K. Taylor
06af742bef wtf 2018-03-01 09:30:50 +00:00
Dylan K. Taylor
d4eba3f4b1 Moved some things out of Server to appropriate init() functions 2018-03-01 09:18:40 +00:00
Dylan K. Taylor
48dc1c38f7 Generator: fixed misuse of InvalidArgumentCountException 2018-01-27 12:46:09 +00:00
Dylan K. Taylor
4f8e4f0522
Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
Dylan K. Taylor
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00
Dylan K. Taylor
2fd61163bf cleanup some chunks leftovers from 1.0 2017-11-19 17:52:36 +00:00
Dylan K. Taylor
251d5d7946 Fixed some hardcoded values in Tree 2017-10-16 12:30:46 +01:00
Dylan K. Taylor
ddfe828445 Require PHP 7.2, bump PocketMine-MP version to 1.7dev 2017-08-31 20:27:05 +01:00
Dylan K. Taylor
876659cc73 Item factory refactor and added capability to register custom items 2017-08-21 17:49:26 +01:00
Dylan K. Taylor
604d11a8fd import cleanup and fixed an inspection 2017-08-21 17:39:02 +01:00
Dylan K. Taylor
9e54980ded Fixed some usages of Block::get() 2017-08-21 12:58:35 +01:00
Dylan K. Taylor
02f42eba48 Move block registration to its own class 2017-08-20 18:05:01 +01:00
Dylan K. Taylor
0e24596aed Changed block construction calls to Block::get() 2017-08-19 13:46:17 +01:00
Dylan K. Taylor
87c16dab23 Don't allocate subs that aren't going to be modified 2017-07-28 11:26:15 +01:00
Dylan K. Taylor
c1542d853f Improved flat world initial chunk generation speed by ~50% 2017-07-27 21:57:28 +01:00
Dylan K. Taylor
ab3b50f062 Stop it PhpStorm, you're making me look bad 2017-07-15 12:15:15 +01:00
Dylan K. Taylor
dbb92096e4 More typehints, documentation fixes and static analysis cleanup 2017-07-15 12:12:06 +01:00