Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence
2022-06-04 17:34:49 +01:00
Dylan K. Taylor
179cac45f5
Merge branch 'stable' into next-minor
2022-05-22 16:21:05 +01:00
Dylan K. Taylor
5d92eddc82
InventoryTransaction: provide object ID of failed action for debugging identification
...
closes #3235
2022-05-21 17:35:21 +01:00
Dylan K. Taylor
d4b7f66e15
Promote some constructors
2022-05-17 22:34:58 +01:00
Dylan K. Taylor
fb4d332d1a
Modernize private property declarations in src/inventory/transaction
2022-05-17 20:51:22 +01:00
Dylan K. Taylor
a06b9294df
Modernize private property declarations in src/inventory
2022-05-17 20:49:12 +01:00
Dylan K. Taylor
bf71eb448a
Reduce chaos in inventory classes
2022-03-22 17:19:55 +00:00
Dylan K. Taylor
2c29d272ad
BaseInventory: move setMaxStackSize() to a more sensible place
2022-03-22 17:11:48 +00:00
Dylan K. Taylor
98aa2b9ff9
Inventory: move removeItem() next to remove()
...
this should hopefully be more attention grabbing and a bit less misleading, since people will wonder why there are 'remove' and 'removeItem' both.
we really need to rename one of these...
2022-03-22 17:08:30 +00:00
Dylan K. Taylor
51a3043dfd
PlayerInventory: fixed isHotbarSlot() returning bogus result for 9
2022-02-20 20:29:51 +00:00
Dylan K. Taylor
d16b6fe61e
Merge branch 'stable' into staging/4.1
2022-01-28 20:40:07 +00:00
Covered123
6673289c33
Fixed spectator players being able to drop items ( #4775 )
...
closes #4765
2022-01-27 00:03:19 +00:00
Dylan K. Taylor
e986a0a4f2
Replace disallowed operators in src/inventory/
2022-01-20 19:20:32 +00:00
Dylan K. Taylor
a0bb7059c1
Merge remote-tracking branch 'origin/stable' into next-minor
2022-01-19 19:48:51 +00:00
Dylan K. Taylor
858024afb7
Remove useless docs noticed by php-cs-fixer 3.5
2022-01-18 00:24:12 +00:00
Dylan K. Taylor
75fc7a2d1f
Merge branch 'stable' into next-minor
2022-01-07 20:16:35 +00:00
Dylan K. Taylor
6d249026cc
Merge branch 'legacy/pm3' into stable
2022-01-07 20:15:15 +00:00
Dylan K. Taylor
e04dfe96af
Merge branch 'stable' into next-minor
2022-01-01 17:55:17 +00:00
Dylan K. Taylor
72f2c794ab
SimpleInventory: improved performance of setContents()
...
avoid the overhead incurred by clear() and setItem(), because in internalSetContents(), we already have no listeners or viewers to talk to anyway, so this is just spamming shit into /dev/null.
2021-12-31 18:32:19 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
fed59d3ebe
added missing file
2021-11-09 00:11:39 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
a5833327f0
Inventory: added getAddableItemQuantity()
...
this mostly reuses the code from canAddItem().
2021-10-11 21:46:27 +01:00
Dylan K. Taylor
5d4f14b388
Added TransactionBuilderInventory for server-side inventory transaction generation
2021-09-09 17:10:04 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
7ba573db77
Added API method Item::canStackWith()
2021-06-29 19:52:52 +01:00
Dylan T
32d7b1e6af
Start using webmozart/pathutil for joining paths ( #4287 )
2021-06-29 19:40:43 +01:00
Dylan K. Taylor
9b30c2feda
Extract a DelegateInventory from EnderChestInventory
2021-06-26 21:01:40 +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
aieuo
a6039ad733
Fixed InventoryHelpersTrait::addItem() cannot add items with a count greater than maxstack ( #4283 )
2021-06-26 16:48:53 +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
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
01794adef1
...
2021-05-05 22:24:23 +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
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
4c783f1037
shut
2021-05-02 13:43:37 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
c61f66d973
Removed ext-ds dependency
2021-02-11 15:40:37 +00:00
Dylan K. Taylor
3e1ac66abf
Merge branch 'stable'
2021-02-02 13:46:29 +00:00
Dylan K. Taylor
c70c0b55df
Separate held item index change listener logic from PlayerInventory
2021-01-12 16:44:25 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
d08c9ee634
Merge remote-tracking branch 'origin/stable'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/VersionInfo.php
2020-11-10 22:44:59 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
e1d80f05b1
Merge branch 'stable' into master
2020-08-03 20:14:46 +01:00
Dylan K. Taylor
1d18662d9b
InventoryAction: replace isValid() with validate() which throws TransactionValidationException
2020-07-04 19:38:34 +01:00
Dylan K. Taylor
cf5e31c619
InventoryTransaction::execute() now throws exceptions instead of returning true/false
2020-07-01 14:08:28 +01:00