1175 Commits

Author SHA1 Message Date
Dylan K. Taylor
3b7580688c
Stop auto-translating string descriptions/usages for commands
Require usage of Translatable for translations.
2021-09-11 16:46:40 +01:00
Dylan K. Taylor
34f01a3ce3
World: Track entities separately from chunks
this allows entities to exist outside of generated chunks, with one caveat: they won't be saved in such cases.
Obviously, for player entities, this doesn't matter.

fixes #3947
2021-09-09 01:17:41 +01:00
Dylan K. Taylor
627c70c4df
actions: use chunkutils2 0.3.1 2021-09-07 22:55:50 +01:00
Dylan K. Taylor
dd4abe7f7a
Updated test 2021-09-07 12:27:24 +01:00
Dylan K. Taylor
df3b112877
Implemented slime blocks 2021-09-05 20:46:59 +01:00
Dylan K. Taylor
aa5a9f6d12
Enchantment: use Translatable instead of hardcoded translation keys 2021-09-03 20:52:05 +01:00
Dylan K. Taylor
668df85e3f
Merge branch 'stable' 2021-08-20 23:08:17 +01:00
Dylan K. Taylor
ff4aa148ef
phpstan 0.12.95 2021-08-20 22:47:29 +01:00
Dylan K. Taylor
e43d39c0bc
UpdateChecker: improve type handling 2021-08-20 20:06:09 +01:00
Dylan K. Taylor
d488c25a1a
Rename AutoUpdater -> UpdateChecker 2021-08-20 19:54:08 +01:00
Dylan K. Taylor
b4b3c21d30
Merge branch 'stable' 2021-08-19 15:39:16 +01:00
Dylan T
7bd8d09023
GitHub Actions: automatically build and upload release artifacts, and auto-update update.pmmp.io (#4376) 2021-08-18 14:02:52 +01:00
Dylan K. Taylor
5a970541f9
actions: use newer pthreads version 2021-08-16 23:15:47 +01:00
Dylan K. Taylor
dfc82f6820
VanillaCommand: fix bogus mixed typehints 2021-08-15 19:32:33 +01:00
Dylan T
27e0ecf7ee
Implemented Blast Furnace and Smoker (#4362) 2021-08-12 23:27:05 +01:00
Dylan K. Taylor
6a2a4cca4d
Terminal: use match instead of switch in toANSI()
phpstan seems to have some trouble with large match statements (phpstan/phpstan#5454)
2021-08-12 20:13:44 +01:00
Dylan K. Taylor
041d314190
HandlerListManager: apply class-string type for getListFor() parameter 2021-08-05 20:11:58 +01:00
Dylan K. Taylor
b72d81be5e
Cleanup PHPStan baselines 2021-08-04 21:24:13 +01:00
Dylan K. Taylor
b31dce2119
Player: fixed type of loadQueue field 2021-08-04 21:17:44 +01:00
Dylan K. Taylor
61b7faae08
Simplify BaseInventoryTest 2021-08-04 21:01:01 +01:00
Dylan K. Taylor
2b5667a56b
Move PHP minimum to 8.0 2021-07-26 20:29:39 +01:00
Dylan K. Taylor
09eac0e129
Merge remote-tracking branch 'origin/stable' 2021-07-26 20:14:33 +01:00
Dylan K. Taylor
01fe497c49
phpstan: use PHP 8.0 as primary version
I'm using 8.0 for local development now, so having the phpstan configs targeted at 7.4 by default makes things inconvenient.
2021-07-26 14:34:47 +01:00
Dylan T
1246d1b7ef
Use a subprocess for reading lines from STDIN (#4332)
this FINALLY provides us with a way to deal with Windows without needing to forcibly terminate the entire server on shutdown.
2021-07-24 22:10:50 +01:00
Dylan K. Taylor
58498c2b0b
Merge remote-tracking branch 'origin/stable' 2021-07-23 16:40:19 +01:00
Dylan K. Taylor
85effa5240
Remove junk from php8 baseline 2021-07-23 15:56:06 +01:00
Dylan K. Taylor
81c5b83bd9
actions: test on 8.0 2021-07-23 15:55:01 +01:00
Dylan T
0eb4231b51
Use OpenSSL for ECDH during client login, drop mdanter/ecc (#4328)
This brings a significant performance improvement to login sequence handling, reducing CPU cost of `PrepareEncryptionTask` by over 90% and `ProcessLoginTask` by over 60%. It also allows us to shed a dependency.
2021-07-22 23:04:00 +01:00
Angel
309bed414f
Implemented sweet berries (#4164)
this doesn't implement the server-side logic for the "stickiness" (slowdown) because we don't have the system needed for it yet.
It also doesn't have parity with vanilla on the damage.
2021-07-19 20:01:33 +01:00
Dylan K. Taylor
71df15b4cc
Removed FlowerPot update_bit hack 2021-07-19 17:39:35 +01:00
Dylan K. Taylor
5874ce582a
Implemented bells 2021-07-19 17:00:56 +01: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
9f11be25cb
LevelSoundEventPacket: fixed bad null assignment in ::create() 2021-07-14 15:21:33 +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
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
Aericio
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
Dylan K. Taylor
3997e612b1
silence phpstan bug phpstan/phpstan#5271 2021-07-09 19:44:25 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan T
32d7b1e6af
Start using webmozart/pathutil for joining paths (#4287) 2021-06-29 19:40:43 +01:00
Dylan K. Taylor
e14bad4ea6
Rename CommandReader and friends to ConsoleReader 2021-06-26 19:29:58 +01:00
Dylan K. Taylor
a70bd115f1
Moved console-specific stuff to its own namespace
this stuff has different functionality than everything else in the
command namespace (specifically console handling), so it doesn't belong
in here.

I know that this will probably break some plugins, but I don't care,
because plugins shouldn't have been abusing ConsoleCommandSender in the
first place.
2021-06-26 19:24:46 +01:00
Dylan K. Taylor
0910054c41
NetworkSession: Fixed InventoryManager nullability disaster
fixes #4277
fixes #4275
fixes #3139
2021-06-26 17:44:42 +01:00
Dylan K. Taylor
e43bca95bf
Fixed build 2021-06-26 17:40:43 +01:00
aieuo
a6039ad733
Fixed InventoryHelpersTrait::addItem() cannot add items with a count greater than maxstack (#4283) 2021-06-26 16:48:53 +01:00
Dylan K. Taylor
2a6009f8bf
Check consistency of block remaps 2021-06-21 20:45:30 +01:00
Dylan K. Taylor
981b0285d1
Isolate config casting nastiness in one place
this doesn't solve the underlying problem, but it does reduce the amount of noise made by PHPStan about it, as well as avoiding code litter.
2021-06-19 19:14:02 +01:00
Dylan K. Taylor
735c656f9d
Merge remote-tracking branch 'origin/stable' 2021-06-18 18:52:04 +01:00
Dylan K. Taylor
155e516f74
phpstan 0.12.90 2021-06-18 18:46:30 +01:00