747 Commits

Author SHA1 Message Date
Dylan K. Taylor
2e3940e8f5 NetworkSession: remove circular dependency between queueCompressed() and flushSendBuffer()
this cycle makes the code fragile and prone to infinite looping bugs when modified, as well as making the code harder to follow.
2020-10-11 12:22:59 +01:00
Dylan K. Taylor
15a2fd6e4f LegacySkinAdapter: check return value of json_encode() for resource patch 2020-10-08 21:42:07 +01:00
Dylan K. Taylor
b0b08d45d5 Entity: clean up sendData() handling, remove send-to-self hack 2020-10-08 21:35:36 +01:00
Dylan K. Taylor
01b44ab0bc protocol: moved skin data types to their own namespace 2020-10-08 21:20:57 +01:00
Dylan K. Taylor
94c58c00b5 NetworkSession: Restore PM3 unexpected XUID handling behaviour (removes XUID instead of kicking the player)
close #3861, close #3089
2020-10-08 14:36:07 +01:00
Dylan K. Taylor
d8ee657d20 MoveActorAbsolutePacket: added ::create() method 2020-10-06 18:34:38 +01:00
Dylan K. Taylor
69cad3e694 InGamePacketHandler: Ignore LevelSoundEventPacket completely 2020-10-06 18:26:57 +01:00
Dylan K. Taylor
d7f7e1c4ff InventoryManager: remove useless repeated code 2020-10-06 18:14:46 +01:00
Dylan K. Taylor
15eac8a65a NetworkSession: renamed some instructions to imperative instead of onWhatever()
these aren't listening to events, they are telling the client that an event has taken place.
2020-10-06 18:06:48 +01:00
Dylan K. Taylor
7ef794d725 imports cleanup 2020-10-04 18:22:07 +01:00
Dylan K. Taylor
d3a3a41d2b Revert back to separated floor/wall sign
the conditionally useless properties are problematic.
2020-10-04 17:52:23 +01:00
Dylan K. Taylor
3b4e9eea96 RuntimeBlockMapping: drop useless doc comment 2020-09-25 17:43:00 +01:00
Dylan K. Taylor
7c192f85e2 protocol: remove final remaining Vector3 mutations
this really should be replaced with a network layer BlockPos structure in the absence of a general int-vector structure in math.
2020-09-25 17:41:12 +01:00
Dylan K. Taylor
716de4d9d6 ChunkCache: we have no business autoloading chunks during sending
if the chunk isn't loaded, this is a bug and it should crash.
2020-09-20 13:32:54 +01:00
Dylan K. Taylor
5096741b29 World::getChunk() behaviour now matches that of a regular ChunkManager
Various bugs existed for a while with stuff using chunk managers instead of worlds when interacting with terrain due to a behavioural inconsistency between World::getChunk() (return from cache or load from disk), and SimpleChunkManager::getChunk() (return from cache only). This change brings the two in line.
World::getOrLoadChunk() has been added as a replacement, which has the same behaviour as the old getChunk() and also makes it more obvious that there is an issue with code using it during refactoring.
2020-09-20 13:29:09 +01:00
Dylan K. Taylor
5661d0496f RuntimeBlockMapping::toRuntimeId() now accepts a single integer instead of id/meta
the expectation is that eventually this will receive arbitrary internal runtime IDs instead of static id/meta, and RuntimeBlockMapping doesn't really care about this crap anyway.
2020-09-20 12:16:11 +01:00
Dylan K. Taylor
be0cec531a ResourcePackInfoEntry: remove useless null coalesce operators
these fields are never null.
these errors aren't reported unless bleeding-edge is enabled.
2020-09-06 16:13:41 +01:00
Dylan K. Taylor
a35ca1fa71 Merge branch 'stable' into master 2020-08-15 20:32:14 +01:00
Dylan K. Taylor
98db4c5200 Merge branch 'stable' into master
# Conflicts:
#	.gitmodules
#	composer.lock
#	resources/vanilla
#	src/network/mcpe/protocol/PlayerAuthInputPacket.php
#	src/pocketmine/Player.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
2020-08-10 17:55:49 +01:00
Jack Honour
ff2a3baa8e
Implemented Jukebox & Records (#3742)
Co-authored-by: Dylan K. Taylor <odigiman@gmail.com>
2020-08-07 21:07:58 +01:00
Dylan K. Taylor
e1d80f05b1 Merge branch 'stable' into master 2020-08-03 20:14:46 +01:00
Dylan K. Taylor
1525001565 protocol ItemStack: added equals() method to compare net itemstacks directly
this will be needed for more than just this little check once item NBT gets cleaned out properly, since we'll need to compare object equality by network layer stuff instead of internals (where different network objects might deserialize to the same internal items).
2020-08-02 23:22:39 +01:00
Dylan K. Taylor
1500668d4e imports cleanup 2020-07-25 19:21:22 +01:00
Dylan K. Taylor
5910905e95 PacketBatch::getPackets() may throw PacketDecodeException 2020-07-22 15:38:24 +01:00
Dylan K. Taylor
8402465fd2 PacketBatch is now immutable 2020-07-22 15:37:06 +01:00
Dylan K. Taylor
798efc370c PacketBatch: get rid of putPacket() 2020-07-22 15:24:08 +01:00
Dylan K. Taylor
2fcee432c1 NetworkSession: store Packet[] for buffering instead of PacketBatch
this reduces memory allocations for buffering (in theory).
2020-07-22 15:18:01 +01:00
Dylan K. Taylor
ed144a1709 remove unused imports 2020-07-21 19:29:12 +01:00
Dylan K. Taylor
93e6d7e1a2 thanks for nothing phpstorm 2020-07-21 19:23:30 +01:00
Dylan K. Taylor
bc52a38922 Improved network bandwidth data collection 2020-07-21 19:21:27 +01:00
Dylan K. Taylor
92afad5e6f Updated RakLib to pmmp/RakLib@6fbccdb6a7 2020-07-21 16:18:14 +01:00
Dylan K. Taylor
1ba32c98c7 protocol: avoid potential constructor refactoring packet decode bug
if the order of the constructor parameters were changed, it would cause these statements to be reordered, causing packet fields to be decoded in the wrong order.
2020-07-17 23:19:33 +01:00
Dylan K. Taylor
d9c3ec5f91 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2020-07-11 20:14:42 +01:00
Dylan K. Taylor
279abb871d Remove all usages of CompoundTag->hasTag()
in pretty much every case, these usages really wanted to read the tag's contents anyway, which can be combined with a getTag() and instanceof call for more concise and static analysis friendly code.
In the few cases where the tag contents wasn't needed, it still wanted to check the type, which, again, can be done in a more static analysis friendly way by just using getTag() and instanceof.
2020-07-10 21:01:43 +01:00
Dylan K. Taylor
600ef033ab PlayerSkinPacket: added ::create() 2020-07-09 13:24:31 +01:00
Dylan K. Taylor
b22cc4875e Player: Accept NBT data in constructor, instead of asking for it from the server directly
this allows custom implementations to provide custom data to the constructor (or none at all).
2020-07-09 13:09:46 +01:00
Dylan K. Taylor
ad99dc5884 ChunkSerializer micro optimisation: reduce indirections when writing runtime IDs 2020-07-05 22:00:42 +01:00
Dylan K. Taylor
ae179e5039 fix interacting with anvil & enchanting table inventories 2020-07-04 23:46:26 +01:00
Dylan K. Taylor
d840e8c4d4 Merge commit 'a34f3261c'
# Conflicts:
#	resources/vanilla
#	src/event/entity/EntityExplodeEvent.php
#	src/pocketmine/event/block/SignChangeEvent.php
#	src/utils/Utils.php
2020-07-04 22:39:40 +01:00
Dylan K. Taylor
c35a596079 Merge commit '8ce0022de'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/types/inventory/NetworkInventoryAction.php
2020-07-04 22:34:01 +01:00
Dylan K. Taylor
172830fc44 Merge commit '8cf025a2d'
# Conflicts:
#	resources/vanilla
2020-07-04 22:20:42 +01:00
Dylan K. Taylor
e9eadd3a26 Merge commit '8480ee82e'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
#	src/pocketmine/block/CraftingTable.php
2020-07-04 22:19:43 +01:00
Dylan K. Taylor
cf5e31c619 InventoryTransaction::execute() now throws exceptions instead of returning true/false 2020-07-01 14:08:28 +01:00
Dylan K. Taylor
30591d047c PacketBatch: added a getPackets() method which encapsulates some logic 2020-07-01 13:38:06 +01:00
Dylan K. Taylor
29612cded3 CraftingTransaction: make CraftingManager injectable
this becomes a bit easier to unit-test.
2020-07-01 13:38:06 +01:00
Dylan K. Taylor
670ad9eb9d Position: rename getWorldNonNull() to getWorld(), remove original getWorld() 2020-06-29 21:19:46 +01:00
Dylan K. Taylor
01d221b794 imports cleanup 2020-06-28 17:50:49 +01:00
Dylan K. Taylor
27511ac3ec updated network item ID constants 2020-06-28 17:37:51 +01:00
Dylan K. Taylor
74b0c411c4 regenerated network entity ID constants 2020-06-28 17:37:25 +01:00
Dylan K. Taylor
0d13a3fbdb NetworkSession: do not respond to death before player spawn, fixes #3513
there's a few changes that can be made to avoid this problem, the
primary one being to separate this API from NetworkSession and abstract
it away... but this is a reasonable, although not great, solution.
2020-06-28 17:35:12 +01:00