Commit Graph

13561 Commits

Author SHA1 Message Date
a2e2196a90 Start using pocketmine/bedrock-protocol library 2021-07-14 20:32:15 +01:00
b86d682793 Update to released version of pocketmine/math 2021-07-14 20:14:33 +01:00
9f11be25cb LevelSoundEventPacket: fixed bad null assignment in ::create() 2021-07-14 15:21:33 +01:00
c474aa42e5 ClientDataToSkinDataHelper: Remove SingletonTrait
SingletonTrait is pointless here for multiple reasons:
1) the class is final
2) this is protocol-specific translation of types, no loss of data or alternative mutation of it needs to occur

Using SingletonTrait is an obstacle to separating the protocol library from the core code, so it has to go.
2021-07-14 14:50:59 +01:00
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
0c2917f2aa Merge branch 'pm4-bedrock-1.17.10' 2021-07-13 18:20:00 +01:00
28ede7273f Fixed CS 2021-07-13 18:16:25 +01:00
a182b36b71 Merge branch 'pm4-bedrock-1.17.10' 2021-07-13 18:04:24 +01:00
f77da60dd3 Merge branch 'pm3-bedrock-1.17.10' into pm4-bedrock-1.17.10 2021-07-13 18:02:29 +01:00
4d6ac57a26 Fixed particle IDs 2021-07-13 17:54:40 +01:00
676bacbee1 Improve the flexibility of WorldProvider registration
WorldProviders now have the following requirements removed:
- __construct() is no longer required to have a specific signature
- static isValid() no longer needs to be implemented (you will still need it for registering, but it can be declared anywhere now)
- static generate() no longer needs to be implemented

This paves the way for more interesting types of world providers that use something other than local disk to store chunks (e.g. a mysql database).

WorldProviderManager no longer accepts class-string<WorldProvider>. Instead, WorldProviderManagerEntry is required, with 2 or 3 callbacks:
- ReadOnlyWorldProviderManager must provide a callback for isValid, and a callback for fromPath
- WritableWorldProviderManagerEntry must provide the same, and also a generate() callback

In practice, this requires zero changes to the WorldProviders themselves, since a WorldProviderManagerEntry can be created like this:
`new WritableWorldProviderManagerEntry(\Closure::fromCallable([LevelDB::class, 'isValid']), fn(string ) => new LevelDB(), \Closure::fromCallable([LevelDB::class, 'generate']))`

This provides identical functionality to before for the provider itself; only registration is changed.
2021-07-13 16:55:21 +01:00
654fc9a2a6 LegacyStringToItemParser: Throw more specific exceptions 2021-07-10 21:03:12 +01:00
9afc5be0f5 Shulker open/close sounds != shulker box open/close sounds 2021-07-10 19:59:59 +01:00
fc090e238d Add Shulker Boxes (#3678)
this implementation is working, although incomplete:

- The shulker close sound should not be played until the end of the shulker closing animation, which takes approximately 1 second.
- An open shulker box has a different collision box than a closed one - it should be +0.5 in whichever direction the shulker is facing. (During the animation, the bounding box also dynamically changes size - you can see this in vanilla by shooting an arrow into the top of an open shulkerbox facing UP, and then closing it - the arrow will fall and collide with the lid multiple times.

However, resolving both of these issues requires significant internal changes which are beyond the scope of this PR.
2021-07-10 19:48:38 +01:00
b07000f613 Merge branch 'pm3-bedrock-1.17.10' into pm4-bedrock-1.17.10 2021-07-09 20:02:30 +01:00
3997e612b1 silence phpstan bug phpstan/phpstan#5271 2021-07-09 19:44:25 +01:00
9d1b2c839d this managed to get lost in the merge 2021-07-09 19:39:15 +01:00
aeb007d0a1 Merge remote-tracking branch 'origin/stable' 2021-07-09 19:36:32 +01:00
8b79253d3b Protocol changes for 1.17.10 2021-07-09 19:29:34 +01:00
4e731f61af BlockFactory: Remap double slab IDs with 0x8 bit set to their base DOUBLE state, instead of BOTTOM
this was causing problems with slabs in converted Java worlds, where the
0x8 bit means 'smooth', instead of 'double'. In MCPE it has no effect.

Since Slab doesn't retain the high/low flag for DOUBLE type slabs, this
caused BlockFactory to assume that those states were invalid, and
remapped them to their base state instead.

The following changes resulted in the consistency check:

Remap changed for 43:8 (44:0 (Smooth Stone Slab) -> 43:0 (Smooth Stone Slab))
Remap changed for 43:9 (44:1 (Sandstone Slab) -> 43:1 (Sandstone Slab))
Remap changed for 43:10 (44:2 (Fake Wooden Slab) -> 43:2 (Fake Wooden Slab))
Remap changed for 43:11 (44:3 (Cobblestone Slab) -> 43:3 (Cobblestone Slab))
Remap changed for 43:12 (44:4 (Brick Slab) -> 43:4 (Brick Slab))
Remap changed for 43:13 (44:5 (Stone Brick Slab) -> 43:5 (Stone Brick Slab))
Remap changed for 43:14 (44:6 (Quartz Slab) -> 43:6 (Quartz Slab))
Remap changed for 43:15 (44:7 (Nether Brick Slab) -> 43:7 (Nether Brick Slab))
Remap changed for 157:8 (158:0 (Oak Slab) -> 157:0 (Oak Slab))
Remap changed for 157:9 (158:1 (Spruce Slab) -> 157:1 (Spruce Slab))
Remap changed for 157:10 (158:2 (Birch Slab) -> 157:2 (Birch Slab))
Remap changed for 157:11 (158:3 (Jungle Slab) -> 157:3 (Jungle Slab))
Remap changed for 157:12 (158:4 (Acacia Slab) -> 157:4 (Acacia Slab))
Remap changed for 157:13 (158:5 (Dark Oak Slab) -> 157:5 (Dark Oak Slab))
Remap changed for 181:8 (182:0 (Red Sandstone Slab) -> 181:0 (Red Sandstone Slab))
Remap changed for 181:9 (182:1 (Purpur Slab) -> 181:1 (Purpur Slab))
Remap changed for 181:10 (182:2 (Prismarine Slab) -> 181:2 (Prismarine Slab))
Remap changed for 181:11 (182:3 (Dark Prismarine Slab) -> 181:3 (Dark Prismarine Slab))
Remap changed for 181:12 (182:4 (Prismarine Bricks Slab) -> 181:4 (Prismarine Bricks Slab))
Remap changed for 181:13 (182:5 (Mossy Cobblestone Slab) -> 181:5 (Mossy Cobblestone Slab))
Remap changed for 181:14 (182:6 (Smooth Sandstone Slab) -> 181:6 (Smooth Sandstone Slab))
Remap changed for 181:15 (182:7 (Red Nether Brick Slab) -> 181:7 (Red Nether Brick Slab))
Remap changed for 422:8 (417:0 (End Stone Brick Slab) -> 422:0 (End Stone Brick Slab))
Remap changed for 422:9 (417:1 (Smooth Red Sandstone Slab) -> 422:1 (Smooth Red Sandstone Slab))
Remap changed for 422:10 (417:2 (Polished Andesite Slab) -> 422:2 (Polished Andesite Slab))
Remap changed for 422:11 (417:3 (Andesite Slab) -> 422:3 (Andesite Slab))
Remap changed for 422:12 (417:4 (Diorite Slab) -> 422:4 (Diorite Slab))
Remap changed for 422:13 (417:5 (Polished Diorite Slab) -> 422:5 (Polished Diorite Slab))
Remap changed for 422:14 (417:6 (Granite Slab) -> 422:6 (Granite Slab))
Remap changed for 422:15 (417:7 (Polished Granite Slab) -> 422:7 (Polished Granite Slab))
Remap changed for 423:8 (421:0 (Mossy Stone Brick Slab) -> 423:0 (Mossy Stone Brick Slab))
Remap changed for 423:9 (421:1 (Smooth Quartz Slab) -> 423:1 (Smooth Quartz Slab))
Remap changed for 423:10 (421:2 (Stone Slab) -> 423:2 (Stone Slab))
Remap changed for 423:11 (421:3 (Cut Sandstone Slab) -> 423:3 (Cut Sandstone Slab))
Remap changed for 423:12 (421:4 (Cut Red Sandstone Slab) -> 423:4 (Cut Red Sandstone Slab))
2021-07-08 20:37:19 +01:00
605e26d584 remove unused import 2021-07-05 20:03:11 +01:00
5130a32333 GameMode: removed dead property (leftover from 902ea515f7) 2021-07-05 20:00:24 +01:00
b7ea10b905 MainLogger: do not assume that exception codes are always integers
PDOException most notably breaks this rule.
closes #4294
2021-07-05 19:20:59 +01:00
1122131c8d 3.21.2 is next 2021-07-05 18:49:26 +01:00
a50ef2af6f Release 3.21.1 3.21.1 2021-07-05 18:49:26 +01:00
72e4660800 Updated build/php submodule to pmmp/php-build-scripts@4bf8ec1ad0 2021-07-05 18:42:35 +01:00
e6285a0312 Update composer transitive dependencies 2021-07-05 17:22:32 +01:00
5420e76a9a Bump phpstan/phpstan-strict-rules from 0.12.9 to 0.12.10 (#4295) 2021-07-05 13:20:03 +00:00
de46a81cf4 Bump phpstan/phpstan from 0.12.90 to 0.12.91 (#4296)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.90 to 0.12.91.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.90...0.12.91)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-05 14:07:49 +01:00
1d8f0033af BlockBreakInfo: Expose hardness multipliers as constants 2021-06-30 19:47:11 +01:00
7a35fdb1bb Allow Blocks to specify their max stack size 2021-06-30 19:28:16 +01:00
91d54ff0ad Removed unnecessary and/or obsolete GC hacks
the intent of these hacks was to break cyclic references to avoid having objects lingering in memory. However, all of the stuff that's being removed in this commit no longer has any effect anyway, due to the fact that these things don't circularly reference each other anymore. Notably, Tile inventories now keep Position instead of a Tile ref.
2021-06-30 19:16:25 +01:00
c05f6db8d9 Bed and Skull items now return a correct block, with appropriate type information
I wanted to do the same for banners, but unfortunately banners are a tad more complicated.
2021-06-30 17:27:14 +01:00
12905d8c27 BlockFactory: remove some TODOs 2021-06-30 17:03:20 +01:00
2b4a1ffdfb Bed: use ColoredTrait 2021-06-30 16:07:46 +01:00
9e79d48aeb BaseBanner: use ColoredTrait 2021-06-30 16:07:45 +01:00
a888ab0257 GiveCommand: remove useless clone
addItem() clones this anyway.
2021-06-30 14:07:58 +01:00
f3bd48e6cb Updated some more hardcoded translation key usages missed by 94e16f416d 2021-06-30 14:02:55 +01:00
76a74b3931 Revert "Item: skip a step when decoding PC itemstacks"
This reverts commit 9b52af62b6.

We shouldn't assume that a string maps directly to a legacy ID,
because we might want string aliases (e.g. dark_oak_boat) which refer to
items that have a specific meta value in the MCPE system.

Overall, I want to get rid of the reliance on IDs here and register all
this stuff using closure callbacks on VanillaItems, so getting rid of
this assumption also serves that goal.
2021-06-30 13:13:53 +01:00
2312511be6 Living: remove unnecessary double CompoundTag::getTag() call 2021-06-29 23:54:52 +01:00
316e2654cc Fixed CS 2021-06-29 22:50:08 +01:00
94e16f416d Added KnownTranslationKeys (generated) and start using it 2021-06-29 22:46:04 +01:00
f02817bcd3 Player: fixed toString() on TranslationContainer exposed by previous commit
this code looks smelly...
2021-06-29 20:14:11 +01:00
83332024df TranslationContainer: remove __toString()
it doesn't make any sense to use TranslationContainer in this way.
2021-06-29 20:07:39 +01:00
1170c8fe13 EnumTrait: override __clone, __sleep, __wakeup to prevent duplication 2021-06-29 19:55:43 +01:00
7ba573db77 Added API method Item::canStackWith() 2021-06-29 19:52:52 +01:00
32d7b1e6af Start using webmozart/pathutil for joining paths (#4287) 2021-06-29 19:40:43 +01:00
aee7b03c1d changelog: fix outdated mention of ProjectileItem::getProjectileEntityClass()
[ci skip]
2021-06-29 19:26:02 +01:00
35ad199b11 changelog: mention Potion API changes
[ci skip]
2021-06-29 19:24:28 +01:00
7029f85c1c Regenerated VanillaItems 2021-06-29 18:23:24 +01:00