Skip to content

4.0 migration guide

Juuxel edited this page Jun 9, 2021 · 2 revisions
  • Default background painters no longer have any padding applied.
    • If you're using the default WGridPanel instance created in the base GUI description classes, you don't necessarily need to do anything.
    • If you're manually setting a root panel, you can achieve the same end result by doing setInsets(Insets.ROOT_PANEL) on your root panel.
  • CottonHud methods are now static, so replace CottonHud.INSTANCE with CottonHud.
  • The 9patch background painter API has been reworked to use LibNinePatch, which has more features and less bugs. The background painter class itself was renamed from NinePatch to NinePatchBackgroundPainter.

Custom widgets/rendering code

  • Replace all ScreenDrawing methods that don't take MatrixStacks with their MatrixStack variants.
  • Any mouse handling methods now return an InputResult describing whether the input action was processed or ignored. As a rule of thumb: If your widget responds to doing things with the mouse, return PROCESSED.
  • Replace LibGuiClient.config.darkMode with LibGui.isDarkMode()
  • Replace WWidget.createPeers with WWidget.validate