# 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 <git@i509.me>
Co-authored-by: PepperBell <44146161+PepperCode1@users.noreply.github.com>
* Move command API icon to correct location
* Add client-sided command API
* Add jd note about threads
* Add license headers
* ArgumentBuilders => ClientArgumentBuilders
* Yeet custom prefixes
* Migrate testmod to lifecycle-events-v1
* Improve client command test
* Make client command test more similar to the server one
* Update to new yarn names
* Add handling for requires() in command suggestions
* Remove outdated TODO
* Playerification
* Clarify comments in ClientCommandInternals
* Use "s" instead of "it"
* Improve CommandSyntaxException logging
* Add missing import
* Add /fcc help command
* Add comments about server-client precedence rules
* Add missing license header
* Add /fabric-command-api-v1:client as an alias for /fcc
This migrates all uses of v0 networking to v1 api, and changes the readme to not mention networking-v0 in the example for dependencies.
This effectively makes v0 removable if it breaks in the future beyond repair. Though I expect v0 to last quite a bit longer.
* Implement screen api
* Actually update to 20w27a
* Split render and tick events to before and after
* Rename and update
* A bit of javadoc and profiler name fixes
* Add functional interface annotations, move render and ticking events to actual FabricScreen instance.
* Add after screen resize event
* Implement key and mouse click/press and release events.
* Move keyboard and mouse events to their own pojos
* Init and resize are the same thing. Maybe Screen#init needs a rename
* Add mouse scroll events
* checkstyle
* Refresh event instances after init
* Before init is nessecary to listen to addition/removal of child elements
* Polish up the javadoc and do a rename to the public api interface.
* Mappings updates on testmod
* javadoc formatting again
* Rework screen api design to be more ergonomic.
* Add remove event, some javadoc
* Add allow phase
* Module dependencies
* Fix null ticking when no screen is open
* Refer to GLFW constants in mouse click/release events
* Keyboard event GLFW constant javadoc
* Remove redundant qualifier
* Some docs, degetterifying
* Because global go brr add screen params back around
* Add module lifecycle to FMJ
* Add custom value denoting module lifecycles.
* Make the module validation work.
My hand has been forced - we must use buildSrc since JsonSlurper is not available in main buildscript.
* Apply task to each project and dont cross projects
* A horrible hack
* Wait what
* It works now.
* Not needed
* Drop unneeded maven repo, cache map lookup
* Correct ordinal of `afterWorldChanged` mixin to the correct return
Co-authored-by: i509VCB <git@i509.me>
* Handle null entity when unable to be created
* Comply with Checkstyle
* Remove redundant ordinal and only use null return to check valid teleports
Co-authored-by: Player <player@player.to>
Co-authored-by: i509VCB <git@i509.me>
Co-authored-by: Player <player@player.to>
* Allow passing UV coordinates as Vec2f
Rotating UV coordinates using vector math becomes extremely annoying when every `sprite` call requires the individual `u` and `v` coordinates to be extracted again.
This change will allow passing UV coordinates in a container that will always be available.
* Revert b0fe27e0d7
* Allow Vec2f UVs in MutableQuadView
This seems like the better place to put this.
* Fix return type
oops
* Add override in QuadEmitter
* Fix JavaDoc styling
* Duplicate JavaDoc and function definition
There is probably a way in Java to override the method while keeping the JavaDoc, but I can't be bothered, and this way, the user gets a more relevant JavaDoc anyway.
* Remove Trailing Whitespace
I'm pretty sure QuadEmitter allowed trailing whitespace, though...
* Fix JavaDoc styling in QuadEmitter
Also removes trailing whitespace
* Add WorldRenderEvents
* Fix typos
* Incorporate PR feedback
* Simplify context and block outline events
* Update implementation
* Ensure the BLOCK_OUTLINE mixin does nothing if BEFORE_BLOCK_OUTLINE mixin is disabled
* Document event order in class header
* Update fabric-rendering-v1/src/main/java/net/fabricmc/fabric/api/client/rendering/v1/WorldRenderEvents.java
Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
* Add environment tag to nested type
* More envionment tags
Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
* Entity Events v1.
First up is an event fired after a living entity is damaged. All vanilla living entities except armor stands work with this event.
* Events related to killing of entities, changing world, player respawn/copyFrom
Death related:
an entity killing something and an entity being killed by an adversary
Player related:
After respawn, copy to
* Adversary stuff isn't needed
* checkstyle again
* Call AFTER_KILLED_OTHER on a ServerPlayerEntity upon death.
* Add event which is fired when a player first joined a server and add functional interface annotations
* Update build.gradle
* mispelled
* Some renames, test events, drop damage event
Damage events need further consideration in future
* Comments and null check
* Update for mappings
* Warning comment
* Remove first join event and teleport helper
First join does not work atm and teleport is in dimensions pr
* Module dependencies
* Javadoc tweaks
* The serverening
* Fix example implementation of using FAPI modules for Groovy
The previous implementation does not quite correctly describe what it does
* Improve description of adding dependencies
* Undo the last commit changes for Kotlin DSL
* Fix resource reload listeners not being sorted.
Fix missing/broken reload listener keys.
Add a debug log line for missing reload keys
Add some basic tests.
* Undo adding new keys, we can look at this later.
* use AssertionError
* Fix test on server