Skip to content

Conversation

brachy84
Copy link
Member

@brachy84 brachy84 commented Aug 30, 2025

Mainly move from String keys for widget themes to specialized WidgetThemeKey<T>.
Additionally this pr:

  • allows to remove the widget theme type check in many situations
  • allows usage of sub widget themes. They are supposed to be used for widgets with the same type. Example is differentiation from normal item slots to player slots (item_slot:player).
  • sub widget themes can have sub widget themes. For example the player slot has sub themes for hotbar, main inventory, offhand and armor slots.
  • Separate widget themes for hover state. This allows not only for a hover texture, but any widget theme property can change on hover. (Specified in json with :hover suffix)
  • Added defaultHeight and defaultWidth properties to widget theme. Note that these have no effect if their respective method is overriden in a widget (f.e. TextWidget).
  • Added iconColor property to widget theme. This is applied to icon like textures.
  • Improved theme creation in java with better builders
  • Some minor improvements and fixes
  • Theme parsing was slighlty refactored.

Breaking Changes

  • String -> WidgetThemeKey<T>: This will break any custom themes in java.
  • WidgetTheme -> WidgetThemeEntry<?>: WidgetTheme is replaced with the name class in almost all places in Widget. The new class holds the standard old widget theme and the new hover widget theme. Any widget that overrides a draw or widget theme method will break.
  • The theme parsing refactor will likely affect the resulting theme, but will not error.

# Conflicts:
#	src/main/java/com/cleanroommc/modularui/api/drawable/IIcon.java
#	src/main/java/com/cleanroommc/modularui/test/TestGuis.java
#	src/main/java/com/cleanroommc/modularui/widgets/ButtonWidget.java
#	src/main/java/com/cleanroommc/modularui/widgets/slot/FluidSlot.java
@brachy84 brachy84 merged commit ff0a71c into master Sep 30, 2025
brachy84 added a commit to brachy84/ModularUI2-GTNH that referenced this pull request Oct 1, 2025
* minor improvements & comments for drawables

* lots of theme improvements

* introduce WidgetThemeKey & sub themes

* show theme id in debug info

* color type

* helpers for building themes in java

* minor additions (:trol:)

* fixes

* things

(cherry picked from commit ff0a71c)
@brachy84 brachy84 deleted the theme branch October 1, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant