Dylan K. Taylor
289ede669d
BlockTranslator: use less ambiguous function names
2023-05-05 14:47:23 +01:00
Dylan K. Taylor
32e6fdd95a
Rename RuntimeBlockMapping -> BlockTranslator
2023-05-03 22:18:27 +01:00
Dylan K. Taylor
01f340985a
Centralize all conversion-related stuff under TypeConverter
...
instead of having singletons for everything, which are a nightmare to manage for multi version
2023-05-03 16:33:17 +01:00
Dylan K. Taylor
0a3ecfdae9
Clean up terminology around block state IDs and their handling
2023-01-25 19:01:15 +00:00
Dylan K. Taylor
c2918709a3
Merge branch 'next-minor' into next-major
2023-01-06 01:59:04 +00:00
Dylan K. Taylor
3baa5ab712
InGamePacketHandler: removed obsolete workaround
2023-01-06 00:41:57 +00:00
Dylan K. Taylor
4d79aced07
Merge branch 'next-minor' into next-major
2022-12-15 19:50:27 +00:00
Dylan K. Taylor
99996b62d6
Align PhpDoc @param tags according to PHP-CS-Fixer
2022-12-06 13:21:20 +00:00
Dylan K. Taylor
f24f2d9ca9
Hit block legacy metadata with the biggest nuke you've ever seen
...
This commit completely revamps the way that blocks are represented in memory at runtime.
Instead of being represented by legacy Mojang block IDs and metadata, which are dated, limited and unchangeable, we now use custom PM block IDs, which are generated from VanillaBlocks.
This means we have full control of how they are assigned, which opens the doors to finally addressing inconsistencies like glazed terracotta, stripped logs handling, etc.
To represent state, BlockDataReader and BlockDataWriter have been introduced, and are used by blocks with state information to pack said information into a binary form that can be stored on a chunk at runtime.
Conceptually it's pretty similar to legacy metadata, but the actual format shares no resemblance whatsoever to legacy metadata, and is fully controlled by PM.
This means that the 'state data' may change in serialization format at any time, so it should **NOT** be stored on disk or in a config.
In the future, this will be improved using more auto-generated code and attributes, instead of hand-baked decodeState() and encodeState(). For now, this opens the gateway to a significant expansion of features.
It's not ideal, but it's a big step forwards.
2022-06-24 23:19:37 +01:00
Dylan K. Taylor
1ff69136a3
Merge branch 'next-major' into modern-world-support
2022-06-07 20:01:40 +01:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence
2022-06-04 17:34:49 +01:00
Dylan K. Taylor
0cc997f531
Checking in BlockStateUpgrader and a bunch of unit tests
2022-02-04 00:16:48 +00:00
Dylan K. Taylor
94c4f58667
Fixed bogus test
2022-01-21 19:13:36 +00:00
Dylan K. Taylor
53d7ed2b5c
these tests are now done by pocketmine/bedrock-protocol
2021-07-14 20:39:32 +01:00
Dylan K. Taylor
1ad38d499c
Deglobalize ItemTypeDictionary usage, at least for the protocol
...
while this is a bit hacky outside of the protocol namespace, it makes it much easier to use the protocol library for alternative purposes, such as for a client or MITM proxy.
It also removes all but one remaining core dependency of the protocol library, making it very close to being able to be separated from the server core entirely.
2021-07-14 14:26:32 +01:00
Dylan K. Taylor
0312b62c8a
DataPacket no longer keeps its own serializer
...
since a while ago, we're anyway just discarding the internal buffer anyway when the packet is repeatedly encoded, so this doesn't serve any advantage anymore.
We do need a system to be able to reuse encoded packet buffers, but right now we're not reusing them anyway.
2021-04-09 15:37:58 +01:00
Dylan K. Taylor
8d5cc9adc3
Merge branch 'stable'
2021-02-07 20:57:19 +00:00
Dylan K. Taylor
c5bdd7dd64
Added a unit test to ensure valid format of MINECRAFT_VERSION_NETWORK
2021-02-04 22:36:40 +00:00
Dylan K. Taylor
73a8c90bee
Merge remote-tracking branch 'origin/stable'
...
# Conflicts:
# resources/vanilla
# src/world/Explosion.php
# tests/phpunit/item/ItemTest.php
# tests/phpunit/world/format/io/region/RegionLoaderTest.php
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
2020-11-01 14:21:47 +00:00
Dylan K. Taylor
500fd2d842
tests: strip useless phpdoc
2020-10-26 15:59:17 +00:00
Dylan K. Taylor
0aee39027e
Merge branch 'stable' into master
...
# Conflicts:
# composer.lock
# resources/vanilla
# src/entity/Living.php
# src/pocketmine/Player.php
# src/pocketmine/VersionInfo.php
# src/pocketmine/block/Potato.php
# src/pocketmine/block/Sugarcane.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/item/Item.php
# src/pocketmine/level/format/Chunk.php
# src/pocketmine/level/format/io/leveldb/LevelDB.php
# src/world/generator/GeneratorRegisterTask.php
# tests/phpstan/configs/check-explicit-mixed-baseline.neon
# tests/phpstan/configs/l7-baseline.neon
# tests/phpstan/configs/l8-baseline.neon
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskPublishProgressRaceTest.php
2020-09-04 01:43:52 +01:00
Dylan K. Taylor
81c1613e5d
StupidJsonDecodeTest: added a callable prototype
...
for some reason this causes a new error to be reported which previously didn't show. I have no idea why.
2020-08-31 13:45:46 +01:00
Dylan K. Taylor
798efc370c
PacketBatch: get rid of putPacket()
2020-07-22 15:24:08 +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
c618932d25
Eliminate usages of BinaryStream->setBuffer() and BinaryStream->reset()
2020-06-17 13:49:43 +01:00
Dylan K. Taylor
9c46a1f141
Rename Packet->getBinaryStream() -> Packet->getSerializer()
2020-06-17 11:33:59 +01:00
Dylan K. Taylor
6c096c44aa
Rename NetworkBinaryStream -> PacketSerializer
2020-06-17 11:31:13 +01:00
Dylan K. Taylor
0b6d6306cf
LoginPacket: fixed error handling edge case with malformed chain data JSON
2020-05-06 21:46:35 +01:00
Dylan K. Taylor
a97cafd4f6
moving serializers into protocol namespace
2020-04-27 13:54:39 +01:00
Dylan K. Taylor
1b26cf1df9
break the hard cycle between mcpe\handler and mcpe\protocol
...
preparing to move mcpe\protocol to a separate library
2020-04-23 15:38:11 +01:00
Dylan K. Taylor
5c2ae0257c
DataPacket: inject buffer via parameter instead of class field (packet & stream separation, step 2)
...
this is not complete yet, but the final change (having the binarystream actually come from outside) is a little more disruptive, and some extra changes need to be made. This will grant some sanity in the meantime without breaking too much stuff.
2020-02-25 16:19:11 +00:00
Dylan K. Taylor
bd00ee5038
Merge branch 'stable'
2020-02-24 22:11:13 +00:00
Dylan K. Taylor
04581e2700
DataPacket: account for splitscreen header when decoding
2020-02-24 21:20:25 +00:00
Dylan K. Taylor
fb1126797a
Merge branch 'stable'
2020-02-07 18:13:55 +00:00
Dylan K. Taylor
532dc0fb6f
tests/phpunit: populate iterable types for phpstan
2020-02-06 13:11:56 +00:00
Dylan K. Taylor
e12618c705
tests/phpunit: added missing native typehints
2020-02-06 12:13:42 +00:00
Dylan K. Taylor
464b2116a6
Merge remote-tracking branch 'origin/stable'
2019-10-01 14:41:54 +01:00
Dylan K. Taylor
8a6381c3fa
StupidJsonDecodeTest: add some extra test vectors
2019-10-01 13:25:20 +01:00
Dylan K. Taylor
735efeaa13
Merge branch 'stable'
2019-09-26 11:30:36 +01:00
Dylan K. Taylor
d0d61597c7
StupidJsonDecodeTest: use getClosure() instead of traditional mess
...
this is faster and requires less code.
2019-09-26 11:28:40 +01:00
Dylan K. Taylor
15694279c7
Merge branch 'stable'
2019-09-18 13:30:58 +01:00
Dylan T
d724374d1a
StupidJsonDecodeTest: add failing test case for #3113
2019-09-16 15:53:00 +01:00
Dylan K. Taylor
e82a40b2ba
forgot to stage this for b18bd4f33ce606ad594b56dd4785b650d21cd695
2019-06-18 17:37:38 +01:00
Dylan K. Taylor
57219abc9d
fix test failure
2019-05-18 20:20:33 +01:00
Dylan K. Taylor
9ad30e239a
Merge branch 'release/3.2'
2018-08-19 10:37:20 +01:00
Dylan K. Taylor
bfa415e108
Add unit tests for json decoding hack
2018-08-19 10:30:52 +01:00