23 Commits

Author SHA1 Message Date
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
c808095978 Chunks no longer contain their own coordinates 2020-12-03 21:59:30 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
7edfa3713b Do not persist SimpleChunkManager between async tasks
this is just asking for memory leaks.
2020-12-03 19:46:23 +00:00
Dylan K. Taylor
dde2e7e66f generation: drop AsyncWorker thread-local storage in favour of a more specialized storage 2020-12-03 19:28:22 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
03de2bcc67 Chunk: simplify heightmap calculation 2020-09-08 23:03:52 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
78c270a96e PopulationTask: check the correct instance 2020-06-28 18:45:51 +01:00
Dylan K. Taylor
13d784cd0c Convert BlockFactory to singleton 2020-04-23 23:45:13 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
cd71a6204f Revert "PopulationTask: do not populate light in chunks out of the gate"
This reverts commit 42148f0d15949faecfbbef8f09ef4355d3dd3899.
2020-02-11 19:43:25 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
9b6fa8c25b Merge branch 'stable' 2020-02-11 19:12:39 +00:00
Dylan K. Taylor
fb1126797a Merge branch 'stable' 2020-02-07 18:13:55 +00:00
Dylan K. Taylor
cda1143a79 Merge branch 'stable' 2020-01-09 17:17:42 +00:00
Dylan K. Taylor
a9c09e4517 Merge branch 'next-minor' 2019-12-12 13:52:14 +00:00
Dylan T
c533f6a0bd
Implemented partial chunk saving on LevelDB (#3078) 2019-08-07 17:39:36 +01:00
Dylan K. Taylor
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00