Dylan K. Taylor
cd59e272bc
PHPStan 2.0 fixes
2025-01-07 22:10:42 +00:00
Dylan K. Taylor
905a10e980
Deprecate InventoryAction->onAddToTransaction()
...
this never made any sense
2024-11-25 21:39:35 +00:00
Dylan K. Taylor
5325ecee37
Deal with a whole lot of PHPStan suppressed key casting errors
...
closes #6534
2024-11-25 14:30:58 +00:00
kostamax27
d2c3b8dacb
Fix GC cycle count increases on player disconnect ( #6487 )
2024-11-11 16:10:19 +01:00
ShockedPlot7560
f6e2a1ecce
Validate transaction slots ( #6304 )
2024-09-09 09:48:38 +02:00
Dylan K. Taylor
1504fdca24
Use 'enchanting' terminology
...
'enchant' just didn't feel right, being a verb.
All these things pertain to the act of enchanting.
This is now also consistent with CraftingTransaction etc. The ship already sailed on EnchantInventory, which will have to be renamed at a later datte. However, that was already inconsistent with 'enchanting table', so that's the odd one out here.
2023-08-23 16:14:17 +01:00
Dylan K. Taylor
bf668c0f6c
Rename EnchantHelper related stuff
...
Perhaps this and EnchantOption should be called EnchantingHelper and EnchantingOption respectively. The terminology used is rather inconsistent, but 'enchantment' definitely isn't the right word here.
2023-08-23 16:07:02 +01:00
Dylan K. Taylor
d942748203
Move enchanting seed generation to EnchantmentHelper
2023-08-23 15:52:49 +01:00
Dylan K. Taylor
b2414b4c29
EnchantTransaction: cleanup XP cost checking logic
2023-08-18 12:33:07 +01:00
Dylan K. Taylor
beaca8bb6d
EnchantTransaction: fixed XP level costs when minimum level is less than the XP cost
...
this can happen and happens in vanilla too. In these cases, as much of the XP cost as possible is deducted.
2023-08-16 14:51:47 +01:00
S3v3Nice
39867b97c5
Implement enchanting using enchanting tables ( #5953 )
...
Co-authored-by: Dylan K. Taylor <dktapps@pmmp.io>
2023-08-15 17:28:26 +01:00
BrandPVP
c01d2dc718
CreativeInventory per Player ( #5694 )
2023-07-06 11:08:13 +01:00
Dylan K. Taylor
de49910e84
Fix CS
2023-05-31 22:18:25 +01:00
Dylan K. Taylor
0ed5e94a72
Merge branch 'minor-next' into major-next
2023-05-30 16:15:56 +01:00
ShockedPlot7560
db95bf8b9b
Caching creative inventory entries ( #5703 )
...
Due to the high cost of Item::serializeCompoundTag(), it's very costly to rebuild this every time we need it. This is sent during the pre-spawn step, where we need to minimize costs as much as possible.
2023-05-18 14:11:28 +01:00
Dylan K. Taylor
7cdf6b0946
Fixed merge error
2023-05-06 17:29:59 +01:00
Dylan K. Taylor
5c7f4570b4
Merge branch 'minor-next' into major-next
2023-05-06 17:20:37 +01:00
Dylan K. Taylor
84a943bcec
BaseInventory: slap a TODO on isSlotEmpty()
2023-05-05 16:06:37 +01:00
Dylan K. Taylor
eb136e60c8
BaseInventory: added getMatchingItemCount() helper
...
this eliminates the performance issues described by #5719 .
closes #5719
we may want to consider exposing a public API for this in the future, since it might be useful for plugins.
2023-04-27 21:08:35 +01:00
Dylan K. Taylor
4228880509
BaseInventory: change dumb variable names in internalAddItem()
2023-04-27 20:29:02 +01:00
Dylan K. Taylor
709d874204
BaseInventory: clean up max stack size handling
...
we can safely assume that:
- the inventory's max stack size won't change during the operation
- two items which stack together have the same max stack size
- the item's max stack size won't change during the operation
2023-04-27 20:27:05 +01:00
Dylan K. Taylor
7f6269c432
Introduce and use optimised versions of Inventory->isSlotEmpty()
...
this avoids useless cloning, improving the performance of several functions.
2023-04-27 16:52:52 +01:00
Dylan K. Taylor
023460db2c
BaseInventory: fixed internalAddItem() doing useless canStackWith() checks on null items
...
if the item is null, it's never going to stack with anything given to this function, because addItem() already discards null items.
2023-04-27 14:53:54 +01:00
Dylan K. Taylor
499b29b53a
Merge branch 'minor-next' into major-next
2023-04-12 21:04:08 +01:00
Dylan K. Taylor
7e92da126d
DelegateInventory: fixed slots being synced twice and breaking ItemStackRequests
...
the second time the slot is synced, there is no prediction, so the slot update isn't associated with a request anymore. This causes subsequent requests in the same packet to fail, since the dependency request ID isn't associated with the slot anymore.
This change fixes the problem by only allowing the backing inventory to trigger a call to DelegateInventory->on*Change(). While we could have removed and re-added the listener instead, this way is safer since it doesn't assume that the backing inventory won't modify the given item in setItem().
closes #5692
2023-04-12 15:43:51 +01:00
Dylan K. Taylor
7e1467f3f7
Merge branch 'minor-next' into major-next
2023-04-05 20:14:59 +01:00
Dylan K. Taylor
6e8eda4ac1
Fixed creative inventory items getting modified by ItemStackRequests
2023-04-03 22:22:21 +01:00
Dylan K. Taylor
453ad997e9
Merge branch 'item-stack-request' into item-stack-request-pm5
2023-03-20 22:05:12 +00:00
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
dace20ad1f
Merge branch 'item-stack-request' into item-stack-request-pm5
2023-03-14 22:34:47 +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
7608d5f04e
Use BedrockDataFiles in more places
2023-02-23 22:03:35 +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
b6982a84ef
Merge branch 'next-minor' into next-major
2022-11-25 14:52:56 +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
a205d64732
Merge branch 'next-minor' into next-major
2022-11-12 17:02:56 +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
01bad344a0
Merge branch 'next-minor' into next-major
2022-11-04 20:47:26 +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
f88ae93897
BC break: Replaced webmozart/path-util with symfony/filesystem, closes #5332
2022-10-13 16:43:36 +01:00
Dylan K. Taylor
8c651ce4b4
t Merge remote-tracking branch 'origin/next-minor' into next-major
2022-10-11 22:06:18 +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
f80ffd8de0
Merge branch 'next-minor' into next-major
2022-09-15 13:59:21 +01:00