Class WindowBannerPicker

java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
com.minecolonies.core.client.gui.WindowBannerPicker
All Implemented Interfaces:
net.minecraft.client.gui.components.events.ContainerEventHandler, net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.Renderable, net.minecraft.client.gui.components.TabOrderedElement

public class WindowBannerPicker extends net.minecraft.client.gui.screens.Screen
A custom rendered Screen (i.e. not blockui) that renders a picker for the banners, similar to a loom. The resulting banner cannot be extracted.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    A custom button for each layer, to override click and render logic
    class 
    A custom button for each pattern, to override click and render logic

    Nested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen

    net.minecraft.client.gui.screens.Screen.NarratableSearchResult
  • Field Summary

    Fields inherited from class net.minecraft.client.gui.screens.Screen

    CUBE_MAP, font, FOOTER_SEPARATOR, HEADER_SEPARATOR, height, INWORLD_FOOTER_SEPARATOR, INWORLD_HEADER_SEPARATOR, MENU_BACKGROUND, minecraft, narratorButton, PANORAMA, renderables, screenExecutor, title, width

    Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    DOUBLE_CLICK_THRESHOLD_MS
  • Constructor Summary

    Constructors
    Constructor
    Description
    WindowBannerPicker(IColonyView colony, AbstractWindowTownHall hallWindow, AtomicBoolean isFeatureUnlocked)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    center(int length, int count, int side, int n, int margin)
    Positions a button within a grid based on the center coordinates of that grid.
    protected void
    Creates the Done and Cancel buttons, to return to the town hall window and save the banner or not, respectively.
    protected void
    Creates the buttons for banner layer selection; Base, 1-6, and the remove button
    protected void
    Creates the buttons behind each pattern.
    protected void
     
    boolean
    mouseClicked(double mouseX, double mouseY, int p_231044_5_)
     
    boolean
    mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)
     
    boolean
    mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY)
     
    void
    render(net.minecraft.client.gui.GuiGraphics stack, int mouseX, int mouseY, float partialTicks)
     
    void
    renderBanner(com.mojang.blaze3d.vertex.PoseStack transform, List<net.minecraft.world.level.block.entity.BannerPatternLayers.Layer> layers, net.minecraft.client.gui.GuiGraphics stack)
    Renders the provided banner using the given transformations
    void
    setLayer(@Nullable net.minecraft.core.Holder<net.minecraft.world.level.block.entity.BannerPattern> pattern, net.minecraft.world.item.DyeColor color)
    Tries to set the layer in the banner pattern list with the given information

    Methods inherited from class net.minecraft.client.gui.screens.Screen

    added, addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, changeFocus, children, clearFocus, clearTooltipForNextRenderPass, clearWidgets, findNarratableWidget, getBackgroundMusic, getMinecraft, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleComponentClicked, handleDelayedNarration, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isPauseScreen, isSelectAll, isValidCharacterForName, keyPressed, onClose, onFilesDrop, rebuildWidgets, removed, removeWidget, renderBackground, renderBlurredBackground, renderMenuBackground, renderMenuBackground, renderMenuBackgroundTexture, renderPanorama, renderTransparentBackground, renderWithTooltip, repositionElements, resize, setInitialFocus, setInitialFocus, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, shouldCloseOnEsc, shouldNarrateNavigation, tick, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, updateNarratorStatus, wrapScreenError

    Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler

    getFocused, isDragging, setDragging, setFocused

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler

    charTyped, getChildAt, getCurrentFocusPath, isFocused, keyReleased, mouseReleased, nextFocusPath, setFocused

    Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    mouseMoved

    Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement

    getTabOrderGroup
  • Constructor Details

    • WindowBannerPicker

      public WindowBannerPicker(IColonyView colony, AbstractWindowTownHall hallWindow, AtomicBoolean isFeatureUnlocked)
      Parameters:
      colony - the colony to make the flag for
      hallWindow - the calling town hall window to return to
      isFeatureUnlocked -
  • Method Details

    • init

      protected void init()
      Overrides:
      init in class net.minecraft.client.gui.screens.Screen
    • createLayerButtons

      protected void createLayerButtons()
      Creates the buttons for banner layer selection; Base, 1-6, and the remove button
    • createPatternButtons

      protected void createPatternButtons()
      Creates the buttons behind each pattern.
    • createCloseButtons

      protected void createCloseButtons()
      Creates the Done and Cancel buttons, to return to the town hall window and save the banner or not, respectively.
    • center

      public static int center(int length, int count, int side, int n, int margin)
      Positions a button within a grid based on the center coordinates of that grid. This method is Axis agnostic.
      Parameters:
      length - the length of the grid
      count - the number of items along that length
      side - the side length of the items in the relevant axis
      n - the nth item we are positioning
      margin - the gap between elements, half of this gap length borders the hole grid
      Returns:
      the coordinate along the relevant axis
    • setLayer

      public void setLayer(@Nullable @Nullable net.minecraft.core.Holder<net.minecraft.world.level.block.entity.BannerPattern> pattern, net.minecraft.world.item.DyeColor color)
      Tries to set the layer in the banner pattern list with the given information
      Parameters:
      pattern - the pattern to set in the layer. Uses the existing or BASE if null
      color - the associated color for the pattern
    • render

      public void render(net.minecraft.client.gui.GuiGraphics stack, int mouseX, int mouseY, float partialTicks)
      Specified by:
      render in interface net.minecraft.client.gui.components.Renderable
      Overrides:
      render in class net.minecraft.client.gui.screens.Screen
    • renderBanner

      public void renderBanner(com.mojang.blaze3d.vertex.PoseStack transform, List<net.minecraft.world.level.block.entity.BannerPatternLayers.Layer> layers, net.minecraft.client.gui.GuiGraphics stack)
      Renders the provided banner using the given transformations
      Parameters:
      transform - the transformation matrix stack to render with
      layers - the pattern-color pairs that form the banner
    • mouseScrolled

      public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY)
    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int p_231044_5_)
    • mouseDragged

      public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)