User Tools

Site Tools


tutorial:transfer-api_item_storage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
tutorial:transfer-api_item_storage [2022/02/04 17:37] – external edit 127.0.0.1tutorial:transfer-api_item_storage [2025/12/18 10:18] (current) – clarify why ItemStorage.of makes assumptions b0undarybreaker
Line 70: Line 70:
 [[https://github.com/FabricMC/fabric/blob/1.18/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/PlayerInventoryStorage.java|PlayerInventoryStorage]] serves a similar purpose, but for player inventories. Make sure to read its documentation, it contains very useful functions such as ''offerOrDrop''. [[https://github.com/FabricMC/fabric/blob/1.18/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/PlayerInventoryStorage.java|PlayerInventoryStorage]] serves a similar purpose, but for player inventories. Make sure to read its documentation, it contains very useful functions such as ''offerOrDrop''.
  
-**A word of caution**: To be able to support transactions, ''ItemStorage.of'' assumes that each slot in the inventory is independent of other slots, and of other inventories. Do NOT use it if that is not the case for your inventory.+**A word of caution**: To be able to support transactions, ''ItemStorage.of'' assumes that each slot in the inventory is independent of other slots, and of other inventories. Do NOT use it if that is not the case for your inventory - if you do, there could be side effects that get left behind when a transaction is reverted.
  
 ===== How to implement Storage<ItemVariant> ===== ===== How to implement Storage<ItemVariant> =====
tutorial/transfer-api_item_storage.1643996240.txt.gz · Last modified: 2022/02/04 17:37 by 127.0.0.1