Class GuiHooks

java.lang.Object
com.thecsdev.commonmc.api.client.hooks.GuiHooks

@Environment(CLIENT) public final class GuiHooks extends Object
Utility methods for hooking into GUI-related activities.
  • Method Details

    • registerVanillaButtonMod

      public static final void registerVanillaButtonMod(@NotNull @NotNull Class<? extends net.minecraft.client.gui.screens.Screen> screen, @NotNull @NotNull net.minecraft.network.chat.Component btnText, @NotNull @NotNull BiConsumer<net.minecraft.client.gui.components.Button, Runnable> btnOnClickSupplier) throws NullPointerException, IllegalArgumentException
      Registers a modification of a Button's on-click functionality on for given vanilla Screen.
      Parameters:
      screen - The Screen where the Button is located.
      btnText - The text of the targeted button.
      btnOnClickSupplier - The BiConsumer whose inputs are the Button instance and its current (now old) on-click Runnable.
      Throws:
      NullPointerException - If an argument is null.
      IllegalArgumentException - If the provided Class is abstract.