Commit Graph

157 Commits

Author SHA1 Message Date
652de2632a Rough OffHand implementation
this doesn't do stuff like taking arrows from offhand yet.
2021-05-05 14:46:51 +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
4c783f1037 shut 2021-05-02 13:43:37 +01:00
9b8f32c584 Extract inventory helper methods from BaseInventory to a trait
this allows easier alternate implementations of Inventory that don't extend BaseInventory (e.g. double chest, or delegate inventory).
2021-05-02 13:38:49 +01:00
c61f66d973 Removed ext-ds dependency 2021-02-11 15:40:37 +00:00
3e1ac66abf Merge branch 'stable' 2021-02-02 13:46:29 +00:00
c70c0b55df Separate held item index change listener logic from PlayerInventory 2021-01-12 16:44:25 +00:00
01c867b608 Human: make held item sync on inventory content change more consistent
before this change, setContents() wouldn't trigger a held item sync, nor would setItem(heldItemIndex, someItem).
2021-01-10 20:30:39 +00:00
eca0e88471 BaseInventory: fixed passing NULL slots to InventoryListener->onContentChange()
as per the documentation, InventoryListener->onContentChange() does not expect to receive NULL in the given array.
2020-12-05 01:11:30 +00:00
d08c9ee634 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/VersionInfo.php
2020-11-10 22:44:59 +00:00
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
d6ed542fcd Merge remote-tracking branch 'origin/stable' into master
# Conflicts:
#	composer.json
#	composer.lock
#	src/CrashDump.php
#	src/pocketmine/Server.php
#	src/pocketmine/level/format/io/region/McRegion.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/l7-baseline.neon
#	tests/phpstan/configs/l8-baseline.neon
#	tests/travis/setup-php.yml
2020-10-26 16:18:53 +00:00
e1d80f05b1 Merge branch 'stable' into master 2020-08-03 20:14:46 +01:00
1d18662d9b InventoryAction: replace isValid() with validate() which throws TransactionValidationException 2020-07-04 19:38:34 +01:00
cf5e31c619 InventoryTransaction::execute() now throws exceptions instead of returning true/false 2020-07-01 14:08:28 +01:00
29612cded3 CraftingTransaction: make CraftingManager injectable
this becomes a bit easier to unit-test.
2020-07-01 13:38:06 +01:00
5b0964cec8 Merge commit '2dc3cf816'
# Conflicts:
#	resources/vanilla
2020-06-03 12:52:42 +01:00
4437756987 Inventory: reduce API duplication by using a Set for viewers 2020-05-14 14:13:28 +01:00
f34753c496 CallbackInventoryListener: fix crash when any of the callbacks isn't provided 2020-05-03 21:48:32 +01:00
6e6fffa461 Inventory: added removeAllListeners()
this isn't strictly necessary because it could be done by removeListeners(...getListeners()), but I think developers will appreciate not needing so much boilerplate code.
2020-05-03 21:44:45 +01:00
adadd5423d move force-close crafting grid hack to InGamePacketHandler
the crafting transaction implementation has no business caring about this
2020-04-29 16:54:23 +01:00
6dd31cc3f5 break cycle between block and inventory packages 2020-04-24 23:53:49 +01:00
4fbf4dcdc6 Rename InventoryChangeListener -> InventoryListener 2020-04-24 23:44:38 +01:00
08ac6a3c43 Convert CreativeInventory to singleton 2020-04-24 00:38:18 +01:00
86e051b7bf Merge commit 'a2543ff80d2906bccda1a4e2fdbd9d8e7d147fb3' 2020-04-18 17:33:05 +01:00
12e4e92894 Inventory: Pass old item(s) to inventory change listeners, closes #3323 (#3337) 2020-03-09 13:52:15 +00:00
78394a336c Merge branch 'stable' 2020-02-25 20:45:39 +00:00
7c2741e4f5 Inventory: eliminate remaining $send parameters 2020-02-23 21:59:51 +00:00
b108fb61bf Inventory: drop $send params from setItem() and clear() 2020-02-12 13:34:35 +00:00
1c06438cbb Inventory: remove final usage of $send parameter of setItem() and clear() 2020-02-12 13:33:23 +00:00
4014f9a4f2 InventoryManager: be aware of client-side state when syncing slots
this eliminates feedback loops during client-initiated slot changes, and also makes it possible to have a SlotChangeAction anonymous from its initiator.
2020-02-11 21:12:18 +00:00
d2aca6023b add native return types to closures (for phpstan) 2020-02-07 22:05:15 +00:00
3a9e6bb612 CallbackInventoryChangeListener: fix use of tab instead of space 2020-02-07 19:28:43 +00:00
fb1126797a Merge branch 'stable' 2020-02-07 18:13:55 +00:00
85fdb7ec05 CallbackInventoryChangeListener: provide signature information for closures 2020-01-27 18:08:59 +00:00
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
3ee6887792 populate remaining missing return types, using native returns where possible
this is done separately to stable so that stable changes can be integrated easily using an empty merge.
2020-01-19 10:26:35 +00:00
cda1143a79 Merge branch 'stable' 2020-01-09 17:17:42 +00:00
0f718ea28b Merge commit '8726604899d1a371567141e0831ed570d3233356' 2019-12-25 14:19:35 +00:00
a9c09e4517 Merge branch 'next-minor' 2019-12-12 13:52:14 +00:00
d3d7709ead Merge branch 'next-minor' 2019-12-03 11:55:45 +00:00
6d24760174 Merge branch 'stable' 2019-10-20 21:25:39 +01:00
6b22f68674 Player: remove sendDataPacket() 2019-08-20 15:50:34 +01:00
d355d5b5b5 Remove hack to break cyclic dependency on double chests
Since these now reference positions instead of tiles, the cyclic dependency is removed.
2019-08-05 19:01:21 +01:00
f0505c0284 Remove dead comments from PlayerInventory and PlayerCursorInventory
these aren't overrides anymore.
2019-08-05 18:53:46 +01:00
9353f616a2 All BlockInventory descendents now have a Position as holder
this allows multiple problems to be solved:
1) Cycle between tile and inventory is now removed.
2) BlockInventory now provides a consistent API for plugins to get the block holding an inventory.
2019-08-05 18:50:29 +01:00
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00
5ea31b57ce First step to namespaces 2014-03-05 23:43:16 +01:00
23b8fc32ff removed DocBlock header for logo 2014-03-05 11:15:47 +01:00
e2a77b05b7 Remove redundant closing tag 2014-02-06 21:20:29 +10:30