Record Class WidgetHudElement
java.lang.Object
java.lang.Record
io.github.cottonmc.cotton.gui.client.WidgetHudElement
- Record Components:
widget- the drawn widgetpositioner- an optional positioner that moves the widget
- All Implemented Interfaces:
HudElement
public record WidgetHudElement(WWidget widget, @Nullable WidgetHudElement.Positioner positioner)
extends Record
implements HudElement
A HUD element wrapping a
WWidget.- Since:
- 14.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePositioners can be used to change the position of a widget based on the window dimensions. -
Constructor Summary
ConstructorsConstructorDescriptionWidgetHudElement(WWidget widget) Constructs a newWidgetHudElementwithout a positioner.WidgetHudElement(WWidget widget, int x, int y) Constructs a newWidgetHudElement.WidgetHudElement(WWidget widget, int x, int y, int width, int height) Constructs a newWidgetHudElementand resizes the inner widget.WidgetHudElement(WWidget widget, @Nullable WidgetHudElement.Positioner positioner) Creates an instance of aWidgetHudElementrecord class.WidgetHudElement(WWidget widget, WidgetHudElement.Positioner positioner, int width, int height) Constructs a newWidgetHudElementand resizes the inner widget. -
Method Summary
Modifier and TypeMethodDescriptionvoidDisables this HUD element's widget ticking.voidEnables this HUD element's widget ticking.final booleanIndicates whether some other object is "equal to" this one.voidextractRenderState(net.minecraft.client.gui.GuiGraphicsExtractor context, net.minecraft.client.DeltaTracker tickCounter) final inthashCode()Returns a hash code value for this object.Returns the value of thepositionerrecord component.final StringtoString()Returns a string representation of this record class.widget()Returns the value of thewidgetrecord component.
-
Constructor Details
-
WidgetHudElement
Constructs a newWidgetHudElementwithout a positioner.- Parameters:
widget- the drawn widget
-
WidgetHudElement
Constructs a newWidgetHudElement.- Parameters:
widget- the drawn widgetx- the widget's horizontal offsety- the widget's vertical offset- See Also:
-
WidgetHudElement
public WidgetHudElement(WWidget widget, WidgetHudElement.Positioner positioner, int width, int height) Constructs a newWidgetHudElementand resizes the inner widget.- Parameters:
widget- the drawn widgetpositioner- an optional positioner that moves the widgetwidth- the widget's new widthheight- the widget's new height
-
WidgetHudElement
Constructs a newWidgetHudElementand resizes the inner widget.- Parameters:
widget- the drawn widgetx- the widget's horizontal offsety- the widget's vertical offsetwidth- the widget's new widthheight- the widget's new height- See Also:
-
WidgetHudElement
Creates an instance of aWidgetHudElementrecord class.- Parameters:
widget- the value for thewidgetrecord componentpositioner- the value for thepositionerrecord component
-
-
Method Details
-
enableTicking
public void enableTicking()Enables this HUD element's widget ticking. -
disableTicking
public void disableTicking()Disables this HUD element's widget ticking. -
extractRenderState
public void extractRenderState(net.minecraft.client.gui.GuiGraphicsExtractor context, net.minecraft.client.DeltaTracker tickCounter) - Specified by:
extractRenderStatein interfaceHudElement
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
widget
-
positioner
Returns the value of thepositionerrecord component.- Returns:
- the value of the
positionerrecord component
-