Class GuiText
java.lang.Object
codechicken.lib.gui.modular.lib.geometry.ConstrainedGeometry<GuiText>
codechicken.lib.gui.modular.elements.GuiElement<GuiText>
codechicken.lib.gui.modular.elements.GuiText
- All Implemented Interfaces:
ElementEvents,ForegroundRender,GuiParent<GuiText>,TooltipHandler<GuiText>
Created by brandon3055 on 31/08/2023
-
Field Summary
Fields inherited from class codechicken.lib.gui.modular.elements.GuiElement
hoverTime, initialized -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApply a dynamic height constraint that sets the height based on text height (accounting for wrapping)doubleSpecifies the z depth of the foreground content.booleanboolean@Nullable net.minecraft.network.chat.ComponentgetText()intbooleangetTrim()booleangetWrap()voidrenderForeground(GuiRender render, double mouseX, double mouseY, float partialTicks) Used to render content in front of this elements child elements.setAlignment(Align alignment) setRotatePoint(Position rotatePoint) Sets the point around which the text rotates relative to the top left of the element.setRotation(double rotation) Set rotation angle in degrees //TODO, Does not work when text scroll is usedsetRotation(@Nullable Supplier<Double> rotation) Dynamic rotation control, Set to null to disable rotation.setScroll(boolean scroll) Set to true the text scroll using the same logic as vanillas widgets if the text is too long to fit within the elements bounds Default enabled.setShadow(boolean shadow) setText(@Nullable net.minecraft.network.chat.Component text) setTextColour(int textColour) setTextColour(Supplier<Integer> textColour) setTextSupplier(@NotNull Supplier<@Nullable net.minecraft.network.chat.Component> textSupplier) setTranslatable(@NotNull String translationKey) setTrim(boolean trim) If set to true the text will be trimmed if it is too long to fit within the bounds on the element.setWrap(boolean wrap) Set to true the text will be wrapped (rendered as multiple lines of text) if it is too long to fit within the size of the element.Methods inherited from class codechicken.lib.gui.modular.elements.GuiElement
addChild, addJeiDropTargets, addJeiExclusions, adoptChild, applyQueuedChildUpdates, blockMouseEvents, blockMouseOver, bringChildToForeground, font, getChildren, getCombinedElementDepth, getJeiDropConsumer, getModularGui, getParent, getTooltip, getTooltipDelay, hoverTime, initElement, isDescendantOf, isEnabled, isJeiDropTarget, isJeiExcluded, isMouseOver, isOpaque, isRemoved, isTooltipEnabled, jeiExclude, mc, onScreenInit, removeChild, render, renderChild, renderOverlay, scaledScreenHeight, scaledScreenWidth, sendChildToBackground, sendChildToIndex, setEnabled, setEnabled, setEnableToolTip, setJeiDropTarget, setJeiExcluded, setOpaque, setRenderCull, setTooltip, setTooltipDelay, setZStacking, showToolTip, tick, toString, updateMouseOver, updateScreenData, zStackingMethods inherited from class codechicken.lib.gui.modular.lib.geometry.ConstrainedGeometry
addBoundsToRect, clearConstraints, clearGeometryCache, constrain, get, getChildBounds, getEnclosingRect, getParent, getPosition, getRectangle, placeInside, placeInside, placeOutside, placeOutside, setHeight, setPos, setSize, setWidth, setXPos, setYPos, strictMode, validate, xCenter, xMax, xMin, xSize, yCenter, yMax, yMin, ySizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface codechicken.lib.gui.modular.lib.ElementEvents
charTyped, charTyped, keyPressed, keyPressed, keyReleased, keyReleased, mouseClicked, mouseClicked, mouseMoved, mouseReleased, mouseReleased, mouseScrolled, mouseScrolledMethods inherited from interface codechicken.lib.gui.modular.lib.geometry.GuiParent
addChild, getValueMethods inherited from interface codechicken.lib.gui.modular.lib.TooltipHandler
renderTooltip, setTooltip, setTooltip, setTooltip, setTooltipSingle, setTooltipSingle
-
Constructor Details
-
GuiText
- Parameters:
parent- parentGuiParent.
-
GuiText
public GuiText(@NotNull @NotNull GuiParent<?> parent, @Nullable @Nullable net.minecraft.network.chat.Component text) - Parameters:
parent- parentGuiParent.
-
GuiText
public GuiText(@NotNull @NotNull GuiParent<?> parent, @NotNull @NotNull Supplier<@Nullable net.minecraft.network.chat.Component> text) - Parameters:
parent- parentGuiParent.
-
-
Method Details
-
autoHeight
Apply a dynamic height constraint that sets the height based on text height (accounting for wrapping) -
autoWidth
-
setTextSupplier
-
setText
-
setText
-
setTranslatable
-
getText
@Nullable public @Nullable net.minecraft.network.chat.Component getText() -
setAlignment
-
getAlignment
-
setTrim
If set to true the text will be trimmed if it is too long to fit within the bounds on the element. Default disabled. Setting this to true will automatically disable wrap and scroll ether are enabled. -
getTrim
public boolean getTrim() -
setWrap
Set to true the text will be wrapped (rendered as multiple lines of text) if it is too long to fit within the size of the element. Default disabled. Setting this to true will automatically disable trim and scroll ether are enabled. -
getWrap
public boolean getWrap() -
setScroll
Set to true the text scroll using the same logic as vanillas widgets if the text is too long to fit within the elements bounds Default enabled. Setting this to true will automatically disable trim and wrap ether are enabled. -
getScroll
public boolean getScroll() -
setShadow
-
setShadow
-
getShadow
public boolean getShadow() -
setTextColour
-
setTextColour
-
getTextColour
public int getTextColour() -
setRotation
Set rotation angle in degrees //TODO, Does not work when text scroll is used -
setRotation
Dynamic rotation control, Set to null to disable rotation. Rotation angle is in degrees //TODO, Does not work when text scroll is used -
setRotatePoint
Sets the point around which the text rotates relative to the top left of the element. Default rotation point is a dynamic point set to the dead center of the element. -
getForegroundDepth
public double getForegroundDepth()Description copied from interface:ForegroundRenderSpecifies the z depth of the foreground content. Used when calculating the total depth of this gui element. Recommended minimum depth is 0.01 or 0.035 if this element renders text. (text shadows are rendered with a 0.03 offset)- Specified by:
getForegroundDepthin interfaceForegroundRender- Returns:
- the z height of the background content.
-
renderForeground
Description copied from interface:ForegroundRenderUsed to render content in front of this elements child elements. When rendering element content, always use thePoseStackavailable via the providedGuiRenderWhere applicable, always use push/pop to ensure the stack is returned to its original state after your rendering is complete.- Specified by:
renderForegroundin interfaceForegroundRender- Parameters:
render- Contains gui context information as well as essential render methods/utils including the PoseStack.
-