ed4978c31b
Added VanillaItems::AIR()
...
we don't usually add VanillaItems entries for blocks since they already exist in VanillaBlocks, but air has a special use case specifically as an itemstack, so we make an exception for this case.
2021-12-07 00:41:07 +00:00
fed59d3ebe
added missing file
2021-11-09 00:11:39 +00:00
ab002ca06d
Improved handling of temporary inventory windows
...
evacuation behaviour is now consistent regardless of who is doing it
2021-11-08 23:36:58 +00:00
45edb94607
Crafting tables now work the same way as anvils and enchanting tables
...
Removing almost all special-case logic for crafting tables.
2021-11-07 16:20:07 +00:00
275f145418
BedrockData is now a Composer dependency
...
this should put a stop to people nagging me about incorrect blocks (we have a check to make sure composer dependencies are up to date).
2021-11-02 16:45:45 +00:00
a5833327f0
Inventory: added getAddableItemQuantity()
...
this mostly reuses the code from canAddItem().
2021-10-11 21:46:27 +01:00
5d4f14b388
Added TransactionBuilderInventory for server-side inventory transaction generation
2021-09-09 17:10:04 +01:00
00984c1b9f
BaseInventory: Move contents of InventoryHelpersTrait back inline
...
I moved these to a trait in anticipation of having multiple full Inventory implementations. That's no longer necessary because of the abstraction of SimpleInventory.
2021-08-04 20:57:20 +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
9b30c2feda
Extract a DelegateInventory from EnderChestInventory
2021-06-26 21:01:40 +01:00
0910054c41
NetworkSession: Fixed InventoryManager nullability disaster
...
fixes #4277
fixes #4275
fixes #3139
2021-06-26 17:44:42 +01:00
a6039ad733
Fixed InventoryHelpersTrait::addItem() cannot add items with a count greater than maxstack ( #4283 )
2021-06-26 16:48:53 +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
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
01794adef1
...
2021-05-05 22:24:23 +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
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