Package me.hackware.api.hud
Class TemplateTextHud
java.lang.Object
me.hackware.api.hud.HUDElement
me.hackware.api.hud.TextHUDElement
me.hackware.api.hud.TemplateTextHud
- All Implemented Interfaces:
SettingContainer
A HUD text element whose content is a user-editable template string. The
template grammar (variables, functions, arithmetic) is evaluated by the
scripting package; this class only owns the element's
persisted template + colour and wires evaluation into the HUD render path.
invalid reference
TemplateEngine
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumWhich end of the string the effect works from.Nested classes/interfaces inherited from class me.hackware.api.hud.HUDElement
HUDElement.Anchor, HUDElement.ConditionType, HUDElement.ExpandAnchorX, HUDElement.ExpandAnchorY, HUDElement.VisibilityCondition, HUDElement.VisibilityKeyMode -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal NumberSetting<Double> final NumberSetting<Double> final SettingGroupfinal NumberSetting<Double> final StringSettingfinal ColorSettingNot exposed in the properties window (visible(false)); persists all the same.Fields inherited from class me.hackware.api.hud.TextHUDElement
PAD_H, PAD_V -
Constructor Summary
ConstructorsConstructorDescriptionTemplateTextHud(String id, int defaultX, int defaultY, String defaultTemplate) -
Method Summary
Modifier and TypeMethodDescriptionprotected net.minecraft.network.chat.ComponentMeasure against the full string so the box stays put while the text types/erases.protected StringThe text string to display.protected StringevaluateTemplate(String rawTemplate) protected intgetColor()The ARGB color for the text.floatgetScale()The element scale rides the Scale setting (base slider is unused here).intvoidsetScale(float v) Set the per-element scale, snapping to the same GUI-scale-aware fraction stops as the Client tab.voidsetTemplate(String template) protected inttextX(net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text) Aligns the partial text inside the box the full string reserved, following the element's resolved expand anchor — the same AUTO rule the editor uses, so an element parked on the right of the screen types against its right edge, one in the middle grows from the centre, and one on the left stays flush left.Methods inherited from class me.hackware.api.hud.TextHUDElement
buildDisplayText, renderContent, updateSizeMethods inherited from class me.hackware.api.hud.HUDElement
addCondition, addSettings, addSettings, areConditionsMet, canResetToDefault, clamp, clearExpandOverrides, clearSavedPosition, contains, defaultTextColor, effHeight, effRenderScale, effWidth, getConditions, getEditorAlpha, getExpandAnchorX, getExpandAnchorY, getHeight, getId, getReservedHeight, getReservedWidth, getSettings, getVisibilityKey, getVisibilityKeyMode, getWidth, getX, getY, graphicalScale, hudScale, isDraggable, isEditorHidden, isVisibilityHoldShows, loadElementSettings, migrateArgbColorKey, migrateColorSettingKey, migrateEnumSettingKey, migrateOpacityIntoColorAlpha, migrateOverrideColorKey, migrateSettingKey, migrateSettingKey, removeCondition, render, render, renderEditor, renderEditor, resetClampSides, resetToDefault, resolve, resolvedExpandX, resolvedExpandY, resolveEditor, saveConditions, saveContainerSettings, savePosition, saveVisibilityKey, scalesWithTextScale, setClampSides, setEditorAlpha, setExpandAnchorX, setExpandAnchorY, setExpandOverrides, setPosition, setVisibilityHoldShows, setVisibilityKey, setVisibilityKeyMode, snapshotAnchor, updateEditorSize, usesBaseScaleSlider, wrapperScale
-
Field Details
-
general
-
text
-
effect
-
effectDirection
-
effectSpeed
-
effectDelay
-
scaleSetting
-
textColor
Not exposed in the properties window (visible(false)); persists all the same.
-
-
Constructor Details
-
TemplateTextHud
-
-
Method Details
-
getScale
public float getScale()The element scale rides the Scale setting (base slider is unused here).- Overrides:
getScalein classHUDElement
-
setScale
public void setScale(float v) Description copied from class:HUDElementSet the per-element scale, snapping to the same GUI-scale-aware fraction stops as the Client tab.- Overrides:
setScalein classHUDElement
-
getTemplate
-
setTemplate
-
getTextColor
public int getTextColor() -
buildText
Description copied from class:TextHUDElementThe text string to display. Called every frame.- Specified by:
buildTextin classTextHUDElement
-
buildSizingText
protected net.minecraft.network.chat.Component buildSizingText()Measure against the full string so the box stays put while the text types/erases.- Overrides:
buildSizingTextin classTextHUDElement
-
getColor
protected int getColor()Description copied from class:TextHUDElementThe ARGB color for the text. Called every frame.- Specified by:
getColorin classTextHUDElement
-
textX
protected int textX(net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text) Aligns the partial text inside the box the full string reserved, following the element's resolved expand anchor — the same AUTO rule the editor uses, so an element parked on the right of the screen types against its right edge, one in the middle grows from the centre, and one on the left stays flush left. Without this the text would always hug the left edge of a box sized for the full string, leaving it visually detached from the edge it's anchored to.- Overrides:
textXin classTextHUDElement
-
evaluateTemplate
-