Class EnchantWidgetFactory

java.lang.Object
johnsmith.enchantingoverhauled.client.gui.widget.enchant.EnchantWidgetFactory

public class EnchantWidgetFactory extends Object
A simple factory utility that translates an evaluated EnchantRenderState into the corresponding concrete EnchantWidget subclass implementation.
  • Constructor Details

    • EnchantWidgetFactory

      public EnchantWidgetFactory()
  • Method Details

    • createFrom

      public static EnchantWidget createFrom(int x, int y, EnchantRenderState state, int texIndex, boolean usePlainBackground, Runnable onPress)
      Instantiates the correct EnchantmentWidget object based on the state's classification.
      Parameters:
      x - The initial X position on the screen.
      y - The initial Y position on the screen.
      state - The data state containing the primary state enum mapping.
      texIndex - The deterministic texture variation index.
      usePlainBackground - Whether plain textures are enabled.
      onPress - The callback invoked when the widget is clicked.
      Returns:
      A constructed instance of a subclass of EnchantWidget.