32 Commits

Author SHA1 Message Date
Dylan K. Taylor
c7e9138994
PopulationTask: reduce code duplication 2021-10-01 23:18:56 +01:00
Dylan K. Taylor
88f799da2c
more AssumptionFailedError hacks for PHPStan :(
the code in this class is really horrible
2021-10-01 23:05:48 +01:00
Dylan K. Taylor
8de30e8162
FastChunkSerializer no longer serializes light by default
the core doesn't use this anywhere.
serializeWithoutLight() has been renamed to serializeTerrain() to more accurately describe what it does.
2021-10-01 22:57:22 +01:00
Dylan K. Taylor
2fe03757d5
PopulationTask: fixed PHPStan errors 2021-08-30 00:26:54 +01:00
Dylan K. Taylor
0289b45202
Chunk: Drop dirty flags for tiles and entities
instead, just ungate this and allow the provider to decide what to do.
Any chunk that contains entities or tiles is already always considered dirty, so the only thing the flags are good for is flagging chunks that previously had tiles and/or entities but no longer do.
In those cases, it's just removing keys from LevelDB anyway, so it's already very cheap.
Avoiding these redundant deletions is not worth the extra complexity and fragility of relying on flags to track this stuff.
2021-08-30 00:09:36 +01:00
Dylan K. Taylor
02fab77e55
World: change 'closed' to 'unloaded'
this makes more sense overall from a reader's perspective.
and also provide a rug-jerk for any idiots using World->close() when they aren't supposed to? ....
2021-06-26 21:54:18 +01:00
Dylan K. Taylor
eb9a68edee
Further refactors to prepare for y=-64 lower limit 2021-03-18 00:08:16 +00:00
Dylan K. Taylor
1de5fc86c4
PopulationTask: assume that generator has been initialized 2020-12-13 20:00:57 +00:00
Dylan K. Taylor
5ba09b6a25 fix PopulationTask crash 2020-12-03 23:48:40 +00:00
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