Class McbsGoalGUI<T extends McbsGoal>

java.lang.Object
com.thecsdev.betterstats.api.mcbs.view.goal.McbsGoalGUI<T>
Type Parameters:
T - The McbsGoal type.
Direct Known Subclasses:
McbsSivGoalGUI

@Environment(CLIENT) public abstract class McbsGoalGUI<T extends McbsGoal> extends Object
Client-sided factory for constructing GUIs for McbsGoals.
  • Constructor Details

  • Method Details

    • getType

      @NotNull public final @NotNull McbsGoalType<T> getType()
      Returns the McbsGoalType of the McbsGoal this McbsGoalGUI is for.
    • getKey

      @Nullable public final @Nullable net.minecraft.resources.Identifier getKey()
      Returns the Identifier key for this McbsGoalGUI in the BClientRegistries.GOAL_GUI registry, or null if this McbsGoalGUI is not registered.
    • initIcon

      @Contract(pure=true) @Virtual public void initIcon(@Nullable T goal, @NotNull @NotNull com.thecsdev.commonmc.api.client.gui.TElement onto, int preferredPadding) throws NullPointerException
      Creates GUI that visually acts as a goal's "icon", and then adds it to the provided TElement.
      Parameters:
      goal - The McbsGoal instance for which the icon is to be initialized.
      onto - The icon's background, aka the 'slot' where the icon is to be initialized.
      preferredPadding - The preferred padding to be applied around the icon.
      Throws:
      NullPointerException - If a NotNull argument is null.
    • isEditable

      @Contract(pure=true) @Virtual public boolean isEditable()
      Returns true if and only if createEditScreen(Screen, McbsEditorFileTab, McbsGoal) is intended to be used.
      Implementation Note:
      This method should return a constant value.
    • createEditScreen

      @Contract(pure=true) @Virtual @NotNull public @NotNull net.minecraft.client.gui.screens.Screen createEditScreen(@Nullable @Nullable net.minecraft.client.gui.screens.Screen lastScreen, @NotNull @NotNull McbsEditorFileTab editorTab, @NotNull T goal) throws NullPointerException
      Creates a Screen that presents an interface allowing the user to edit properties for an McbsGoal of type T.
      Parameters:
      lastScreen - The Screen that the returned screen will use as its "last screen".
      editorTab - The McbsEditorFileTab that displayed the goals interface, where the user clicked to edit the given McbsGoal.
      goal - The goal whose properties are to be edited.
      Throws:
      NullPointerException - If a NotNull argument is null.
      Implementation Note:
      If isEditable() returns false, avoid overriding this method.
    • findFor

      @Contract(pure=true) @Nullable public static final <T extends McbsGoal> @Nullable McbsGoalGUI<T> findFor(@NotNull T goal) throws NullPointerException
      Finds and returns the McbsGoalGUI instance for a given McbsGoal.
      Type Parameters:
      T - The McbsGoal.
      Parameters:
      goal - The McbsGoal to find the GUI for.
      Throws:
      NullPointerException - If the argument is null.
    • findFor

      @Contract(pure=true) @Nullable public static final <T extends McbsGoal> @Nullable McbsGoalGUI<T> findFor(@NotNull @NotNull McbsGoalType<T> type) throws NullPointerException
      Finds and returns the McbsGoalGUI instance for a given McbsGoalType.
      Type Parameters:
      T - The McbsGoal type.
      Parameters:
      type - The McbsGoalType to find the GUI for.
      Throws:
      NullPointerException - If the argument is null.