-
Notifications
You must be signed in to change notification settings - Fork 462
Fabric API Lookup #1234
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
Fabric API Lookup #1234
Conversation
Yes it builds :)
Also includes stuff related to the util classes
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.
Has been nice to use and works well
* @Nullable | ||
* A find(ItemStack stack, C context); | ||
* // Expose the API for some item. | ||
* void register(ItemStackApiProvider<A, C> provider, Item item); |
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.
the reason checkstyle complained here is you need to use the html entity codes for <
and >
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.
Then it fails to render correctly as the {@code}
tag already escapes them, I tried that first...
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.
It won't render in IDE but the doclet will render it
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.
gradlew javadoc
was unable to render them correctly when I tried on my laptop - just disable the inspection and be done with it, there are more important things in life and javadoc escaping is weird anyway. :P
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.
Fun fact: the @
symbol in the javadoc is not a regular @
😆 (https://stackoverflow.com/a/46332643/13567109).
Oops sorry @liach i didn’t mean to add you as a reviewer again. Feel free to though :) |
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.
My previous questions are addressed already. Just a side note that when we add apiNote etc. command line tags, we should probably move <p>Note:
to those tags.
I moved away from using |
This is what you need https://github.com/FabricMC/yarn/blob/0025fbf845a27efa50d44ba1e2bac7c028eea57d/build.gradle#L722-L726 |
Ok that's interesting, will be good to have eventually. |
I've scanned through this briefly and it seems consistent with the original intent and well-considered in its implementation. Nice job. Would it support client-side lookups? From what I read it appeared it may be server-side only. |
Thanks! Client-side lookups are possible, it's just that the |
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.
Good now as far as I can tell. Thanks!
* Use "may not" instead of "cannot", and end sentences with a period. * Remove null checks for vararg parameters: passing a null vararg is unlikely and will cause an NPE directly anyway.
# Fabric API Lookup API v1 ## Introduction This module allows Api instances to be associated with game objects without specifying how the association is implemented. This is useful when the same Api could be implemented more than once or implemented in different ways. Many thanks to @grondag for providing the original concept (#1072). Thanks also go to @i509VCB, @Pyrofab, @sfPlayer1 and the others who were involved with the design of this module. This is the foundation upon which can be built for example a fluid transfer api (#1166). Closes #1199. ## Flexible Api Querying ## Block Api Usage example ## Building blocks This PR was changed a lot, please have a look at the README, the package info, and the javadoc for `BlockApiLookup` and `ApiLookupMap` for up-to-date documentation. ## More usage examples FastTransferLib (https://github.com/Technici4n/FastTransferLib) is an experiment to build an item, fluid and energy transfer api on top of this module. (Which was until recently called `fabric-provider-api-v1`.) ## Missing things? ~~I could add an overload of `BlockApiLookup#find` with nullable `BlockState` and `BlockEntity` parameters, so that the caller can directly provide them if they are available for some reason.~~ Added in later commits. There is no module to retrieve apis from items or entities yet because there were unsolved issues with those. The community can use the provided building blocks to experiment with their own implementations of `ItemStackApiLookup` and `EntityApiLookup` until the way forward becomes clear, but let's please not delay the `BlockApiLookup` because of that. Co-authored-by: i509VCB <[email protected]> Co-authored-by: PepperBell <[email protected]> (cherry picked from commit dc716ea)
# Fabric API Lookup API v1 ## Introduction This module allows Api instances to be associated with game objects without specifying how the association is implemented. This is useful when the same Api could be implemented more than once or implemented in different ways. Many thanks to @grondag for providing the original concept (FabricMC#1072). Thanks also go to @i509VCB, @Pyrofab, @sfPlayer1 and the others who were involved with the design of this module. This is the foundation upon which can be built for example a fluid transfer api (FabricMC#1166). Closes FabricMC#1199. ## Flexible Api Querying ## Block Api Usage example ## Building blocks This PR was changed a lot, please have a look at the README, the package info, and the javadoc for `BlockApiLookup` and `ApiLookupMap` for up-to-date documentation. ## More usage examples FastTransferLib (https://github.com/Technici4n/FastTransferLib) is an experiment to build an item, fluid and energy transfer api on top of this module. (Which was until recently called `fabric-provider-api-v1`.) ## Missing things? ~~I could add an overload of `BlockApiLookup#find` with nullable `BlockState` and `BlockEntity` parameters, so that the caller can directly provide them if they are available for some reason.~~ Added in later commits. There is no module to retrieve apis from items or entities yet because there were unsolved issues with those. The community can use the provided building blocks to experiment with their own implementations of `ItemStackApiLookup` and `EntityApiLookup` until the way forward becomes clear, but let's please not delay the `BlockApiLookup` because of that. Co-authored-by: i509VCB <[email protected]> Co-authored-by: PepperBell <[email protected]>
# Fabric API Lookup API v1 ## Introduction This module allows Api instances to be associated with game objects without specifying how the association is implemented. This is useful when the same Api could be implemented more than once or implemented in different ways. Many thanks to @grondag for providing the original concept (FabricMC#1072). Thanks also go to @i509VCB, @Pyrofab, @sfPlayer1 and the others who were involved with the design of this module. This is the foundation upon which can be built for example a fluid transfer api (FabricMC#1166). Closes FabricMC#1199. ## Flexible Api Querying ## Block Api Usage example ## Building blocks This PR was changed a lot, please have a look at the README, the package info, and the javadoc for `BlockApiLookup` and `ApiLookupMap` for up-to-date documentation. ## More usage examples FastTransferLib (https://github.com/Technici4n/FastTransferLib) is an experiment to build an item, fluid and energy transfer api on top of this module. (Which was until recently called `fabric-provider-api-v1`.) ## Missing things? ~~I could add an overload of `BlockApiLookup#find` with nullable `BlockState` and `BlockEntity` parameters, so that the caller can directly provide them if they are available for some reason.~~ Added in later commits. There is no module to retrieve apis from items or entities yet because there were unsolved issues with those. The community can use the provided building blocks to experiment with their own implementations of `ItemStackApiLookup` and `EntityApiLookup` until the way forward becomes clear, but let's please not delay the `BlockApiLookup` because of that. Co-authored-by: i509VCB <[email protected]> Co-authored-by: PepperBell <[email protected]> (cherry picked from commit dc716ea)
Fabric API Lookup API v1
Introduction
This module allows Api instances to be associated with game objects without specifying how the association is implemented. This is useful when the same Api could be implemented more than once or implemented in different ways.
Many thanks to @grondag for providing the original concept (#1072).
Thanks also go to @i509VCB, @Pyrofab, @sfPlayer1 and the others who were involved with the design of this module.
This is the foundation upon which can be built for example a fluid transfer api (#1166). Closes #1199.
Flexible Api Querying
Block Api Usage example
Building blocks
This PR was changed a lot, please have a look at the README, the package info, and the javadoc for
BlockApiLookup
andApiLookupMap
for up-to-date documentation.More usage examples
FastTransferLib (https://github.com/Technici4n/FastTransferLib) is an experiment to build an item, fluid and energy transfer api on top of this module. (Which was until recently called
fabric-provider-api-v1
.)Missing things?
I could add an overload ofAdded in later commits.BlockApiLookup#find
with nullableBlockState
andBlockEntity
parameters, so that the caller can directly provide them if they are available for some reason.There is no module to retrieve apis from items or entities yet because there were unsolved issues with those. The community can use the provided building blocks to experiment with their own implementations of
ItemStackApiLookup
andEntityApiLookup
until the way forward becomes clear, but let's please not delay theBlockApiLookup
because of that.