12457 Commits

Author SHA1 Message Date
Dylan K. Taylor
9dda99f844 Updated composer dependencies 2020-09-25 18:36:45 +01:00
Dylan K. Taylor
38b97dd0b7 Entity: remove useless function 2020-09-25 18:11:24 +01:00
Dylan K. Taylor
3b4e9eea96 RuntimeBlockMapping: drop useless doc comment 2020-09-25 17:43:00 +01:00
Dylan K. Taylor
7c192f85e2 protocol: remove final remaining Vector3 mutations
this really should be replaced with a network layer BlockPos structure in the absence of a general int-vector structure in math.
2020-09-25 17:41:12 +01:00
Dylan K. Taylor
a5e21bfaa9 Entity: protect getBlocksAroundWithEntityInsideActions() 2020-09-25 16:40:30 +01:00
Dylan K. Taylor
3556f26e00 Entity: Rename getBlocksAround() -> getBlocksAroundWithEntityInsideActions()
this name is more long-winded, but much less misleading.
2020-09-25 16:39:55 +01:00
Dylan K. Taylor
8e12693494 Entity: Invalid blocksAround cache when something happens during onEntityInside()
this fixes TNT spawning multiple entities when lit by flaming arrows.
The problem here is a bit more complex (entities aren't immediately notified when local block updates happen, so they cache stuff that becomes unusable). The simplest option would be to just lose the cache, but that would have some impacts on performance.
Barring a rethink of the block updating mechanism, this solution seems usable for now.
2020-09-25 16:35:59 +01:00
dependabot-preview[bot]
0fc9170bbf
Bump phpstan/phpstan from 0.12.43 to 0.12.44 (#3838) 2020-09-25 13:20:29 +00:00
dependabot-preview[bot]
7e2efae024
Bump phpstan/phpstan from 0.12.42 to 0.12.43 (#3831) 2020-09-24 11:23:32 +00:00
dependabot-preview[bot]
e9fa07b550
Bump phpunit/phpunit from 9.3.10 to 9.3.11 (#3835) 2020-09-24 09:57:58 +00:00
Dylan K. Taylor
ae9e931849 LightPopulationTask: Simplify check for chunk loading in onCompletion()
we have no business loading chunks here either, although the isChunkLoaded() check should prevent that from happening.
2020-09-20 13:44:02 +01:00
Dylan K. Taylor
b252c18d34 World: Loading chunks to sync block updates is a bug
again, this should never happen, because chunk unloading cleans this stuff out. But if it did happen, loading chunks is not the way to take care of it.
2020-09-20 13:42:27 +01:00
Dylan K. Taylor
b7471fc77b Player: Loading chunks to spawn entities is a bug
again, this would never happen except in bug circumstances, but if there was a bug, it should crash instead of trying to load chunks to paper over it.
2020-09-20 13:40:44 +01:00
Dylan K. Taylor
7f43164776 Player: Loading chunks during unloading chunks is a BIG nope
this should never happen, but it could have happened if there was a bug in the code for some reason.
Readers note: I know this looks lik I'm undoing the changes I just did, but what really happened is a name change.
2020-09-20 13:39:31 +01:00
Dylan K. Taylor
716de4d9d6 ChunkCache: we have no business autoloading chunks during sending
if the chunk isn't loaded, this is a bug and it should crash.
2020-09-20 13:32:54 +01:00
Dylan K. Taylor
5096741b29 World::getChunk() behaviour now matches that of a regular ChunkManager
Various bugs existed for a while with stuff using chunk managers instead of worlds when interacting with terrain due to a behavioural inconsistency between World::getChunk() (return from cache or load from disk), and SimpleChunkManager::getChunk() (return from cache only). This change brings the two in line.
World::getOrLoadChunk() has been added as a replacement, which has the same behaviour as the old getChunk() and also makes it more obvious that there is an issue with code using it during refactoring.
2020-09-20 13:29:09 +01:00
Dylan K. Taylor
c9d2edcb4d Rename SubChunkIteratorManager -> SubChunkExplorer 2020-09-20 12:47:44 +01:00
Dylan K. Taylor
4879df626d Reduced LightUpdate dependency on ChunkManager to indirect
this opens the gateway for alternative SubChunkIteratorManager implementations which don't use ChunkManager at all.
2020-09-20 12:41:53 +01:00
Dylan K. Taylor
5661d0496f RuntimeBlockMapping::toRuntimeId() now accepts a single integer instead of id/meta
the expectation is that eventually this will receive arbitrary internal runtime IDs instead of static id/meta, and RuntimeBlockMapping doesn't really care about this crap anyway.
2020-09-20 12:16:11 +01:00
Dylan K. Taylor
42b184c113 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp into master 2020-09-20 12:01:40 +01:00
Dylan K. Taylor
2281df8c97 Updated build/php submodule to pmmp/php-build-scripts@0eb28b8b66 2020-09-20 12:01:24 +01:00
dependabot-preview[bot]
8ac32824a2
Bump phpunit/phpunit from 9.3.9 to 9.3.10 (#3828) 2020-09-15 17:01:03 +00:00
dependabot-preview[bot]
1322defead
Bump phpunit/phpunit from 9.3.8 to 9.3.9 (#3825) 2020-09-12 12:32:33 +00:00
Dylan K. Taylor
d084b7a34b RegionGarbageMap: add an extra overlap check
this shouldn't ever be triggered, but we want to know if it does.
2020-09-12 01:38:13 +01:00
Dylan K. Taylor
c2d0605b1e Entity: avoid implicit float truncation in getDirection()
this didn't cause any bugs because of the way the function is written, but it might have in other circumstances.
2020-09-11 21:01:22 +01:00
Dylan K. Taylor
0ff0b33047 StatusCommand: avoid modulo operator on float
this was detected by a custom PHPStan extension.
2020-09-11 20:56:18 +01:00
Dylan K. Taylor
114df07622 RegionLoader: specify type of unpack() return
PHPStan has no idea what is going on in this code because unpack() returns mixed[].
Possibly it might be a good idea to implement a dynamic return type extension for this.
2020-09-11 20:48:37 +01:00
Dylan K. Taylor
4a88db7f43 travis: update pthreads to pmmp/pthreads@b81ab29df5 2020-09-11 14:30:22 +01:00
SOFe
9d0ac297bb
Improved documentation for CancellableTrait 2020-09-10 16:49:20 +08:00
Dylan K. Taylor
d3ea29d527 Release memory to OS on garbage collection
ZMM often holds onto big chunks of memory after they aren't used anymore, which is fine in a webserver, but it's not OK for PM.
2020-09-09 01:40:18 +01:00
Dylan K. Taylor
c20ac82fe6 LightUpdate: Move propagation-specific state to a separate unit
this solves multiple architectural issues:
- improves reusability by avoiding having old state info stick around to fuck stuff up
- prevents access to propagation state from outside of propagation

this also reduces the latent memory usage of light-updates after they have been used.

TODO: we could probably change LightPropagationContext to LightPropagator and move all the propagation-specific code into it if we can solve the subchunk-iterator and effective light problems.
2020-09-09 01:06:09 +01:00
Dylan K. Taylor
bde24d9279 LightUpdate: remove unused field 2020-09-08 23:14:10 +01: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
773069d1cc fix travis build 2020-09-08 21:09:39 +01:00
Dylan K. Taylor
ec6ac59b9c BlockLightUpdate: actually use lightEmitters
I accidentally added this during a separation of my local changes, but it's useful anyway, so we should use it.
This removes BlockLightUpdate's implicit dependency on Block, which is a
step towards native light.
2020-09-08 18:21:03 +01:00
Dylan K. Taylor
205617f29e Untether LightUpdate and children from BlockFactory 2020-09-08 18:14:35 +01:00
Dylan K. Taylor
0fd3d91038 LightArray: hide constants ZERO and FIFTEEN from the API
this makes it easier to implement this in C++ with the same API. Since the C++ version doesn't use strings, these constants aren't needed anyway.
2020-09-08 15:13:58 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
5fbc842f7a LightArray: do not accept NULL in the constructor
it makes more sense to pass LightArray::ZERO or just use LightArray::fill(0) if a zeroed light array is desired.
2020-09-06 16:18:47 +01:00
Dylan K. Taylor
be0cec531a ResourcePackInfoEntry: remove useless null coalesce operators
these fields are never null.
these errors aren't reported unless bleeding-edge is enabled.
2020-09-06 16:13:41 +01:00
Dylan K. Taylor
fb4b92d1f4 HandlerListManager: fixed missing null type flag 2020-09-06 16:12:54 +01:00
Dylan K. Taylor
f45316d2d6 Leaves: fixed phpstan type doc error
for some reason this isn't reported unless bleeding edge is enabled.
2020-09-06 16:12:24 +01:00
Dylan K. Taylor
94d8f59484 LightUpdate::execute() now returns the number of visits made to blocks in total
this is useful for performance profiling.
2020-09-05 22:25:42 +01:00
Dylan K. Taylor
15299735e9 Do not create chunks during light propagation/removal
this used to be necessary to trigger subchunk creation so that light arrays would be available for use. With 02ff8d671b93ec5911576643e9b03f2049f31c81, this is no longer necessary.
2020-09-05 22:22:19 +01:00
Dylan K. Taylor
6054104ecb drop a few more useless static variables
phpstan is better able to understand constant literals, since it knows their types will never change.
2020-09-05 18:43:22 +01:00
Dylan K. Taylor
b96565faa4 Drop some obviously useless static function variables
these are better suited as constant literals.
2020-09-05 18:39:47 +01:00
Dylan K. Taylor
6b6f77f8af Chunk: improved heightmap calculation performance
recalculateHeightMapColumn is stateless, so it can't make any assumptions about which subchunks to check for blocks. However, in most the average case (6 allocated subchunks), this causes 2500+ useless SubChunk->getHighestBlockAt() calls (10 per column). Since we're calculating in bulk, we can figure out which subchunks are empty one time and ignore them for all 256 columns.
In the average case, this produced a 50-60% performance improvement for heightmap calculation (~1.1 ms -> 0.5 ms).
In extreme cases where the height is extremely varied, this produces no observable performance benefit, but for most cases with flattish terrain, it's an improvement.
It can likely be further improved, but further performance improvements are outside the scope of this commit and will likely result in more complexity increases.
2020-09-05 00:16:07 +01:00
Dylan K. Taylor
e1816bd415 SubChunkInterface: clarify documentation of isEmptyFast() 2020-09-04 22:10:42 +01:00
Dylan K. Taylor
2e45398072 World: skip random block ticking on chunks that don't have any light
typically this is a state that only lasts for a tick or so, but it's a race condition that is regardless very commonly encountered.
If you were very unlucky, you might have noticed grass randomly dying when you were spawning or flying around, even though it was in full sky light.
2020-09-04 18:08:42 +01:00