1.20 -> 1.21 Upgrading Guide¶
Theme Customization¶
The theme system was fully introduced in 1.20.2, allowing users to change all the text colors, which means you should no
longer hardcode any color via Component#withStyle
. Instead, use things
like IThemeHelper.get().success(componentOrString)
to highlight your text.
Also, there is a IThemeHelper.get().isLightColorScheme()
method provided to check if the current background color is
light or dark, so you can adjust your text color accordingly.
Line Spacing¶
Now, There is a 2-pixel line spacing between each line. You can use tooltip.setLineMargin(index, side, margin)
to
adjust the margin for each line.
You should only modify the margins for the lines that you added.
For example, if you added the last line, to remove the spacing between the last two lines:
tooltip.setLineMargin(-1, ScreenDirection.UP, -2);
For the rule of calculating margins, see Margin collapsing.
Callbacks¶
Now, the whole tooltip is also an IElement
, so some callbacks' parameters are changed. You need to get the current
tooltip using rootElement.getTooltip()
.
IServerExtensionProvider¶
In the last major version, I forgot to change the signature of IServerExtensionProvider#getGroups
. Now it is fixed to
respect the changes in IServerDataProvider
.
The first type parameter of IServerExtensionProvider
is removed, and there is only one type parameter now.
The target
parameter of the getGroups
method has been removed. You can still get the target from accessor.getTarget()
, but it may
be null
because the context is now allowed without a block entity.
IWailaCommonRegistration¶
You can now pass a block class when registering an IServerDataProvider
or IServerExtensionProvider
, which means that you can now add
server data providers for blocks that do not have a block entity.
Canceling requests¶
A new method called shouldRequestData
is added to IServerDataProvider
and IServerExtensionProvider
to determine on the client side
whether you should request data from the server. In most cases, you should not check for plugin settings in this method. The method
returns true
by default.
IElementHelper¶
ITooltip#getElementHelper
has been removed. You should now use IElementHelper.get()
directly.
Renaming¶
snownee.jade.api.Identifiers
is renamed tosnownee.jade.api.JadeIds
snownee.jade.api.ui.Direction2D
is renamed tosnownee.jade.api.ui.ScreenDirection