Record Class WidgetLayoutConfig

java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.client.gui.widget.enchant.WidgetLayoutConfig
Record Components:
buttonWidth - The overall width of the enchantment slot background button.
buttonHeight - The overall height of the enchantment slot background button.
costWidth - The width of the lapis cost sprite indicator.
costHeight - The height of the lapis cost sprite indicator.
costXOffset - The internal X offset relative to the button origin for the cost sprite.
costYOffset - The internal Y offset relative to the button origin for the cost sprite.
powerXOffset - The internal X offset for the required XP power text.
powerYOffset - The internal Y offset for the required XP power text.
textXOffset - The internal X offset for the enchantment's name component.
textYOffset - The internal Y offset for the enchantment's name component.
textMaxWidth - The maximum pixel width allowed before the text wraps/truncates.

public record WidgetLayoutConfig(int buttonWidth, int buttonHeight, int costWidth, int costHeight, int costXOffset, int costYOffset, int powerXOffset, int powerYOffset, int textXOffset, int textYOffset, int textMaxWidth) extends Record
A configuration record encapsulating all static positioning and dimensional constants for the structural rendering of an EnchantWidget.

Extracted to avoid magic numbers and facilitate centralized UI scaling adjustments.

  • Field Details

    • DEFAULT

      public static final WidgetLayoutConfig DEFAULT
      The standard default layout definitions matching the vanilla enchanting UI proportions.
  • Constructor Details

    • WidgetLayoutConfig

      public WidgetLayoutConfig(int buttonWidth, int buttonHeight, int costWidth, int costHeight, int costXOffset, int costYOffset, int powerXOffset, int powerYOffset, int textXOffset, int textYOffset, int textMaxWidth)
      Creates an instance of a WidgetLayoutConfig record class.
      Parameters:
      buttonWidth - the value for the buttonWidth record component
      buttonHeight - the value for the buttonHeight record component
      costWidth - the value for the costWidth record component
      costHeight - the value for the costHeight record component
      costXOffset - the value for the costXOffset record component
      costYOffset - the value for the costYOffset record component
      powerXOffset - the value for the powerXOffset record component
      powerYOffset - the value for the powerYOffset record component
      textXOffset - the value for the textXOffset record component
      textYOffset - the value for the textYOffset record component
      textMaxWidth - the value for the textMaxWidth record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • buttonWidth

      public int buttonWidth()
      Returns the value of the buttonWidth record component.
      Returns:
      the value of the buttonWidth record component
    • buttonHeight

      public int buttonHeight()
      Returns the value of the buttonHeight record component.
      Returns:
      the value of the buttonHeight record component
    • costWidth

      public int costWidth()
      Returns the value of the costWidth record component.
      Returns:
      the value of the costWidth record component
    • costHeight

      public int costHeight()
      Returns the value of the costHeight record component.
      Returns:
      the value of the costHeight record component
    • costXOffset

      public int costXOffset()
      Returns the value of the costXOffset record component.
      Returns:
      the value of the costXOffset record component
    • costYOffset

      public int costYOffset()
      Returns the value of the costYOffset record component.
      Returns:
      the value of the costYOffset record component
    • powerXOffset

      public int powerXOffset()
      Returns the value of the powerXOffset record component.
      Returns:
      the value of the powerXOffset record component
    • powerYOffset

      public int powerYOffset()
      Returns the value of the powerYOffset record component.
      Returns:
      the value of the powerYOffset record component
    • textXOffset

      public int textXOffset()
      Returns the value of the textXOffset record component.
      Returns:
      the value of the textXOffset record component
    • textYOffset

      public int textYOffset()
      Returns the value of the textYOffset record component.
      Returns:
      the value of the textYOffset record component
    • textMaxWidth

      public int textMaxWidth()
      Returns the value of the textMaxWidth record component.
      Returns:
      the value of the textMaxWidth record component