709 Commits

Author SHA1 Message Date
Dylan K. Taylor
aa56c66a3c
ProcessLoginTask: drop usage of no-op method
this is no longer useful since 8.0.
2021-12-16 18:46:34 +00:00
Dylan K. Taylor
d487e43766
InGamePacketHandler: fixed block breaking borked by enabling PlayerAuthInputPacket 2021-12-15 04:01:40 +00:00
Dylan K. Taylor
292827a311
Switch to PlayerAuthInputPacket for movement handling
sticking with the non-rewind version for now, for simplicity's sake.

We do want the rewind version at some point for server side knockback, but that's a job for later.

For now, using this packet fixes various problems with slightly-incorrect positions and rotations (e.g. AimTP no longer requires you to jump to get the exact correct rotation; previously it would hit the wrong block at long distances due to errors of a fraction of a degree due to the client not sending its position.

Note that this might cause some performance degradation since the packet is sent every tick. This has yet to be assessed, but the advantages offered are undeniable in any case.
2021-12-09 13:53:53 +00:00
Dylan K. Taylor
889d048ca3
Make use of Utils::assumeNotFalse() in a bunch of places
I've stuck to only doing this in the places where I'm sure we should never get false back. Other places I'm less sure of (and I found more bugs along the way).
2021-12-08 19:39:04 +00:00
Dylan K. Taylor
8b73549355
Use JSON_THROW_ON_ERROR for json_encode() and json_decode() 2021-12-08 19:14:07 +00:00
Drew B
ce54d268f2
Player: allow controlling client-sided block collisions irrespective of Spectator Mode (#4563)
- Added the following API methods:
  - `Player::hasBlockCollision()`
  - `Player::setHasBlockCollision()`

This enables spectator-like noclip behaviour in other gamemodes (could be useful for builders).
2021-12-06 21:14:22 +00:00
Dylan K. Taylor
aea124af74
Fix inconsistent class name 2021-11-30 19:17:26 +00:00
Dylan K. Taylor
8620e67d88
Protocol changes for 1.18.0 2021-11-30 19:16:38 +00:00
Covered123
eb0cf52d81
Remove useless code (#4590) 2021-11-23 17:09:33 +00:00
Dylan K. Taylor
269231c228
Ban foreach(arrayWithStringKeys as k => v)
this is not as good as phpstan/phpstan-src#769 (e.g. array_key_first()/array_key_last() aren't covered by this, nor is array_rand()) but it does eliminate the most infuriating cases where this usually crops up.
2021-11-15 22:52:05 +00:00
Dylan K. Taylor
c7beb0a702
Clean up inventory auto close mess from PM3
on PM3 there was no concept of 'current window', we had no idea which window the player was actually looking at.
2021-11-08 23:51:25 +00:00
Dylan K. Taylor
6efb1db107
Fixed inventories not working after dying with inventory open
closes #4185
closes #4177
2021-11-08 23:04:00 +00:00
Dylan K. Taylor
6fdcfb01c8
Seal up main inventory open/close logic inside InventoryManager where it belongs 2021-11-08 22:58:06 +00:00
Dylan K. Taylor
93a1e84ad9
TypeConverter: further simplification 2021-11-08 20:27:53 +00:00
Dylan K. Taylor
c33f97ae41
TypeConverter: clean up absurdly overcomplicated bullshit in createInventoryAction() 2021-11-08 20:18:19 +00:00
Dylan T
cc4bb91fcb
Implemented IPv6 support (#4554) 2021-11-08 20:03:28 +00:00
Dylan K. Taylor
c6c992a1f0
Preparations for negative Y support 2021-11-08 17:28:22 +00:00
Dylan K. Taylor
45edb94607
Crafting tables now work the same way as anvils and enchanting tables
Removing almost all special-case logic for crafting tables.
2021-11-07 16:20:07 +00:00
Dylan K. Taylor
d9d37f7fa6
ResourcePacksPacketHandler: fixed a mistake from c773e43eda0da159b181ef1c79f29a6c8986e697
fixes #4557

Note: you may need to clear your local pack cache in order to get it working again.
2021-11-06 16:45:14 +00:00
Hashim
f066199971
Implement emote support (#4523) 2021-11-02 23:04:55 +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
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
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
c3768b997a
Updated to pmmp/BedrockProtocol@146498c279 2021-11-01 16:13:33 +00:00
Dylan K. Taylor
bd60e41268
Revert "Revert "Player: do not re-request the same ungenerated chunks multiple times""
This reverts commit 3265d3f6b4d6705276b56fab5f765e2f97b5d992.
2021-10-31 22:57:56 +00:00
Dylan K. Taylor
3265d3f6b4
Revert "Player: do not re-request the same ungenerated chunks multiple times"
This reverts commit 866020dfdb06434b4f361a4a0f0faf7a89c30ed2.

For some fucking reason this broke resending chunks in some cases (and
sending chunks at all in others). I don't have time to debug this right
now, so it's going to have to remain broken, infuriatingly enough.
2021-10-31 21:25:21 +00:00
Dylan K. Taylor
866020dfdb
Player: do not re-request the same ungenerated chunks multiple times
this doesn't affect chunk resends, since they'll be kicked back to NEEDED, which is detected by orderChunks().
2021-10-31 18:52:37 +00:00
Dylan K. Taylor
c580bb2434
InGamePacketHandler: mark player as not using item in more cases
fixes #4355
2021-10-31 14:41:31 +00:00
Dylan K. Taylor
88b7389080
InventoryManager: reduce code duplication 2021-10-29 15:37:52 +01:00
Dylan K. Taylor
5db3915aad
Make MemoryManager aware of ChunkCache 2021-10-28 20:28:00 +01:00
Dylan K. Taylor
eb40b741ae
StandardPacketBroadcaster now splits broadcasts by session-specific PacketSerializerContext
in the normal case, all sessions will share the same PacketSerializerContext and Compressor, so this code will be the same as before
However, for the multi-protocol hackers out there, this should reduce the maintenance burden (@Driesboy) since now only the PacketSerializerContext needs to be maintained. I recommend a separate PacketSerializerContext for each protocol (perhaps put the protocol version in the serializer context too, if you need it for some reason).
2021-10-28 20:15:37 +01:00
Dylan K. Taylor
0ef5c67b9b
Use static constructor for MovePlayerPacket
this marks the last of the packets created using the old way.
2021-10-27 21:10:16 +01:00
Dylan K. Taylor
04aedc6494
Updated BedrockProtocol 2021-10-23 23:54:49 +01:00
Dylan K. Taylor
c77829f4ad
Migrate packet creation to use ::create() methods in all but one case
MovePlayerPacket doesn't yet have a ::create() due to a complication with fields that aren't always present.
2021-10-23 01:46:01 +01:00
Dylan K. Taylor
c773e43eda
Updated BedrockProtocol to pmmp/BedrockProtocol@97fa88e9ef 2021-10-23 01:16:45 +01:00
Dylan K. Taylor
80b402e529
ItemTranslator: throw the proper exceptions when failing to map network IDs 2021-10-20 14:01:39 +01:00
Dylan K. Taylor
0348236860
fucking CS again 2021-10-14 15:56:50 +01:00
Dylan K. Taylor
8c07748100
RakLibInterface: print packet exception info as a block using Utils::printableExceptionInfo() 2021-10-14 15:55:08 +01:00
Dylan K. Taylor
9b94a4661b
ItemTranslator: Use LegacyItemIdToStringMap instead of reading files directly 2021-10-11 22:17:40 +01:00
Dylan K. Taylor
e62794e4cf
TypeConverter: fixed PHPStan errors 2021-10-11 15:17:32 +01:00
Dylan K. Taylor
8ac16345a3
TypeConverter: account for items without properly mapped IDs
fixes #4459
2021-10-11 15:05:08 +01:00
Dylan K. Taylor
13178a47a5
fuck you git 2021-10-05 19:11:10 +01:00
Dylan K. Taylor
817ab88c70
Properly handle errors decoding network item NBT
since the NBT is now decoded immediately now, any incorrect NBT will cause exceptions to be thrown that we weren't handling, causing server crashes.
2021-10-05 19:10:55 +01:00
Dylan K. Taylor
5b26abcb0e
NetworkSession: fixed code copy pasta
these are not, in fact, equivalent.
2021-10-05 01:02:15 +01:00
Dylan K. Taylor
f2d6059613
NetworkSession: Sync world spawn on world change 2021-10-04 22:51:31 +01:00
Dylan K. Taylor
bb6ea8cbdc
Do not call PlayerLoginEvent during the Player constructor
this closes a lot of loopholes in the login sequence that plugins were using to cause crashes.
2021-10-04 22:36:50 +01:00
Dylan K. Taylor
356a49d225
NetworkSession: account for possibility of syncGameMode() being called before the player is ready to receive it
close #4323
2021-10-04 22:13:42 +01:00