-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transfer API: Add slotted storage and non-empty iterator #2908
Conversation
...transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/InventoryStorage.java
Show resolved
Hide resolved
...ransfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/SlottedStorage.java
Show resolved
Hide resolved
474ff78
to
7df5541
Compare
… UnmodifiableView annotations
7df5541
to
a8e836a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
...transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/InventoryStorage.java
Outdated
Show resolved
Hide resolved
...transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/InventoryStorage.java
Outdated
Show resolved
Hide resolved
* for example {@link StorageUtil#insertStacking} or {@link ContainerItemContext#getAdditionalSlots()}. | ||
* | ||
* <p>It is guaranteed that calling this function is fast. | ||
* The default implementation returns a view over the storage that delegates to {@link #getSlotCount} and {@link #getSlot}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have @implSpec
here for specifying the default impl? (Yarn adds it to its list of javadoc tags at least)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly we don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(They just vanish if you run gradlew javadoc
...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a good improvement for a future PR, they're really easy to add:
https://github.com/FabricMC/yarn/blob/4eed62e0827b13c25af0a5b1262fb204c9ddbf52/build.gradle#L554-L558
fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/impl/transfer/TransferApiImpl.java
Outdated
Show resolved
Hide resolved
* Transfer API: Add non-empty iterator * Add SlottedStorage * Add StorageUtil.extractAny * Undeprecate ContainerItemContext.withInitial * Add licenses * Revert "Undeprecate ContainerItemContext.withInitial" This reverts commit dcf123e. * Tweaks * Make SlottedStorage#getSlots return a view, remove useless field, add UnmodifiableView annotations * Remove useless @inheritdoc * Fix infinite loop in the tests
* Transfer API: Add non-empty iterator * Add SlottedStorage * Add StorageUtil.extractAny * Undeprecate ContainerItemContext.withInitial * Add licenses * Revert "Undeprecate ContainerItemContext.withInitial" This reverts commit dcf123e. * Tweaks * Make SlottedStorage#getSlots return a view, remove useless field, add UnmodifiableView annotations * Remove useless @inheritdoc * Fix infinite loop in the tests
StorageUtil.extractAny
.SlottedStorage
that allows storages to optionally expose a slot list. This is optional, and is meant for usage by chest-like inventories.SingleVariantStorage#getBlankVariant
.TransferApiImpl
.None of these should be breaking changes.