113 Commits

Author SHA1 Message Date
Dylan K. Taylor
7b0816e42f
Properly handle transaction building errors instead of kicking the player 2023-03-20 00:52:26 +00:00
Dylan K. Taylor
a573a279fa
Merge branch 'minor-next' into item-stack-request 2023-03-14 22:25:49 +00:00
Dylan K. Taylor
cfa1e7486a
Move legacy recipes and creative items in-house
having them here allows BedrockData to represent latest versions freely, without being limited by technical limitations of PM4.
2023-02-02 15:25:03 +00:00
Dylan K. Taylor
8633804f15
InventoryManager: disentangle slot tracking from slot syncing 2023-01-06 20:26:19 +00:00
Dylan K. Taylor
2e9a3f9160
Working crafting :woohoo: 2023-01-04 22:29:29 +00:00
Dylan K. Taylor
0d169b4e80
Filesystem: added fileGetContents to reduce ErrorToExceptionHandler boilerplate code 2022-12-25 17:13:51 +00:00
Dylan K. Taylor
d79e6354a0
Merge branch 'stable' into next-minor 2022-11-25 14:41:05 +00:00
Dylan K. Taylor
a66f966b08
Update API documentation for Inventory methods 2022-11-15 21:00:13 +00:00
Dylan K. Taylor
824ed0a56a
Merge branch 'stable' into next-minor 2022-11-07 15:04:48 +00:00
alvin0319
1e9d83f014
BaseInventory: validate given array in setContents() (#5391) 2022-11-07 13:09:05 +00:00
Dylan K. Taylor
cdbdcb5d67
Merge branch 'stable' into next-minor 2022-11-04 20:44:28 +00:00
Dylan K. Taylor
2fdc46c165
PHPStan 1.9 features 2022-11-04 20:23:34 +00:00
Dylan K. Taylor
7bcc663b60
Migrate core code to using symfony/filesystem
webmozart/path-util is retained for plugin compatibility, but is dropped in 5.0
2022-10-14 21:51:29 +01:00
Dylan K. Taylor
3feaa18f6c
DelegateInventory: use WeakReference and __destruct to clean up inventory listener
this is more sane, since it allows the delegate to be reused without unexpected behaviour.
2022-09-30 15:12:37 +01:00
Dylan K. Taylor
441b06f6c7
Merge branch 'stable' into next-minor 2022-09-15 12:44:53 +01:00
Dylan K. Taylor
6866c86d39
BaseInventory: fix CS 2022-09-02 19:36:45 +01:00
Dylan K. Taylor
a735a69870
BaseInventory: improve type info available to setContents() and internalSetContents() 2022-09-02 19:36:08 +01:00
Dylan K. Taylor
a0ea74c08f
Inventory: Improve quality of type info of arrays 2022-09-02 19:34:12 +01:00
Dylan K. Taylor
c16893cbac
Merge branch 'stable' into next-minor 2022-08-25 19:25:19 +01:00
Dylan K. Taylor
5426b41447
InventoryTransaction: prevent client-authoritative item overstacking
this cheat is often used to carry more items in the inventory, wear multiple pieces of armour in one slot, and more.
2022-08-21 20:35:23 +01:00
Dylan K. Taylor
792c1b62b7
Introduce and use TransactionBuilder for inventory evacuations 2022-08-18 17:04:12 +01:00
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