Class AbstractWindowSkeleton

java.lang.Object
com.ldtteam.blockui.UiRenderMacros
com.ldtteam.blockui.Pane
com.ldtteam.blockui.views.View
com.ldtteam.blockui.views.BOWindow
com.minecolonies.core.client.gui.AbstractWindowSkeleton
All Implemented Interfaces:
com.ldtteam.blockui.controls.ButtonHandler, IModuleContainer<IWindowModule>, Consumer<com.ldtteam.blockui.controls.Button>
Direct Known Subclasses:
AbstractBuildingWindow, AbstractWindowCitizen, DebugWindowCitizen, WindowAssignCitizen, WindowBannerRallyGuards, WindowBuildBuilding, WindowBuildDecoration, WindowBuildingBrowser, WindowClipBoard, WindowColonyMap, WindowColonyPrestigeRanking, WindowConfirm, WindowDecorationController, WindowField, WindowHireWorker, WindowHutAllInventory, WindowHutGuide, WindowInfo, WindowInteraction, WindowPlantationField, WindowPostBoxMain, WindowQuestLog, WindowReactivateBuilding, WindowRequestDetail, WindowResearchTree, WindowResourceList, WindowSchematicAnalyzer, WindowSuggestBuildTool, WindowSupplyStory, WindowTownHallCantCreateColony, WindowTownHallColonyManage, WindowTownHallColonyReactivate, WindowTownHallDeleteAbandonColony

public abstract class AbstractWindowSkeleton extends com.ldtteam.blockui.views.BOWindow implements com.ldtteam.blockui.controls.ButtonHandler, IModuleContainer<IWindowModule>
Manage windows and their events.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.ldtteam.blockui.views.BOWindow

    com.ldtteam.blockui.views.BOWindow.WindowRenderType

    Nested classes/interfaces inherited from class com.ldtteam.blockui.UiRenderMacros

    com.ldtteam.blockui.UiRenderMacros.ResolvedBlit
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final com.ldtteam.blockui.controls.Button
     
    protected final com.ldtteam.blockui.controls.Button
     
    protected final com.ldtteam.blockui.controls.Text
    Panes used by the generic page handler
    protected com.ldtteam.blockui.views.SwitchView
     

    Fields inherited from class com.ldtteam.blockui.views.BOWindow

    DEFAULT_HEIGHT, DEFAULT_WIDTH, lightbox, screen, windowPausesGame, windowRenderType, xmlResourceLocation

    Fields inherited from class com.ldtteam.blockui.views.View

    children, padding

    Fields inherited from class com.ldtteam.blockui.Pane

    alignment, cursor, debugging, enabled, focus, height, hoverSource, id, lastClickedPane, mc, onHover, onHoverId, visible, wasCursorInPane, width, window, x, y

    Fields inherited from class com.ldtteam.blockui.UiRenderMacros

    HALF_BIAS
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractWindowSkeleton(@Nullable com.ldtteam.blockui.views.BOWindow parent, net.minecraft.resources.ResourceLocation resource)
    Constructor for the skeleton class of the windows.
    AbstractWindowSkeleton(net.minecraft.resources.ResourceLocation resource)
    Constructor with no parent window
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    final void
    doNothing(com.ldtteam.blockui.controls.Button ignored)
    Button clicked without an action.
    Get the class type of the module container.
    Get a list containing all modules registered to this container.
    void
    onButtonClicked(@NotNull com.ldtteam.blockui.controls.Button button)
    Handle a button clicked event.
    void
     
    void
     
    void
     
    final void
    Register a button on the window.
    final void
    registerButton(String id, Consumer<com.ldtteam.blockui.controls.Button> action)
    Register a button on the window.
    final <T extends IWindowWithLayoutModule, A>
    T
    registerLayoutModule(BiFunction<AbstractWindowSkeleton,A,T> moduleBuilder, A argument, int xPos, int yPos)
    Add a module to this window.
    final <T extends IWindowModule, A>
    T
    registerModule(BiFunction<AbstractWindowSkeleton,A,T> moduleBuilder, A argument)
    Add a module to this window.
    void
    setPage(boolean relative, int page)
    Generic page handler, uses common ids

    Methods inherited from class com.ldtteam.blockui.views.BOWindow

    doesWindowPauseGame, drawSelf, getRenderType, getScreen, getXmlResourceLocation, hasLightbox, loadParams, onKeyTyped, onMouseReleased, onUnhandledKeyTyped, open, openAsLayer

    Methods inherited from class com.ldtteam.blockui.views.View

    accumulatePosition, addChild, addChild, adjustChild, childIsVisible, click, drawHidden, drawSelfLast, findPaneByID, findPaneByType, findPaneForClick, getAccumulatedPosition, getChildren, getInteriorHeight, getInteriorWidth, mouseClickableEventHandler, mouseEventProcessor, mousePointableEventHandler, onMouseDrag, parseChildren, postAddChild, removeChild, rightClick, scrollInput, setSize, setWindow

    Methods inherited from class com.ldtteam.blockui.Pane

    canHandleClick, clearFocus, disable, draw, drawLast, enable, findFirstPaneByType, findPaneOfTypeByID, getAlignment, getCursor, getFocus, getHeight, getHoverPane, getID, getParent, getWidth, getWindow, getX, getY, handleClick, handleHover, handleRightClick, hide, isClickable, isEnabled, isFocus, isPointInPane, isVisible, moveBy, off, on, onFocus, onFocusLost, putInside, scissorsEnd, scissorsStart, setAlignment, setCursor, setEnabled, setFocus, setFocus, setHoverPane, setID, setParentView, setPosition, setVisible, shouldDraw, show, wasCursorInPane

    Methods inherited from class com.ldtteam.blockui.UiRenderMacros

    blit, blit, blit, blit, blitRepeatable, blitSprite, blitSprite, drawEntity, drawLineRect, drawLineRect, drawLineRect, drawLineRectGradient, drawLineRectGradient, drawLineRectGradient, fill, fill, fillGradient, fillGradient, hLine, hLine, line, line, populateBlitTriangles, populateFillGradientTriangles, populateFillTriangles, resolveSprite, vLine, vLine

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.ldtteam.blockui.controls.ButtonHandler

    accept

    Methods inherited from interface java.util.function.Consumer

    andThen
  • Field Details

    • pageNum

      protected final com.ldtteam.blockui.controls.Text pageNum
      Panes used by the generic page handler
    • buttonPrevPage

      protected final com.ldtteam.blockui.controls.Button buttonPrevPage
    • buttonNextPage

      protected final com.ldtteam.blockui.controls.Button buttonNextPage
    • switchView

      protected com.ldtteam.blockui.views.SwitchView switchView
  • Constructor Details

    • AbstractWindowSkeleton

      public AbstractWindowSkeleton(net.minecraft.resources.ResourceLocation resource)
      Constructor with no parent window
      Parameters:
      resource - window resource location.
    • AbstractWindowSkeleton

      public AbstractWindowSkeleton(@Nullable @Nullable com.ldtteam.blockui.views.BOWindow parent, net.minecraft.resources.ResourceLocation resource)
      Constructor for the skeleton class of the windows.
      Parameters:
      parent - the parent window.
      resource - window resource location.
  • Method Details

    • getModules

      @NotNull public @NotNull List<IWindowModule> getModules()
      Description copied from interface: IModuleContainer
      Get a list containing all modules registered to this container.
      Specified by:
      getModules in interface IModuleContainer<IWindowModule>
      Returns:
      the list of all modules.
    • getClassType

      @NotNull public @NotNull Class<IWindowModule> getClassType()
      Description copied from interface: IModuleContainer
      Get the class type of the module container.
      Specified by:
      getClassType in interface IModuleContainer<IWindowModule>
      Returns:
      the class type.
    • registerButton

      public final void registerButton(String id, Runnable action)
      Register a button on the window.
      Parameters:
      id - Button ID.
      action - Consumer with the action to be performed.
    • registerButton

      public final void registerButton(String id, Consumer<com.ldtteam.blockui.controls.Button> action)
      Register a button on the window.
      Parameters:
      id - Button ID.
      action - Consumer with the action to be performed.
    • registerModule

      public final <T extends IWindowModule, A> T registerModule(BiFunction<AbstractWindowSkeleton,A,T> moduleBuilder, A argument)
      Add a module to this window. Extending the original logic of the window.
      Parameters:
      moduleBuilder - the new module.
    • registerLayoutModule

      public final <T extends IWindowWithLayoutModule, A> T registerLayoutModule(BiFunction<AbstractWindowSkeleton,A,T> moduleBuilder, A argument, int xPos, int yPos)
      Add a module to this window. Extending the original logic of the window.
      Parameters:
      moduleBuilder - the new module.
    • onOpened

      public void onOpened()
      Overrides:
      onOpened in class com.ldtteam.blockui.views.BOWindow
    • onUpdate

      public void onUpdate()
      Overrides:
      onUpdate in class com.ldtteam.blockui.views.View
    • onClosed

      public void onClosed()
      Overrides:
      onClosed in class com.ldtteam.blockui.views.BOWindow
    • onButtonClicked

      public void onButtonClicked(@NotNull @NotNull com.ldtteam.blockui.controls.Button button)
      Handle a button clicked event. Find the registered event and execute that.

      todo: make final once migration is complete

      Specified by:
      onButtonClicked in interface com.ldtteam.blockui.controls.ButtonHandler
      Parameters:
      button - the button that was clicked.
    • doNothing

      public final void doNothing(com.ldtteam.blockui.controls.Button ignored)
      Button clicked without an action. Method does nothing.
      Parameters:
      ignored - Parameter is ignored. Since some actions require a button, we must accept a button parameter.
    • setPage

      public void setPage(boolean relative, int page)
      Generic page handler, uses common ids
      Parameters:
      relative - whether page param is relative or absolute
      page - if relative turn x pages forward/backward, if absolute turn to x-th page
    • close

      public void close()
      Overrides:
      close in class com.ldtteam.blockui.views.BOWindow