-
Notifications
You must be signed in to change notification settings - Fork 31
Navigating Between Views
Natan Vieira edited this page May 30, 2023
·
22 revisions
Navigation between screens is a built-in feature in IF that allows you to move between screens in a simple way.
This example opens the A
view when the player clicks in a item in the B
view.
class A extends View {
@Override
public void onFirstRender(RenderContext render) {
// Moves player to "B" view on click
render.firstSlot(...).onClick(click -> click.open(B.class));
}
}
class B extends View { ... }
It is possible to return to the previous screen using .back()
the name of this is "Browsing History" as soon as a screen is opened from another this function will take the player back to the previous screen.
class A extends View {
@Override
public void onFirstRender(RenderContext render) {
// Moves player to "B" view on click
render.firstSlot(...).onClick(click -> click.open(B.class));
}
}
class B extends View {
@Override
public void onFirstRender(RenderContext render) {
// Moves player back to "A" view
render.firstSlot(...).onClick(click -> click.back());
}
}
- Installation
- Introduction
- Advanced Usage
- Built-In Features
- Extra Features
- Anvil Input
- Proxy Inventory