Commit Graph

12293 Commits

Author SHA1 Message Date
Dylan K. Taylor
38f97bed52 World: fixed PopulationTask failed assumption that generator is always registered
if the worker selected previously had a generator registered, but has since been shutdown, the workerStartHook that cleans up generatorRegisteredWorkers won't yet have been called.
This results in the worker being started by the submission of PopulationTask, and the generator doesn't get preemptively registered.
2021-11-02 16:58:14 +00:00
Dylan K. Taylor
275f145418 BedrockData is now a Composer dependency
this should put a stop to people nagging me about incorrect blocks (we have a check to make sure composer dependencies are up to date).
2021-11-02 16:45:45 +00:00
Dylan K. Taylor
e131c2cefa Drop pocketmine/spl 2021-11-02 16:08:29 +00:00
Dylan K. Taylor
e34364412b Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
Dylan K. Taylor
4eef458d29 Config: throw AssumptionFailedError if config type is invalid or DETECT during save()
this should never happen ... it was already checked in load()
2021-11-02 16:03:43 +00:00
Dylan K. Taylor
8b3565b75d PopulationTask no longer depends on a World object
this means it's now possible to test generation offline without too much hassle.
World::generateChunkCallback() has been removed from public API.
2021-11-02 15:40:51 +00:00
Dylan K. Taylor
facfd7c04a sanity check 2021-11-02 15:26:54 +00:00
Dylan K. Taylor
65ef9f786a Use standard chunkHash() to index population chunks 2021-11-02 15:25:03 +00:00
Dylan K. Taylor
4dc13ab3da ConsoleReaderThread: strip control characters
this fixes a bug I encountered when accidentally pressing ctrl+a+d (which inserts a chr(1) character), because it made the server unable to find the command - but still reported an error containing what looked like a valid command (character isn't printable).
2021-11-02 15:11:23 +00:00
Rush2929
ede4157814 Check to see if the player can start using the Releasable item. (#4532) 2021-11-02 14:36:16 +00:00
Dylan K. Taylor
34ea199fb0 World: fixed additional edge case - population promise rejected before task completion
if this happened, the index would stay set in activeChunkPopulationTasks, eventually causing the generation queue to jam up completely and non-forced generation to come to a standstill.
2021-11-02 14:30:23 +00:00
Dylan K. Taylor
1775699f05 World: make sure that chunks locked by PopulationTask always get unlocked, no matter what
fixes #4527
2021-11-02 14:20:42 +00:00
Dylan K. Taylor
32a857b8b4 fix CS 2021-11-02 14:09:16 +00:00
Dylan K. Taylor
7e4be29fc4 Gracefully force-shutdown on failure to start RakLib
this now won't generate a crashdump.
2021-11-02 13:51:01 +00:00
Dylan K. Taylor
c17587d436 World: use new Vector3() instead of Block->getPosition()
When profiling this, I noticed that we spend a stupidly large amount of time creating useless Position objects in the case of update=true, because Vector3->sides() calls Position->getSide(), which calls Position::fromObject(parent::getSide()). This is stupid because the update logic doesn't require Positions anywhere (as evidenced by this change needing no other alterations.

A rough profile shows that this improves setBlock() performance by about 25% in the update=true case, which is a pretty big margin.
As an added bonus, it gets rid of some unrealized cyclic dependencies in World->changedBlocks.
2021-11-02 03:00:00 +00:00
Dylan K. Taylor
0f6b7e48cb Updated BedrockProtocol:
it's weirdly satisfying that LevelChunkPacket::create() with the extra parameter turns out to be exactly the same length as the old way.
2021-11-02 01:37:56 +00:00
Dylan K. Taylor
f2912fcdd8 Updated pocketmine/log and pocketmine/log-pthreads (BC breaks included)
AttachableLogger deals with Closures now instead of LoggerAttachment objects
ThreadedLoggerAttachment no longer implements LoggerAttachment
2021-11-01 22:22:22 +00:00
Dylan K. Taylor
8c16ecaa5b Merge branch 'stable' 2021-11-01 21:08:32 +00:00
Dylan K. Taylor
3214da8642 pthreads 4.0.0 2021-11-01 21:01:59 +00:00
Dylan K. Taylor
f827a555d5 Merge branch 'stable' 2021-11-01 18:13:24 +00:00
Dylan K. Taylor
19e5775f6b Merge commit 73dc0598e4 2021-11-01 17:40:06 +00:00
Dylan K. Taylor
804fb3f603 Merge commit 141fbde660 2021-11-01 17:39:40 +00:00
Dylan K. Taylor
6175b03433 Merge commit 69952ae2af 2021-11-01 17:36:34 +00:00
Dylan K. Taylor
a78248a19c Merge commit '71f2a34616961d6328f06fd911b6d4450a61643e' 2021-11-01 17:33:02 +00:00
Dylan K. Taylor
4d4362801f AvailableCommandsPacket: remove dead code 2021-11-01 17:01:26 +00:00
Dylan K. Taylor
0babe0a1ab LevelDB: remove unused private method 2021-11-01 16:55:05 +00:00
Dylan K. Taylor
d696ebcda3 Level: do not use static:: to access levelIdCounter
the field is private.
2021-11-01 16:52:27 +00:00
Dylan K. Taylor
c3768b997a Updated to pmmp/BedrockProtocol@146498c279 2021-11-01 16:13:33 +00:00
Dylan K. Taylor
9f5c16bc46 Projectile: use closure instead of do/while for reading id/data of block
not ideal, but whatever I guess... this at least provides scope isolation
2021-11-01 15:56:28 +00:00
Dylan K. Taylor
8865bb73ba BanEntry: remove useless do/while 2021-11-01 15:52:55 +00:00
Dylan K. Taylor
2dee1dbc28 Remove ridiculous code in ResourcePackManager 2021-11-01 15:41:21 +00:00
Dylan K. Taylor
0f0b6f0efa Utils: eliminate usages of backtick operator 2021-11-01 15:25:56 +00:00
Dylan K. Taylor
d5f13d8be2 Timezone: make PHPStan 1.0 happy 2021-11-01 15:24:16 +00:00
Dylan K. Taylor
27ae959e89 Terminal: backport shell_exec() code from PM4 to make PHPStan 1.0 happy 2021-11-01 15:23:36 +00:00
Dylan K. Taylor
f8f39687e2 Achievement: declare proper type for $list static property 2021-11-01 15:22:33 +00:00
Dylan K. Taylor
94737934de PlayerDeathEvent: fixed LSP violation reported by PHPStan 1.0 2021-11-01 14:17:54 +00:00
Dylan K. Taylor
616eb0050d World: remove premature optimisation of setBlockAt() introduced by ece28e5d7b
closes #4531
it turns out that letting the light updates themselves handle this is faster than trying to get in the way.
2021-11-01 02:34:44 +00:00
Dylan K. Taylor
9d30bc8b95 World: fixed assertion failure when requesting, cancelling, and then re-requesting chunks via requestChunkPopulation()
if the request/cancel/re-request happens all in the time before the queue gets drained, chunk hashes may appear multiple times in the queue. We don't want to process them twice if this happens (although it's mostly harmless anyway).
2021-11-01 02:17:11 +00:00
Dylan K. Taylor
46b7d35cd3 Player: return from callback if used chunk status is not REQUESTED_GENERATION()
this can happen especially on large render distances when flying fast and changing direction - we decide we don't want the chunk, then, after changing direction and re-ordering chunks, we decide we do want it again, and end up registering a second callback. In this case, we need to ensure that only one of the callbacks gets executed (it doesn't matter which one).
2021-11-01 01:45:49 +00:00
Dylan K. Taylor
c781efcf90 World: avoid calling the same logic twice in requestChunkPopulation()
orderChunkPopulation() checks the preconditions too. Have them both call an internal function that doesn't.
2021-11-01 00:36:57 +00:00
Dylan K. Taylor
e4a54f5b6a World: deduplicate code in request/orderChunkPopulation 2021-11-01 00:33:18 +00:00
Dylan K. Taylor
afb54f1ae4 World: flip orderChunkPopulation() condition around
this makes it more obvious that the code is similar to requestChunkPopulation() barring one distinct difference.
2021-11-01 00:25:30 +00:00
Dylan K. Taylor
8f803df511 World: check population locks _after_ checking if the chunk is already populated, not before
this led to another case where a population request would be queued up for an already-populated chunk for no reason.
2021-10-31 23:54:27 +00:00
Dylan K. Taylor
f4a3c40b5c World: use better variable names in orderChunkPopulation() 2021-10-31 23:48:00 +00:00
Dylan K. Taylor
9dec82cdbc World: fixed requestChunkPopulation() queuing requests for chunks which are already populated
this led to chunk sending getting bogged down if there were more than population-queue-size chunks waiting to be generated.
2021-10-31 23:40:34 +00:00
Dylan K. Taylor
74031d2fbe World: remove the fulfilled promise from the population request map
fixes crash when unregistering chunk loaders
2021-10-31 23:05:12 +00:00
Dylan K. Taylor
bd60e41268 Revert "Revert "Player: do not re-request the same ungenerated chunks multiple times""
This reverts commit 3265d3f6b4.
2021-10-31 22:57:56 +00:00
Dylan K. Taylor
96cfdc79b8 World: fixed original promise not getting fulfilled if the chunk became populated=true after a promise was already made (but not fulfilled) to populate it
this could happen if a plugin calls setPopulated(true) on a chunk after a request for its population landed in the queue, but before it actually got processed. In that case, the promise would never get fulfilled.
2021-10-31 22:54:37 +00:00
Dylan K. Taylor
2fa0a914ff World::orderChunkPopulation() may return a pre-resolved promise
this does not indicate a failure; it indicates that the chunk has already been successfully populated.
In this case, we shouldn't be putting the task back on the queue.

This is skirting around the real bug, which is that requestChunkPopulation() doesn't check if the target chunk is already populated before it creates a new promise that it will be.
2021-10-31 22:51:37 +00:00
Dylan K. Taylor
08636d079d Promise: expose isResolved() 2021-10-31 22:48:52 +00:00