Commit Graph

129 Commits

Author SHA1 Message Date
dc5b1efa66 Merge remote-tracking branch 'origin/stable' 2021-04-15 14:04:27 +01:00
6ce15854af Clean up generator preset handling 2021-04-13 20:19:53 +01:00
eb9a68edee Further refactors to prepare for y=-64 lower limit 2021-03-18 00:08:16 +00:00
5a1131d72d Populator: require dependencies explicitly, don't make bad assumptions about fields
this also leaks ChunkManagers on the worker threads because the generator context is long-lived.
2021-01-27 21:08:46 +00:00
1de5fc86c4 PopulationTask: assume that generator has been initialized 2020-12-13 20:00:57 +00:00
5ba09b6a25 fix PopulationTask crash 2020-12-03 23:48:40 +00:00
b9cd633cee Chunks no longer exist in un-generated state
a non-generated chunk is now always represented by NULL. This forces the case of ungenerated chunks to be handled by all code, which is necessary because ungenerated chunks cannot be interacted with or modified in any meaningful way.
2020-12-03 22:28:43 +00:00
05ab44f768 PopulationTask no longer creates chunks if they don't exist
creating a throwaway empty chunk on the main thread is pointless.
2020-12-03 22:12:42 +00:00
c808095978 Chunks no longer contain their own coordinates 2020-12-03 21:59:30 +00:00
1f5998d24c FastChunkSerializer no longer encodes chunk coordinates
in cases like PopulationTask it makes more sense to store the coordinates separately where they can be stored more efficiently (once instead of 9 times)
In addition, PopulationTask shouldn't need to serialize an empty chunk just to copy coordinates.

I've made changes like this in other areas already in preparation for the day when chunks no longer contain their coordinates, so this brings us one step closer to that goal.
2020-12-03 20:52:33 +00:00
7edfa3713b Do not persist SimpleChunkManager between async tasks
this is just asking for memory leaks.
2020-12-03 19:46:23 +00:00
dde2e7e66f generation: drop AsyncWorker thread-local storage in favour of a more specialized storage 2020-12-03 19:28:22 +00:00
b7690fed04 BiomeSelector: replace phpdoc with typehints 2020-11-01 17:09:10 +00:00
4231bfdc7e Relocate biome ID constants to pocketmine\data\bedrock package 2020-11-01 16:53:06 +00:00
b176f4c12f Switch to BiomeRegistry
I accidentally committed this in c869a7f099 and didn't notice. I intended to use it and never noticed.
2020-11-01 16:47:13 +00:00
f991961d9a Generator no longer requires a ChunkManager to construct
this allows injection of arbitrary ChunkManagers into a single Generator instance.
The objective here was to remove the requirement to cache a SimpleChunkManager instance in worker-local storage, because that requires that the chunks it stores be manually removed to avoid memory leaks. However, there are some other obstacles, primarily the worldHeight which is not retained anywhere else.
2020-11-01 16:34:56 +00:00
1d551af54a Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/level/Level.php
#	src/pocketmine/level/format/Chunk.php
#	tests/phpstan/configs/l7-baseline.neon
2020-11-01 15:58:16 +00:00
4549522289 Rename Chunk::getSubChunkChecked() -> getSubChunk() 2020-10-31 23:12:03 +00:00
b270029161 Rename Chunk::getWritableSubChunk() -> Chunk::getSubChunkChecked()
this is not specific to 'writable', it's just an opt-in to checked bounds so that an EmptySubChunk will never be received.
2020-10-31 22:46:33 +00:00
ddda2d1e64 Remove $create parameter from ChunkManager::getChunk()
this restores SimpleChunkManager's behaviour to PM3, removing the need for GeneratorChunkManager (although I'm dubious whether SubChunkExplorer makes any sense in there any more now that we have morton in the mix).
2020-10-31 21:54:51 +00:00
797e0996f4 PopulationTask: Do not include light when serializing chunks (either way)
non-populated chunks shouldn't be light-populated anyway, but in some cases they are (bug or plugin interference).
chunks which were already populated might get modified by adjacent chunk populations, which should invalidate their lighting because generation doesn't track which blocks were changed, so the whole chunk should be recalculated.
2020-10-27 18:42:30 +00:00
05ab75b5ce PopulationTask: do not calculate lighting for chunks
we do this ondemand now, which means this is just wasting CPU for the vast majority of generated chunks.
2020-10-27 17:03:57 +00:00
4c0c2ebd24 CS cleanup 2020-10-26 15:56:30 +00:00
9a282e2646 Noise: Improve fastNoise3D performance by ~25-30% 2020-10-17 20:03:19 +01:00
095449e86a Normal (generator): micro optimisations (and readability improvements) 2020-10-17 19:24:01 +01:00
03de2bcc67 Chunk: simplify heightmap calculation 2020-09-08 23:03:52 +01:00
c7070788f9 Rename and repurpose Block->diffusesSkyLight to blocksDirectSkyLight
this new form allows skipping some useless checks during sky light calculation and also allows getting rid of the last hard dependency on core Block classes.
We're getting real close to native light now.
2020-09-08 22:40:05 +01:00
01f8116cdd Fix some of the implicit immutability issues of EmptySubChunk
it's useful to have an immutable stub around for the sake of feeding back dummy read values, but for write values it has to barf instead of being quiet.
There's still some issues with LightArray which I don't currently have a solution for, but I'm thinking about separating light storage from chunks anyway.
2020-09-07 14:43:26 +01:00
3d4470ed8d added nether quartz ore to nether generation 2020-08-06 13:23:03 +01:00
7bcfece11e Flat: use block names instead of legacy block IDs for hardcoded preset 2020-08-06 12:58:49 +01:00
de9856151a Flat: remove useless field 2020-08-06 12:58:08 +01:00
aa682a865e Allow injecting arbitrary preimage block for ore generation
this will be useful for nether ore generation.
2020-08-06 12:46:07 +01:00
5a56f68991 Normal: make gaussian non-static
this allows each generator to (potentially) have a different gaussian curve for biome blending, as well as fixing a few phpstan level 7 errors.
2020-06-28 19:08:18 +01:00
db8e094d11 Extract a Gaussian unit from Normal generator 2020-06-28 18:45:52 +01:00
78c270a96e PopulationTask: check the correct instance 2020-06-28 18:45:51 +01:00
82b3e3398b make more use of igbinary_serialize() and igbinary_unserialize() 2020-06-17 23:03:03 +01:00
c9af5ce7a9 Convert GeneratorManager to singleton 2020-05-23 10:13:03 +01:00
11ef9fb0c0 Item-from-string parsing no longer depends on ItemIds
after this is done I'm banning the constant() function.
2020-05-13 00:18:49 +01:00
5a94af40e2 Convert ItemFactory to singleton 2020-04-24 00:18:31 +01:00
13d784cd0c Convert BlockFactory to singleton 2020-04-23 23:45:13 +01:00
accc0da0cb Chunk no longer depends on BlockFactory
really this light population crap shouldn't be in the chunk to begin with, but that's a bit more complicated.
2020-04-23 21:31:28 +01:00
cd71a6204f Revert "PopulationTask: do not populate light in chunks out of the gate"
This reverts commit 42148f0d15.
2020-02-11 19:43:25 +00:00
42148f0d15 PopulationTask: do not populate light in chunks out of the gate
this is a relic from when we needed to store light on disk. Now we can just calculate lighting as-needed instead.
2020-02-11 19:14:01 +00:00
9b6fa8c25b Merge branch 'stable' 2020-02-11 19:12:39 +00:00
fb1126797a Merge branch 'stable' 2020-02-07 18:13:55 +00:00
ff63f6d055 fill in more iterable types (master) 2020-02-01 20:19:57 +00:00
f65bf76fd8 Merge commit '799183e13e61e89cc6820ad3132a4147454017c6'
# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/level/format/io/LevelProviderManager.php
#	src/pocketmine/tile/Tile.php
#	src/world/generator/GeneratorManager.php
2020-01-31 21:26:40 +00:00
cb16f5c142 Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'
# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/lang/Language.php
#	src/network/mcpe/protocol/AddItemActorPacket.php
#	src/network/mcpe/protocol/AddPlayerPacket.php
#	src/network/mcpe/protocol/SetActorDataPacket.php
#	src/network/mcpe/serializer/NetworkBinaryStream.php
#	src/permission/Permission.php
#	src/pocketmine/block/Leaves.php
#	src/pocketmine/entity/DataPropertyManager.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Banner.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/io/LevelProvider.php
#	src/pocketmine/level/format/io/LevelProviderManager.php
#	src/pocketmine/network/mcpe/protocol/AddActorPacket.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
#	src/pocketmine/tile/Banner.php
#	src/scheduler/BulkCurlTask.php
#	src/updater/AutoUpdater.php
#	src/utils/Config.php
#	src/utils/Utils.php
#	src/world/generator/Flat.php
#	src/world/generator/Generator.php
2020-01-31 21:07:34 +00:00
465d8cda79 Merge commit 'a5764b3ae98a70fe8f20f9b403a4ab84b51b11d8'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/level/format/io/LevelProvider.php
#	src/world/generator/Generator.php
#	src/world/generator/GeneratorRegisterTask.php
2020-01-31 19:32:38 +00:00
055b13a6cf strip extra blank lines (php-cs-fixer) 2020-01-22 15:14:10 +00:00