Package com.minecolonies.core.client.gui
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 ClassesModifier and TypeClassDescriptionclassA custom button for each layer, to override click and render logicclassA custom button for each pattern, to override click and render logicNested 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, widthFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
ConstructorsConstructorDescriptionWindowBannerPicker(IColonyView colony, AbstractWindowTownHall hallWindow, AtomicBoolean isFeatureUnlocked) -
Method Summary
Modifier and TypeMethodDescriptionstatic intcenter(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 voidCreates the Done and Cancel buttons, to return to the town hall window and save the banner or not, respectively.protected voidCreates the buttons for banner layer selection; Base, 1-6, and the remove buttonprotected voidCreates the buttons behind each pattern.protected voidinit()booleanmouseClicked(double mouseX, double mouseY, int p_231044_5_) booleanmouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) booleanmouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) voidrender(net.minecraft.client.gui.GuiGraphics stack, int mouseX, int mouseY, float partialTicks) voidrenderBanner(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 transformationsvoidsetLayer(@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 informationMethods 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, wrapScreenErrorMethods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocusedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
charTyped, getChildAt, getCurrentFocusPath, isFocused, keyReleased, mouseReleased, nextFocusPath, setFocusedMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
mouseMovedMethods 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 forhallWindow- the calling town hall window to return toisFeatureUnlocked-
-
-
Method Details
-
init
protected void init()- Overrides:
initin classnet.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 gridcount- the number of items along that lengthside- the side length of the items in the relevant axisn- the nth item we are positioningmargin- 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 nullcolor- the associated color for the pattern
-
render
public void render(net.minecraft.client.gui.GuiGraphics stack, int mouseX, int mouseY, float partialTicks) - Specified by:
renderin interfacenet.minecraft.client.gui.components.Renderable- Overrides:
renderin classnet.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 withlayers- 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)
-