This library is a very flexible component-based inventory framework for the minestom server framework.
It provides many examples and tries to stay up-to-date.
Can I open an inventory to multiple Players?
Yes and no. The actual inventories of Minestom are not really visible and backed by a PlayerView. Every player gets an own PlayerView, by opening a ViewComponent, but you could open one ViewComponents instance to multiple players, sharing the logic between multiple PlayerViews.Do I have to use multiple ViewComponents?
No, you can create your inventories with only one ViewProvider. You are not forced to use multiple ViewComponents, but it makes reusing logic within a ViewComponent easier.Do you support async adding and removing in pagination?
Yes, the pagination is very flexible. There are several examples on how to use it. Just look up the examples below.When is my onRebuild-method executed?
The method `PlayerView#executeRebuild()` allows view components to rebuild by themselves. Check out the example to see some usages for that. The method is also executed by the framework itself, if a new PlayerView is opened on a view component.Unfortunately, the actual documentation is still very small, but available in the Wiki.
To understand the usage of stomui in detail you can check out the examples.
These examples should provide a general overview over the api methods and what is possible with some small code parts.
- SimpleExampleProvider
- Shows most of the commonly used
ViewProvider/ViewComponentandViewItemapis and methods.
- Shows most of the commonly used
- CounterExampleProvider
- Shows an inventory with a button, which increments an int variable and displays the amount on the items title.
- CurrentTimeExampleProvider
- Shows an inventory, which gets updated using the scheduler of Minestom, to set the current time in the inventory's title.
These examples can help to understand some advanced behaviours of the framework.
- AllowInteractionExampleProvider
- Shows how to allow clicks on specific slots using
FlagandViewItemapi.
- Shows how to allow clicks on specific slots using
- AnnotatedTabExampleProvider
- Shows how to use annotations to render and modify
PrebuiltItemand listen to state/build changes.
- Shows how to use annotations to render and modify
- AnvilInputExampleProvider
- Heavy simplified example, which shows how to get the text input from an anvil inventory.
These examples grant a wide variety of pagination inventories, using pages, scroll rows/columns and even shows how to load items asynchronously.
- PageableExampleProvider
- Shows how to use pagination by
ViewRegistry#pageable(...)and theViewComponenthierarchy, by adding children. (Normal page)
- Shows how to use pagination by
- AsyncPageableExampleProvider
- Shows how to use pagination by
ViewRegistry#pageable(...)(Asynchronous pagination).
- Shows how to use pagination by
- ScrollableHorizontalExampleProvider
- Shows how to use pagination by
ViewRegistry#scrollable(...)and theViewComponenthierarchy, by adding children. (Horizontal pattern)
- Shows how to use pagination by
- ScrollableVerticalExampleProvider
- Shows how to use pagination by
ViewRegistry#scrollable(...)and theViewComponenthierarchy, by adding children. (Vertical pattern)
- Shows how to use pagination by
These examples show how to navigate between multiple inventories using navigation calls and history-management.
- SwitchParentProvider
- SwitchOneExampleProvider
- SwitchTwoExampleProvider
- Shows how to switch inventory between
SwitchOneExampleProviderandSwitchTwoExampleProvider. - Explains the difference between
navigation- andopen-Actions.
- Shows how to switch inventory between
- ViewHistoryExampleProvider
- Show how to use the builtin
PlayerViewhistory, to avoid reopening already opened inventories. - Works like a browser history with
back- andforward-Actions.
- Show how to use the builtin
These examples are somewhat extraordinary and could also be called "proof-of-concept" examples. Do not take them as fully implemented inventories. These only exist to test some very niche stuff, but maybe a good starting point.
- SearchExampleProvider
- Pagination example, which shows how to implement a searching inventory using the anvil search input.
- TwoPlayerExampleProvider
- Shared
ViewProviderby multiplePlayer, which shows how to open one provider to multiple players. - Allows players to have their own
PlayerView/inventory but the same logic provided by theViewProvider.
- Shared
This project is a copy of minestom-library-template.