Commit Graph

686 Commits

Author SHA1 Message Date
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
32d7b1e6af Start using webmozart/pathutil for joining paths (#4287) 2021-06-29 19:40:43 +01:00
e14bad4ea6 Rename CommandReader and friends to ConsoleReader 2021-06-26 19:29:58 +01:00
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
0910054c41 NetworkSession: Fixed InventoryManager nullability disaster
fixes #4277
fixes #4275
fixes #3139
2021-06-26 17:44:42 +01:00
e43bca95bf Fixed build 2021-06-26 17:40:43 +01:00
a6039ad733 Fixed InventoryHelpersTrait::addItem() cannot add items with a count greater than maxstack (#4283) 2021-06-26 16:48:53 +01:00
2a6009f8bf Check consistency of block remaps 2021-06-21 20:45:30 +01:00
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
735c656f9d Merge remote-tracking branch 'origin/stable' 2021-06-18 18:52:04 +01:00
155e516f74 phpstan 0.12.90 2021-06-18 18:46:30 +01:00
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
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
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
57d274901d Protocol changes for 1.17.0 2021-06-08 19:40:28 +01:00
0402e7e697 Separate CommandReader impl from CommandReaderThread 2021-05-29 23:41:11 +01:00
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
24405b63c1 Coarse is now a state of Dirt, instead of a separate block 2021-05-21 21:36:49 +01:00
df260034cd BlockFactory: Fill default state for all variants covered by bitmask when mismatch occurs 2021-05-21 21:12:34 +01:00
af678f985d All types of coral now have fully dynamic types 2021-05-19 22:49:44 +01:00
80e4da85df Fixed PHPStan build 2021-05-12 12:12:29 +01:00
4c4db1836f Merge remote-tracking branch 'origin/stable' 2021-05-11 19:28:09 +01:00
e648f1c91e Remove unnecessary script copy 2021-05-10 17:55:52 +01:00
5116e11cea Only install the stuff we need to run PHP, not to build it 2021-05-10 17:55:52 +01:00
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
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
33eb97da97 Remove dead PHPStan pattern 2021-05-08 15:53:55 +01:00
6384b6602c phpstorm you piece of shit 2021-05-07 23:55:49 +01:00
73420819f6 Clean PHPStan baselines 2021-05-05 14:51:39 +01:00
652de2632a Rough OffHand implementation
this doesn't do stuff like taking arrows from offhand yet.
2021-05-05 14:46:51 +01:00
e8cb49f7ae php-cs-fixer fixing php-cs-fixer's own mess 2021-05-05 11:25:11 +01:00
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
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
726978b8f1 Migrate all coloured blocks (except glazed terracotta) to dynamic colours 2021-04-29 20:11:03 +01:00
593a8ac529 Added Loom blocks
these don't support doing patterns yet, but their inventories work.
2021-04-29 19:51:09 +01:00
b33bf1f433 Unfuck banners ... 2021-04-28 18:44:21 +01:00
d5e5a81cff Don't explode when data contains invalid dye colour IDs 2021-04-28 13:39:03 +01:00
2eb05a2420 Updated block factory consistency check 2021-04-27 21:00:22 +01:00
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
4e0bc6c98e Scrub PHPStan baselines 2021-04-19 16:18:22 +01:00
73f913e279 Modernize TesterPlugin 2021-04-19 14:16:05 +01:00
9c1b4fd1cd Added CancelTaskException (#4186) 2021-04-19 13:41:51 +01:00
5872b2fe23 Merge remote-tracking branch 'origin/stable' 2021-04-19 13:32:15 +01:00
09a2402f01 Fixed precondition on double chunk send being useless
this is messy, but necessary for now.
2021-04-19 00:50:43 +01:00
d19c21e2e1 Updated PHPStan baseline 2021-04-19 00:38:27 +01:00
8d1a1628de Item: Remove "ench" tag when all enchantments are removed from an item (#4184)
fixes #4144
2021-04-18 20:56:07 +01:00
53ebe4f9f9 World: added getHighestAdjacentFullLightAt() 2021-04-18 20:20:08 +01:00
a32eb4ebc3 Implemented coral and coral fans
this implementation is very rough due to having to hack around lots more MCPE bullshit, and currently doesn't allow dynamic coral types; but it's there. We'll clean this up after 1.13 migration is done.
2021-04-17 02:04:10 +01:00
9abdcd8ee5 shut 2021-04-16 21:45:22 +01:00
01c3668375 ItemFactory: Check the bounds of durability, instead of trying to catch exceptions 2021-04-16 21:30:48 +01:00