Показати зміни
## Additions
### Cross-referencing in UI models
When instantiating templates in a UI model, you can use the new `<template-name>@<ui-model-id>` syntax to reference a template from a different UI model. This allows much greater flexibility than before in modularizing and re-using templates across different screens.
Along with this change, the `<components>` element in UI model definitions is no longer required.
### UI
- The `blur()` surface now supports parsing from UI models
- `BaseOwo*Screen` implementations now provide the `component(...)` shorthand for `this.adapter.rootComponent.childById(...)`
- Layers can now align their components relative to Minecraft's handled screen coordinates using `alignComponentToHandledScreenCoordinates(...)` on the instance
- `Surface.PANEL_INSET` was added, which renders an inset area to be used inside `Surface.PANEL` - this looks very similar to the vanilla recipe book panel
- Two new components, `smallCheckbox(...)` and `slimSlider(...)`, were added - they function mostly identically to the already existing counterparts, but (as the name implies) take up less space and offer more customizability
- `TextAreaComponent`, a third new component, is an extension of vanilla's new `EditBoxWidget` for general-purpose use and optimized to play nicely within an owo-ui context
- `ItemComponent` offers a new property, `setTooltipFromStack`, which always keeps the component's tooltip in sync with the item stack it's displaying
- The height of each line a `LabelComponent` can now be configured using the new `lineHeight` property, which allows properly supporting non-standard fonts
- Components can now be placed at fixed percentage across their parent without respecting the components own size using `Positioning.across()`
- `StackLayout` respects much the same layout rules as `FlowLayout`, but doesn't place components next to each other - instead it places them on top of each other, thus creating a stack of components
- `Containers.ltrTextFlow(...)` creates a new type of FlowLayout, which works just like `Components.horizontalFlow(...)` but wraps when it exceeds its own width - just like how left-to-right text is laid out in a document
- Block, item, and entity components now support NBT (and in the case of blocks, block state data) when being parsed from a UI model
### Config
Server-sided retrieval of a client's config options has been made more ergonomic. For this purpose, the generated config wrapper now exposes the key of each individual option through the `.keys` object. Further, `ConfigSynchronizer.getClientOptions` received a new override which directly accepts the config wrapper, enabling the following API:
```java
var optionValue = ConfigSynchronizer.getClientOptions(player, MyMod.CONFIG).get(MyMod.CONFIG.keys.someOption);
```
### Misc
- owo-sentinel now lists the mod which included it in addition to all mods that depend on owo, in an effort to reduce confusion when mod authors don't declare their dependency (BasiqueEvangelist, #123)
- `AutoRegistryContainer` provides two new convenience functions:
- `.register(...)`, which is simply an alias for `FieldRegistrationHandler.register(...)`
- `.conform(...)`, which forcefully casts a `Class<?>` to a `Class<T>` for implementing `getTargetFieldType()` for parametrized classes
## Changes
### UI
- `HUD` now processes removal requests before add requests, allowing HUD components to be properly reloaded within the same frame
- When the inspector draws slot indices in a handled screen, it now uses `H:` to denote the slot index in the handler and `I:` to indicate that slot's index into its respective inventory
- The `file(...)` UI model data source is now deprecated in favor of a new, configurable hot reload system which is only active in development. This way, you cannot accidentally ship your mod with the file data source enabled, causing it to crash in production
- `NinePatchRenderer` was renamed to `NinePatchTexture` and reworked to function in a data-driven manner. No old functionality has been removed yet, it was however deprecated. More details on how to use the new implementation will be added to the documentation shortly
## Fixes
### UI
- `ItemComponent`s once again use correct lighting on side-lit models *and* apply lighting properly when non-side-lit models are scaled down
- `LabelComponent` now properly fetches the text style under the cursor when determining which hover and click events to execute
- `TextFieldWidget` and `EditBoxWidget` now have their `tick()` function called when wrapped by owo-ui, making their cursors blink properly
- `ScrollContainer.scrollTo(...)` now works properly on horizontal containers and has a new overload for directly specifying the target scroll offset without supplying a component
### Config
- owo-config screen providers are now once again properly listed in Mod Menu
### Misc
- `ParticleSystemController`s no longer forcefully require handshaking when merely mentioned, fixing optional handshaking (BasiqueEvangelist, #123)
- By utilizing new API within Roughly Enough Items, handled screens built with owo-ui now properly layer with the REI overlay - there should be no more over- and underdraw
---
Finally, the following previously deprecated API elements have been removed:
- `VerticalFlowLayout` and `HorizontalFlowLayout`, which have been replaced by instantiating `FlowLayout` with the respective Algorithm
- `OptionComponent` and `OptionComponents.createSlider`, which were replaced by `OptionValueProvider` and `OptionComponents.createRangeControls` respectivel
- `SliderComponent#onChanged`, replaced by the respective event stream