Class EnchantWidget.Locked

java.lang.Object
johnsmith.enchantingoverhauled.client.gui.widget.enchant.EnchantWidget
johnsmith.enchantingoverhauled.client.gui.widget.enchant.EnchantWidget.Locked
Enclosing class:
EnchantWidget

public static final class EnchantWidget.Locked extends EnchantWidget
Represents a widget where the underlying enchantment action cannot be performed due to missing context criteria (e.g., attempting to upgrade an item but providing a source catalyst with an insufficient level or wrong type).

Renders identically to an unaffordable available slot, drawing a disabled background and grayed-out text components, and intercepts all mouse interactions to prevent execution.

  • Constructor Details

    • Locked

      public Locked(int x, int y, EnchantRenderState state, int texIndex, boolean usePlainBackground, Runnable onPressAction)
      Constructs a new EnchantWidget.Locked.
      Parameters:
      x - The X screen coordinate.
      y - The Y screen coordinate.
      state - The visual and data state representing this blocked enchantment.
      texIndex - The deterministic texture index (0-9).
      usePlainBackground - True if plain backgrounds are enabled.
      onPressAction - The action callback (never invoked due to overridden click logic).
  • Method Details

    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int button)
      Denies all interaction with this widget, as the underlying action is locked.
      Overrides:
      mouseClicked in class EnchantWidget
      Parameters:
      mouseX - The X coordinate of the mouse pointer.
      mouseY - The Y coordinate of the mouse pointer.
      button - The mouse button being pressed.
      Returns:
      Always false.
    • renderWidget

      protected void renderWidget(net.minecraft.client.gui.GuiGraphics context, int mouseX, int mouseY, float partialTick)
      Renders the widget in a disabled visual state.
      Specified by:
      renderWidget in class EnchantWidget
      Parameters:
      context - The GUI graphics context to draw to.
      mouseX - The current mouse X coordinate.
      mouseY - The current mouse Y coordinate.
      partialTick - The partial tick time for animations.