1013 Commits

Author SHA1 Message Date
Dylan K. Taylor
33d1203bfd Player: move sendAllInventories() to network layer 2019-05-26 15:58:03 +01:00
Dylan K. Taylor
85718e2750 Clean up a bunch of garbage in Furnace 2019-05-26 15:43:46 +01:00
Dylan K. Taylor
3ea8da2dd3 Use EnumTrait->equals() instead of direct comparison
It's not guaranteed that objects provided are the same as those in the enum registry, so they can't be directly compared.

Implementing comparison with === would require some kind of __equals() implementation or an extension to hook into such functionality.
2019-05-24 17:21:44 +01:00
Dylan K. Taylor
c21a25efb9 move more rollback handling to network handlers, out of Player 2019-05-20 16:13:14 +01:00
Dylan K. Taylor
bca0833035 Clean up handling of armour sync 2019-05-19 16:56:10 +01:00
Dylan K. Taylor
67affcea32 move more packet logic to net session
it seems like net session is turning into a giant dumping ground for sending API ... this needs to be cleaned up somehow.
2019-05-19 15:48:01 +01:00
Dylan K. Taylor
c3c2dd3988 Rename SimpleSessionHandler -> InGameSessionHandler
the "simple" name comes from the early days of this refactor before I started splitting everything up into their own units. This handler is now in good enough condition to have a proper name.
2019-05-18 19:13:41 +01:00
Dylan K. Taylor
fa9fcea189 SimpleSessionHandler: Do not read blocks from world in onFailedBlockAction()
the world will do this anyway, so we can reduce our code burden here.
2019-05-18 19:11:23 +01:00
Dylan K. Taylor
b11d3b0401 CraftingDataPacket: Fixed uncaught exception in decode
this is not exploitable because it's not a serverbound packet, but it should be fixed nonetheless.
2019-05-18 17:19:44 +01:00
Dylan K. Taylor
6de0b48c1f PacketBatch: Always encode packets freshly, never reuse buffers
this causes bugs when a packet is modified during events and then re-sent to a player. Since we can't control this, we can't allow this kind of buffer reuse.

The only notable case where this will cause loss of performance is when broadcasting a series of packet(s) which accumulate to less than 256 bytes, which is reasonably cheap to encode anyway.
In addition, removing this caching is one roadblock to moving this serialization to native code, which will make it vastly faster.
2019-05-17 18:04:51 +01:00
Dylan K. Taylor
51a8c2be9d Player: Move rollback responsibility to network for interact/break block
Custom player implementations might not need rollbacks (f.e. Specter).
2019-05-09 14:54:56 +01:00
Dylan K. Taylor
a331c5e13f Player: reduce SetTitlePacket creation boilerplate
it's better to encapsulate all this logic in one place so that third party developers can more easily understand this, and also to reduce the amount of crap we have in Player.
2019-05-08 16:43:05 +01:00
Dylan K. Taylor
c1a483a36d move entity spawning logic back to Player 2019-05-07 18:35:04 +01:00
Dylan K. Taylor
d7a7ab5102 Move Entity despawn logic back to Player
this is not network-session specific, and different implementations will need to do this.
2019-05-07 18:01:23 +01:00
Dylan T
3cd6e12e71
Renaming "Level" -> "World" (#2907)
This has been a pain point for a long time due to the misleading nature of the name "level". It's also confusing when trying to do things like getting the XP level of the player or such, and also does not translate well to other languages.

This transition was already executed on the UI some time ago (language strings) and now it's time for the same change to occur on the API.

This will burn a lot of plugins, but they'll acclimatize. Despite the scary size of this PR, there isn't actually so many changes to make. Most of this came from renaming `Position->getLevel()` to `Position->getWorld()`, or cosmetic changes like changing variable names or doc comments.
2019-05-07 14:47:28 +01:00
Dylan K. Taylor
427e334426 rename PacketStream to PacketBatch 2019-05-06 19:58:02 +01:00
Dylan K. Taylor
ce61c6e0fd PacketStream: added fromPackets() sugar 2019-05-06 19:54:42 +01:00
Dylan K. Taylor
3415edf600 PacketStream: add @throws 2019-05-06 17:46:37 +01:00
Dylan K. Taylor
c2771eba88 use the appropriate API for decoding packet batches 2019-05-06 17:46:17 +01:00
Dylan K. Taylor
82974e0271 NullSessionHandler: possibly premature optimization 2019-05-06 17:28:56 +01:00
Dylan K. Taylor
685481b172 NetworkSession: improve GC performance without crashing everything
this is necessary because some handlers have circular references to the session, which causes GC lag collecting them. This change allows them to be collected immediately without nuking internal state.
2019-05-06 16:43:05 +01:00
Dylan K. Taylor
5250a432d1 NetworkSession: add a dedicated PrefixedLogger, clean up some boilerplate code 2019-05-06 16:32:34 +01:00
Dylan K. Taylor
7ae84944ca protocol: add some missing interfaces for new packets 2019-05-02 17:35:54 +01:00
Dylan K. Taylor
af07ffb292 Merge branch 'next-minor' 2019-05-02 16:44:50 +01:00
Dylan K. Taylor
67e75d6c0a Moved DataPropertyManager to network namespace
this is _extremely_ network-focused code.
2019-04-26 18:57:44 +01:00
Dylan K. Taylor
854a2f5135 Move a giant heap of network garbage out of Entity 2019-04-26 18:52:38 +01:00
Dylan K. Taylor
00644dd529 Fixed an edge-case in AvailableCommandsPacket decoding 2019-04-26 12:32:42 +01:00
Dylan K. Taylor
b6b3dcc1aa Improve documentation of SourceInterface and AdvancedSourceInterface 2019-04-26 11:59:10 +01:00
Dylan K. Taylor
7d712d68c4 Merge branch 'stable' 2019-04-25 18:31:22 +01:00
Dylan K. Taylor
3c941dd992 Move more stuff to BedrockData submodule 2019-04-25 18:23:31 +01:00
Dylan K. Taylor
2bdbb9794c New, more efficient blockstate table format
this reduces the file size by ~90%.
2019-04-25 17:28:22 +01:00
Dylan K. Taylor
898009a91b Sync crafting data changes
this seems to fix #2881, at least the reproducing case that was given.
2019-04-25 16:22:12 +01:00
Dylan K. Taylor
c5ca623124 Merge branch 'stable' 2019-04-25 15:27:13 +01:00
Dylan K. Taylor
a3dea09e2a sync with latest codegen changes 2019-04-25 15:19:15 +01:00
Dylan K. Taylor
793f93afdb NetworkSession: sync with latest code generation changes 2019-04-25 14:49:20 +01:00
Dylan K. Taylor
64506ea3ae PacketPool: add @throws 2019-04-25 14:48:55 +01:00
Dylan K. Taylor
4a35516441 Reduce BatchPacket hacks
we can't get rid of these hacks entirely because BAcKWARdS ComPaTIbilitY, but this at least ensures that things over PID 127 won't burn the house down when 1.12 gets here. This also reduces conflicts with 4.0 line.
2019-04-25 14:48:36 +01:00
Dylan K. Taylor
fa70127241 1.11.0 protocol changes 2019-04-24 19:54:16 +01:00
Dylan K. Taylor
fc76d04dcb StartGamePacket: allow specifying a custom runtimeID table
this is not the intended goal, but it's a happy side effect of making it easier to extract structured information from the client.
2019-04-24 18:40:29 +01:00
Dylan K. Taylor
0dac982f16 Merge branch 'stable' 2019-04-21 16:56:53 +01:00
Dylan K. Taylor
db896b9faf ok i'm done
i am obviously not in any fit state to be doing this today...
2019-04-21 14:22:54 +01:00
Dylan K. Taylor
76c234e4e6 add some limits on batches 2019-04-21 14:16:38 +01:00
Dylan K. Taylor
86cc151e60 Revert "Network: Each interface now keeps its own statistics"
This reverts commit 7720a0534e3c4f0dcc70cf3fbc12699de6f04374.
2019-04-18 15:45:03 -04:00
Dylan K. Taylor
7720a0534e Network: Each interface now keeps its own statistics
this allows more detailed analysis.
2019-04-18 19:57:40 +01:00
Dylan K. Taylor
752e398970 AsyncTask: TLS now supports storing multiple values (now requires a key/value pair) 2019-04-18 18:58:31 +01:00
Dylan K. Taylor
a4c7ec077b Fixed possible crash in ChunkRequestTask 2019-04-18 17:45:14 +01:00
Dylan K. Taylor
939dfd9269 First look at separating chunk sending from Level 2019-04-17 19:33:37 +01:00
Dylan K. Taylor
3468f006a2 Use AsyncTask->onError() for chunk task crash tracking 2019-04-17 16:00:17 +01:00
Dylan K. Taylor
209ae51a67 Merge branch 'stable' 2019-04-15 16:11:49 +01:00
Dylan K. Taylor
cfd4580388 sync NBT network string length cap 2019-04-14 17:14:44 +01:00