1139 Commits

Author SHA1 Message Date
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
Jason
15e5bdb210
BaseInventory::addItem(item1,item2,item3) now has the same behaviour as multiple separate addItem() calls (#4237)
fixes #1412
2021-06-17 21:05:24 +01:00
Dylan K. Taylor
61c59be299
Replace hardcoded block metadata shifts and masks with constants
we might want to make these bigger than 4 bits in the future.
2021-06-16 12:48:09 +01:00
Dylan K. Taylor
e5dd5a5745
NetworkSession: Fixed missing nullable declarations
phpstan doesn't report these because .. reasons .. @ondrejmirtes this is causing bugs to go unfound :(
I'm aware of the irony that I just silenced the bugs that were exposed by this commit .. that's an architectural problem for another day
2021-06-13 22:24:12 +01:00
Dylan K. Taylor
57d274901d
Protocol changes for 1.17.0 2021-06-08 19:40:28 +01:00
Dylan K. Taylor
0402e7e697
Separate CommandReader impl from CommandReaderThread 2021-05-29 23:41:11 +01:00
Dylan K. Taylor
f655d262be
Added stripped all-sided-log variants
again, these should be dynamic; but right now it's not possible.
2021-05-22 12:43:07 +01:00
Dylan K. Taylor
24405b63c1
Coarse is now a state of Dirt, instead of a separate block 2021-05-21 21:36:49 +01:00
Dylan K. Taylor
df260034cd
BlockFactory: Fill default state for all variants covered by bitmask when mismatch occurs 2021-05-21 21:12:34 +01:00
Dylan K. Taylor
af678f985d
All types of coral now have fully dynamic types 2021-05-19 22:49:44 +01:00
Dylan K. Taylor
80e4da85df
Fixed PHPStan build 2021-05-12 12:12:29 +01:00
Dylan K. Taylor
4c4db1836f
Merge remote-tracking branch 'origin/stable' 2021-05-11 19:28:09 +01:00
Dylan K. Taylor
e648f1c91e
Remove unnecessary script copy 2021-05-10 17:55:52 +01:00
Dylan K. Taylor
5116e11cea
Only install the stuff we need to run PHP, not to build it 2021-05-10 17:55:52 +01:00
Dylan K. Taylor
f909557529
Cleaned up implementations for EnderChestInventory/DoubleChestInventory
previously, these were forced to extend BaseInventory because of the amount of crap in Inventory's interface.
This meant that these inventories had their own slots storage, which would be _mostly_ unused because these inventories aren't real inventories, but rather just delegates.
This lead to a variety of bugs in the past, such as certain API methods on BaseInventory not working correctly for DoubleChestInventory in particular.

Now, BaseInventory just implements the functional part of the inventory implementation, leaving the storage system up to the implementation.
A SimpleInventory class is provided with a simple SplFixedArray storage backing, which is used by most inventories.
EnderChestInventory and DoubleChestInventory now extend BaseInventory directly, and implement custom methods for dealing with their delegates.
2021-05-09 20:51:16 +01:00
Dylan K. Taylor
624495f4d3
Added a generic Promise type
I anticipate increasing demand for promises, and since all the libraries I could find suck, we'll stick to our own impl for now.
2021-05-08 15:57:30 +01:00
Dylan K. Taylor
33eb97da97
Remove dead PHPStan pattern 2021-05-08 15:53:55 +01:00
Dylan K. Taylor
6384b6602c
phpstorm you piece of shit 2021-05-07 23:55:49 +01:00
Dylan K. Taylor
73420819f6
Clean PHPStan baselines 2021-05-05 14:51:39 +01:00
Dylan K. Taylor
652de2632a
Rough OffHand implementation
this doesn't do stuff like taking arrows from offhand yet.
2021-05-05 14:46:51 +01:00
Dylan K. Taylor
e8cb49f7ae
php-cs-fixer fixing php-cs-fixer's own mess 2021-05-05 11:25:11 +01:00
Dylan K. Taylor
b8645f5c15
Clean up EnderChestInventory implementation
now, EnderChestInventory is just a temporary window, much like anvil/enchanting windows. It provides a gateway to the player's PlayerEnderInventory.

This removes one of the remaining obstacles to disallowing null World in Position constructor.
2021-05-02 14:26:27 +01:00
Dylan K. Taylor
129ca7fee0
Silence a PHPStan bug
I'm not able to reproduce this one on the playground, but it still shows up even when disabling certain phpdocs...
2021-05-02 13:55:32 +01:00
Dylan K. Taylor
726978b8f1
Migrate all coloured blocks (except glazed terracotta) to dynamic colours 2021-04-29 20:11:03 +01:00
Dylan K. Taylor
593a8ac529
Added Loom blocks
these don't support doing patterns yet, but their inventories work.
2021-04-29 19:51:09 +01:00
Dylan K. Taylor
b33bf1f433
Unfuck banners ... 2021-04-28 18:44:21 +01:00
Dylan K. Taylor
d5e5a81cff
Don't explode when data contains invalid dye colour IDs 2021-04-28 13:39:03 +01:00
Dylan K. Taylor
2eb05a2420
Updated block factory consistency check 2021-04-27 21:00:22 +01:00
Dylan T
127b57048c
Allow plugins to use PSR-4 namespace mapping (#4188)
* Allow plugins to use PSR-4 namespace mapping
this is a reduced implementation which serves the 99% use case without being horribly breakable.

Plugins may now specify a `src-namespace-prefix`, which should be set to the namespace of the classes in `src`.
If the old system is used, `src-namespace-prefix` can be omitted, or set to an empty string.

Examples:
- If `src-namespace-prefix` is `dktapps\test`, `dktapps\test\Main` will be searched for in `src/Main.php`, instead of `src/dktapps/test/Main.php`.

* Migrate TesterPlugin to PSR-4
2021-04-23 19:34:46 +01:00
Dylan K. Taylor
4e0bc6c98e
Scrub PHPStan baselines 2021-04-19 16:18:22 +01:00
Dylan K. Taylor
73f913e279
Modernize TesterPlugin 2021-04-19 14:16:05 +01:00
Covered123
9c1b4fd1cd
Added CancelTaskException (#4186) 2021-04-19 13:41:51 +01:00
Dylan K. Taylor
5872b2fe23
Merge remote-tracking branch 'origin/stable' 2021-04-19 13:32:15 +01:00
Dylan K. Taylor
09a2402f01
Fixed precondition on double chunk send being useless
this is messy, but necessary for now.
2021-04-19 00:50:43 +01:00
Dylan K. Taylor
d19c21e2e1
Updated PHPStan baseline 2021-04-19 00:38:27 +01:00
TheNewHEROBRINEX
8d1a1628de
Item: Remove "ench" tag when all enchantments are removed from an item (#4184)
fixes #4144
2021-04-18 20:56:07 +01:00
Dylan K. Taylor
53ebe4f9f9
World: added getHighestAdjacentFullLightAt() 2021-04-18 20:20:08 +01:00