1014 Commits

Author SHA1 Message Date
ねらひかだ
19e3d339f6
InGamePacketHandler: subtract from raw position before rounding it (#6022)
This allows better compensation for floating point errors introduced by the subtraction of the 1.62 height offset.

For example, if the player is at y=7 exactly, their Y coordinate will be reported as 8.62, which, because of floating point errors, will be something like `8.619999999`. Subtracting `1.62` from this (really something like `1.62000000000005...`) leads to the calculated Y coordinate being slightly below 7.

Rounding after subtracting this offset allows this to be rounded to 7 sharp. Similar errors appear in various other coordinates.
2023-08-29 11:43:21 +01:00
Dylan K. Taylor
4b41fca991
Merge branch 'legacy/pm4' into stable 2023-08-18 12:28:29 +01:00
Dylan K. Taylor
9f09acc079
Workaround for slot IDs not changing client side when old item == new item
this is a really dumb bug and seems similar to the armor bug I fixed a while ago.

fixes #5987

it's unlikely that #5727 will be solved by this, but one can hope...
2023-08-18 12:27:27 +01:00
Dylan K. Taylor
2559d1719f
All pocketmine\thread\Thread now log uncaught exceptions and fatal errors by default 2023-08-08 14:56:54 +01:00
Dylan T
82a5ea9ed3
Allow thread errors and their traces to be properly recorded in crashdumps (#5910)
until now, any thread crash would show as a generic crash since we aren't able to get the trace from the crashed thread directly. This uses some dirty tricks to export a partially serialized stack trace to the main thread, where it can be written into a crashdump.
This enables us to see proper crash information for async tasks in the crash archive (finally!!!) as well as being able to capture RakLib errors properly.
2023-07-26 16:26:03 +01:00
ipad54
6086ef667c
Added handling for attack-air action (#5912) 2023-07-25 14:50:28 +01:00
Dylan K. Taylor
fb43f59458
Merge branch 'stable' into minor-next 2023-07-24 16:45:49 +01:00
Dylan K. Taylor
16dfd27935
Merge branch 'legacy/pm4' into stable 2023-07-24 16:45:24 +01:00
Dylan K. Taylor
2a4909d328
Fixed missing handling for some ContainerUIIds
SMITHING_TABLE_TEMPLATE is new in 1.20
HORSE_EQUIP was always present, but somehow got overlooked when building up that big ugly switch table
2023-07-24 16:44:01 +01:00
Dylan K. Taylor
b078e01b65
JwtUtils: handle DER <-> raw signature conversion in-house, drop fgrosse/phpasn1 dependency
normally I would hesitate to reinvent the wheel, but we only need a tiny subset of the ASN.1 spec which is trivial to implement by itself.
I'd rather this than depend on another library that could introduce security vulnerabilities (I'm looking at you, jsonmapper).

closes #5935
2023-07-24 13:36:12 +01:00
Dylan K. Taylor
3afe3b7f44
Merge branch 'stable' into minor-next 2023-07-24 12:02:24 +01:00
Dylan K. Taylor
9ef835c82d
Merge remote-tracking branch 'origin/legacy/pm4' into stable 2023-07-21 11:07:32 +01:00
Dylan K. Taylor
5e7f18cbcf
StandardEntityEventBroadcaster: suppress client-side emote messages
if users want these, they can broadcast them themselves using Server::broadcastMessage(), which will also record the message in the server log like chat

closes #5669
2023-07-20 16:20:34 +01:00
Dylan K. Taylor
3c34841dfc
CS 2023-07-19 14:00:35 +01:00
Dylan K. Taylor
914dd90b3d
Use first-class closures in more places 2023-07-19 13:56:48 +01:00
Dylan K. Taylor
537721fe7d
Replace Closure::fromCallable() usages with first-class callables
PHP 8.1 <3
2023-07-19 13:34:42 +01:00
Dylan K. Taylor
b399eda21e
Merge branch 'stable' into minor-next 2023-07-14 13:27:50 +01:00
Dylan K. Taylor
489a7ba365
Merge branch 'legacy/pm4' into stable 2023-07-14 13:03:14 +01:00
Dylan K. Taylor
2709dd359c
ProcessLoginTask: fixed backport errors 2023-07-14 12:37:50 +01:00
Dylan K. Taylor
4e646d19a4
Harden login EC key validation 2023-07-14 11:55:47 +01:00
Dylan K. Taylor
0d8a06732a
Merge branch 'stable' into minor-next 2023-07-13 12:59:53 +01:00
Dylan K. Taylor
b7210755a7
1.20.10 2023-07-12 13:39:39 +01:00
Dylan K. Taylor
f2193d1ba7
1.20.10 2023-07-12 13:23:47 +01:00
Dylan K. Taylor
ef85fbffe1
Merge branch 'legacy/pm4' into stable 2023-07-11 15:10:55 +01:00
Dylan K. Taylor
0c250a2ef0
InGamePacketHandler: fixed inconsistent handling of invalid data in BlockActorDataPacket 2023-07-11 12:53:29 +01:00
BrandPVP
c01d2dc718
CreativeInventory per Player (#5694) 2023-07-06 11:08:13 +01:00
Dylan K. Taylor
a2a7006878
Merge branch 'stable' into minor-next 2023-07-01 12:25:11 +01:00
Dylan K. Taylor
24b74a96eb
Merge branch 'legacy/pm4' into stable 2023-07-01 11:52:42 +01:00
Dylan K. Taylor
249ef9c534
ProcessLoginTask: remove old key expiry
since we don't have a hard date for this, and I've already made one wrong educated guess, I'd rather not have another massive outage.
A security update will have to be made to remove the old key as soon as the new one is rolled. This is not ideal, but it's the least disruptive option.
2023-07-01 11:41:04 +01:00
Dylan K. Taylor
0240d35c05
AsyncTask and AsyncPool no longer tolerate uncaught errors in tasks
Since task execution depends on tasks executing sequentially on a particular worker in some cases (e.g. PopulationTask must be preceded by GeneratorRegisterTask), it doesn't make sense to continue task execution if an error occurs.
Moreover, a task crashing may render the whole server unstable, as it leaves the server in an undefined state. This is the same kind of problem we fixed with scheduled tasks in PM3.

In versions past, pthreads was unreliable enough that random tasks would crash without an obvious reason, forcing us to accommodate this. I still don't know the origin or frequency of said issues, but I think it's time to rip the band-aid off and solve these problems for real.
2023-06-22 13:29:36 +01:00
Dylan K. Taylor
a3046eb6fa
Merge branch 'stable' into minor-next 2023-06-13 18:06:06 +01:00
Dylan K. Taylor
ff0199cdf8
Fixed blue candle being missing from the creative inventory
this coincidentally fixes mangrove doors being tagged with unwanted blockstate runtime IDs. Their items client-side are not actually blockitems, so the client doesn't expect them to have blockstate IDs attached.
This reduces the chaos in the creative inventory slightly (for some reason the client responds to this stuff by putting random creative items in the wrong places), but the mess is still substantial and I don't know what caused the rest of it.

closes #5818

technically we shouldn't be breaking BC of internals signatures in a patch release, but it's internals, and that's an unwritten rule anyway. In any case, no one is likely to be affected.
2023-06-13 18:03:10 +01:00
ItsZodiaX
1b35c352cc
StandardEntityEventBroadcaster: Accepting PacketBroadcaster interface instead of StandardPacketBroadcaster (#5813) 2023-06-11 13:48:58 +01:00
Dylan K. Taylor
132330e16f
Merge branch 'legacy/pm4' into stable 2023-06-07 21:08:09 +01:00
Dylan K. Taylor
441f1f534f
Random change PHP-CS-Fixer wanted to make 2023-06-07 20:59:32 +01:00
Dylan K. Taylor
2538880408
1.20.0 2023-06-07 20:56:59 +01:00
Dylan K. Taylor
0ed5e94a72
Merge branch 'minor-next' into major-next 2023-05-30 16:15:56 +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
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
c66a3a8b3e
Update to Snooze 0.5.0 2023-05-23 01:09:22 +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
e0630fbb25
pmmpthread support 2023-05-20 01:29:26 +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
ee9ce8a4f4
Merge branch 'minor-next' into major-next 2023-05-17 15:45:03 +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
Dylan K. Taylor
8e6c1762d7
Merge branch 'minor-next' into major-next 2023-05-06 18:27:06 +01:00