-
Notifications
You must be signed in to change notification settings - Fork 22
Anvil Input
Natan Vieira edited this page Dec 5, 2024
·
41 revisions
Anvil Input allows the developer to process what the player wrote in an anvil's text field.
Anvil Input is experimental and is not subject to the general compatibility guarantees given for the standard library: the behavior of such API may be changed or the API may be removed completely in any further release.
Server version | Minimum IF version | Status |
---|---|---|
1.8-1.19 | ||
1.20 | v3.0.0 | ✅ Supported |
1.20.2 | v3.0.3 | ✅ Supported |
1.20.4 | v3.1.0 | ✅ Supported |
1.21 | v3.2.0 | ✅ Supported |
Anvil Input is a Protocol-Level Integration so its behavior is based on the current version and software of the server it is running on and may be inconsistent. See the Versions Compatibility table to know if it will work on your server.
Anvil Input is a external feature so you need to include it on your project build file
implementation 'me.devnatan:inventory-framework-anvil-input:<version>'
And install it in your ViewFrame in order to be able to use it
viewFrame.install(AnvilInputFeature.AnvilInput);
Anvil Input feature is often used for "searching something"-like views, it integrates very well with other features like Context Flows without having to write extra code for it.
Now you know everything!! Lets get started 🚀
In your view, create a new AnvilInput
instance to get started.
final AnvilInput anvilInput = AnvilInput.createAnvilInput();
Then, apply it into your view configuration.
Use use(Modifier)
to apply Anvil Input as a configuration modifier.
@Override
public void onInit(ViewConfigBuilder config) {
config.title("Hello world")
.use(anvilInput); // <-- Look here
}
...This document is still being written...
Here's some details that you may want to know about Anvil Input feature.
- Internally Anvil Input is a State value like Pagination so you access its value using
anvilInput.get(context)
; - You need to apply Anvil Input state on your configuration because it's a Configuration Modifier;
- It's a External Feature so installation in your ViewFrame is needed to work;
- And then, it's a Protocol-Level Integration so its behavior may change depending on your game version or even be completely incompatible.