14657 Commits

Author SHA1 Message Date
Dylan K. Taylor
ce5e663a73
Assume chunks are dirty by default
having them be clean by default makes no sense. It only makes sense for them to be clean if they were loaded directly from disk without any alterations.

Default clean is a footgun.
2023-05-29 17:22:39 +01:00
Dylan K. Taylor
c10be0f346
WorldProvider: allow loadChunk() to return additional information about the loaded chunk data
this will be needed for dealing with #5733. I don't plan to fix that before 5.0, but we need to make the appropriate BC breaks now, before release.
2023-05-29 17:03:39 +01:00
Dylan K. Taylor
f5a1a0c9cb
ÂInsert PM data version into blockstates, chunks, entities, tiles and level.dat
this information will allow us to correct for any bugs introduced by past versions.

however, we still need to propagate this information to permit actually using it when loading data.
2023-05-29 16:32:24 +01:00
Dylan K. Taylor
7f1550ef04
Revert "Stop using insecure UUIDs from non-XBL players"
This reverts commit 9baf59702bf63453d071c92150823e1a0683d025.

I forgot this is also needed for the player list, and for skin updates
to work ... this will need to be revisited
2023-05-27 18:10:55 +01:00
Dylan K. Taylor
9baf59702b
Stop using insecure UUIDs from non-XBL players
closes #4076

I opted for the minimal approach of replacing only UUIDs for non-XBL players, since most servers are using XBL anyway (as they should).
2023-05-27 18:00:54 +01:00
Dylan K. Taylor
473c062b40
Improve documentation for BlockTypeIds and ItemTypeIds 2023-05-27 17:28:36 +01:00
Dylan K. Taylor
b8ba2d03ba
Added new note instruments up to 1.19
1.20 adds extra ones for each type of mob head, but we're not supporting 1.20 yet.
2023-05-26 16:58:06 +01:00
Dylan K. Taylor
fddab29e87
Move mob head and note instrument save IDs into pocketmine\data\bedrock
to be consistent, these shouldn't be exposed in the API like this...
I'm not very happy with the whole 'type ID map' paradigm (particularly its lack of static analysis guarantees), but the most important thing right now is to get this stuff out of the API so that plugin devs don't try and abuse it. We're not going to change the whole system days before PM5 release.
2023-05-26 15:47:12 +01:00
Dylan K. Taylor
bdb0ed0701
Consistently use 'mob head' terminology in the API
previously, we were sometimes using 'mob head' and other times 'skull', sometimes even within the same file.
2023-05-26 15:08:00 +01:00
Dylan K. Taylor
edafe9d21f
Entity: Rename and document isImmobile() and friends
while I could implement server-side ability to disable entity movement, I don't think that's particularly useful. However, the intended function of this (disabling client sided AI) is useful, so it makes more sense to rename it to match its functionality, rather than changing its functionality to match the name.

closes #3130
2023-05-26 14:01:21 +01:00
Dylan K. Taylor
cc77f18ff0
ÂBlock: added a TODO for getStateId() 2023-05-25 17:38:39 +01:00
Dylan K. Taylor
ffe3556be1
Block: XOR state data with type ID, improve hash distribution
since most blocks have no state data, their lower 8 bits of state data were all zero.
This makes state IDs a bit more distributed for minimal cost.

I considered flipping these around and using type ID in the lower bits directly, but this worsened distribution for walls.

In the worst case, largest number of collisions drops from 11 to 5 with this change, and the number of states with unique hash keys increased from 3518 to 4461 (out of 7638). This is still a long way from perfect, but it's a decent improvement, improving the overall load factor from 1.6 to 1.3.

related to #5604
2023-05-25 16:35:45 +01:00
Dylan K. Taylor
2ebf8757c1
5.0.0-BETA5 is next 2023-05-23 01:53:00 +01:00
Dylan K. Taylor
1c69116717
Release 5.0.0-BETA4 2023-05-23 01:52:57 +01:00
Dylan K. Taylor
9d9c628acd
Mark AsyncPoolWorkerEntry as @internal 2023-05-23 01:32:44 +01:00
Dylan K. Taylor
cbda24d77e
Consolidate worker data under AsyncPoolWorkerEntry
instead of having a bunch of arrays... this improves the system integrity and makes it less obnoxious to look at
2023-05-23 01:31:25 +01:00
Dylan K. Taylor
ed64eac76f
... 2023-05-23 01:21:30 +01:00
Dylan K. Taylor
c66a3a8b3e
Update to Snooze 0.5.0 2023-05-23 01:09:22 +01:00
Dylan K. Taylor
4aba9d9725
Absorb pocketmine/classloader into the core code
the only use for this class is to facilitate random runtime plugin loading, and it's not complete even for that purpose.

Since nothing but PM uses pocketmine/classloader anyway, it doesn't make sense to have it outside the core. As with LogPthreads, it's just adding more maintenance work.
2023-05-22 22:52:48 +01:00
Dylan K. Taylor
69273f3ff7
AsyncTask::setResult(): permit returning ThreadSafe objects to the main thread
this is now supported thanks to the object rescue feature implemented in pthreads 5.1, making returning of thread-safe values from async tasks possible.
This needs to be explicitly supported, since otherwise it will attempt to serialize them, which isn't supported anymore.
2023-05-21 16:37:41 +01:00
Dylan K. Taylor
fdb724c646
ItemSerializer: change exception type 2023-05-20 18:58:59 +01:00
Dylan K. Taylor
3109a179db
... 2023-05-20 18:56:28 +01:00
Dylan K. Taylor
5afeeb8f89
Remove nonsensical code from block and item serializers
At the time when I wrote this code, I was still in the head space of the kind of ID hijacking that PM4 plugins do to override built-in blocks.

However, this kind of internal ID reuse makes no sense in PM5, since said IDs are only used in the core itself at runtime to identify types and states.

Even if we were to allow overriding block deserializers, overriding serializers makes no sense whatsoever, since the original block would continue to exist and be accessible.
There is a case to be made to allow overriding the deserializer, but not for the serializer.
2023-05-20 18:55:36 +01:00
Dylan K. Taylor
097feba4d5
Absorb pocketmine/log-pthreads into PM core
this was previously part of the abandoned package pocketmine/spl. It had to be separated in the PM3 days, because RakLib depended on it.

Since RakLib 0.13, RakLib stopped being dependent on or aware of pthreads, so it no longer depends on any thread-related packages.
It's also possible to absorb pocketmine/snooze and pocketmine/classloader back into the core with this in mind.
2023-05-20 16:57:24 +01:00
Dylan K. Taylor
3116fb8187
... 2023-05-20 01:47:50 +01:00
Dylan K. Taylor
e0630fbb25
pmmpthread support 2023-05-20 01:29:26 +01:00
BrandPVP
8245cfab0e
PlayerDeathEvent: add ability to set message displayed on the death screen (#5726) 2023-05-19 16:18:18 +01:00
Dylan K. Taylor
8454076235
WaterCauldron: remove more repeated code 2023-05-19 15:45:12 +01:00
Dylan K. Taylor
4a3843a881
WaterCauldron: reduce code repetition 2023-05-19 15:40:04 +01:00
ipad54
b8a1b32461
Fixed late property initializing in UnknownBlock (#5755) 2023-05-18 19:53:37 +01:00
Dylan K. Taylor
9c82507168
Merge remote-tracking branch 'origin/stable' into minor-next 2023-05-18 14:20:22 +01:00
ShockedPlot7560
db95bf8b9b
Caching creative inventory entries (#5703)
Due to the high cost of Item::serializeCompoundTag(), it's very costly to rebuild this every time we need it. This is sent during the pre-spawn step, where we need to minimize costs as much as possible.
2023-05-18 14:11:28 +01:00
Dylan K. Taylor
edcf0f8405
5.0.0-BETA4 is next 2023-05-17 19:47:42 +01:00
Dylan K. Taylor
b8abe34904
Release 5.0.0-BETA3 2023-05-17 19:47:42 +01:00
Dylan K. Taylor
7ac74180c9
Merge branch 'stable' into major-next 2023-05-17 19:46:50 +01:00
Dylan K. Taylor
6186fc0bfe
4.21.1 is next 2023-05-17 16:45:35 +01:00
Dylan K. Taylor
ef40934d24
Release 4.21.0 2023-05-17 16:45:32 +01:00
Dylan K. Taylor
ee9ce8a4f4
Merge branch 'minor-next' into major-next 2023-05-17 15:45:03 +01:00
Dylan K. Taylor
59ca7b75e1
Fixed PHPStan error 2023-05-17 15:32:38 +01:00
Dylan K. Taylor
9621836e36
Clean up confusing mess around block and item overriding
right now, I don't see an obvious reason to do this. If it turns out I was wrong later on, we can add functionality back, but we can't remove functionality after release.
2023-05-17 15:21:49 +01:00
Dylan K. Taylor
c7dff9ea40
bootstrap: remove ext-parallel bootstrapping code
I have no intention of using parallel, so this code is not necessary.
2023-05-17 14:11:43 +01:00
Dylan K. Taylor
043350753b
Drop PHP 8.0, 8.1 is now minimum version 2023-05-17 13:53:57 +01:00
Dylan K. Taylor
5a0cde49cc
AsyncPool: do not double-check progress updates on finished tasks
checkProgressUpdates is called directly before onCompletion, so we only need to call it again if the task isn't finished yet.
2023-05-16 23:37:58 +01:00
Dylan K. Taylor
008a022ec1
Players now have finite resources in spectator mode
this seems like the logical solution for the block picking issues.
2023-05-16 23:02:33 +01:00
Dylan K. Taylor
5c85a7c306
Merge remote-tracking branch 'origin/stable' into minor-next 2023-05-16 22:54:53 +01:00
Dylan K. Taylor
599c4284f5
Introduce 10 KB threshold for async compression
due to the extremely large performance cost of instantiating AsyncTasks, it's usually not worth bothering with async compression except for very large packets.
While this large overhead can be significantly reduced by using specialized threads, it's early days in the testing stages for such improvements, and for now, we still have this to deal with.

Since async compression is always used prior to player spawn, this change may slightly improve the performance of the pre-join stage of the game.
2023-05-16 22:54:06 +01:00
Dylan K. Taylor
9499e2e595
always the CS... 2023-05-16 14:22:03 +01:00
Dylan K. Taylor
a4fea1444a
Remove validateCallableSignature() calls from network hot paths
we rely on phpstan for validation of this internally, and plugins shouldn't be calling these methods anyway.
this significantly reduces the overhead of CompressBatchPromise.
2023-05-16 14:21:32 +01:00
Dylan K. Taylor
c9bb4335a1
Item: added getStateId(), removed state data from public API
state data was only used for indexing stuff along with state ID anyway, so it makes more sense to lock it away in here instead.
2023-05-16 14:14:18 +01:00
Dylan K. Taylor
015c668885
Change confusing 'type data' and 'state data' terminology for blocks and items
For blocks, we now use 'block-item state' and 'block-only state', which should be much clearer for people implementing custom stuff.
'block-item state', as the name suggests, sticks to the item when the block is acquired as an item.
'block-only state' applies only to the block and is discarded when the block is acquired as an item.

'type data' for items was also renamed, since 'type' is too ambiguous to be anything but super confusing.
2023-05-16 14:07:29 +01:00