Contents
- Description
- Nested Class Summary
- Method Summary
- Method Details
- stringVal(String)
- formattedMessageVal(FormattedMessage)
- floatVal(float)
- intVal(int)
- boolVal(boolean)
- byteVal(byte)
- ubyteVal(byte)
- shortVal(short)
- longVal(long)
- doubleVal(double)
- enumVal(long)
- commandVal(String)
- obj(String, Map)
- obj(String)
- list(String, UIDataValue...)
- color(byte, byte, byte)
- color(byte, byte, byte, byte)
- color(Color)
- color(Color, byte)
- color(ColorAlpha)
- brush(byte, byte, byte)
- brush(byte, byte, byte, byte)
- brush(Color)
- brush(Color, byte)
- brush(ColorAlpha)
Class Ui
java.lang.Object
com.hypixel.hytale.server.core.modules.ui.Ui
Factory methods for building
UIDataValue instances used in serverside UI data contexts.
Prefer obj(String) and its Ui.ObjBuilder overloads when you set many properties.
Use these factories when you need an explicit UIDataValue for lists, nested objects, or
property updates.
Property type strings for declarations live on UITypes.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic UIBoolDataValueboolVal(boolean value) Builds a boolean value.static UIObjectDataValuebrush(byte r, byte g, byte b) Builds aSolidColorBrushobject value with full opacity.static UIObjectDataValuebrush(byte r, byte g, byte b, byte a) Builds aSolidColorBrushobject value with the given RGBA components.static UIObjectDataValueBuilds aSolidColorBrushfrom a protocolColorwith full opacity.static UIObjectDataValuebrush(ColorAlpha c) Builds aSolidColorBrushfrom a protocolColorAlpha.static UIObjectDataValueBuilds aSolidColorBrushfrom a protocolColorwith the given alpha.static UISByteDataValuebyteVal(byte value) Builds a signed 8-bit value.static UIColorDataValuecolor(byte r, byte g, byte b) Builds a XAMLColorvalue with full opacity.static UIColorDataValuecolor(byte r, byte g, byte b, byte a) Builds a XAMLColorvalue with the given RGBA components.static UIColorDataValueBuilds a XAMLColorvalue from a protocolColorwith full opacity.static UIColorDataValuecolor(ColorAlpha c) Builds a XAMLColorvalue from a protocolColorAlpha.static UIColorDataValueBuilds a XAMLColorvalue from a protocolColorwith the given alpha.static UICommandDataValuecommandVal(String commandId) Builds a command binding for XAMLICommandproperties.static UIDoubleDataValuedoubleVal(double value) Builds a 64-bit float value.static UIEnumDataValueenumVal(long ordinal) Builds an enum value by ordinal in the registered view-model enum.static UIFloatDataValuefloatVal(float value) Builds a 32-bit float value.static UIFormattedMessageDataValueBuilds a localized or formatted message value.static UIIntDataValueintVal(int value) Builds a 32-bit signed integer value.static UIListDataValuelist(String itemTypeName, UIDataValue... items) Builds a list value whose items shareitemTypeName.static UILongDataValuelongVal(long value) Builds a 64-bit signed integer value.static Ui.ObjBuilderReturns a fluent builder for aUIObjectDataValue.static UIObjectDataValueobj(String typeName, Map<String, UIDataValue> properties) Builds an object value with the given type name and property map.static UIShortDataValueshortVal(short value) Builds a 16-bit signed integer value.static UIStringDataValueBuilds a string value.static UIByteDataValueubyteVal(byte value) Builds an unsigned 8-bit value.
-
Method Details
-
stringVal
Builds a string value. Property type:UITypes.STRING.- Parameters:
value- the string to send- Returns:
- the data value
-
formattedMessageVal
@Nonnull public static UIFormattedMessageDataValue formattedMessageVal(@Nonnull FormattedMessage value) Builds a localized or formatted message value. Property type:UITypes.FORMATTED_MESSAGE.- Parameters:
value- the formatted message to send- Returns:
- the data value
-
floatVal
Builds a 32-bit float value. Property type:UITypes.FLOAT.- Parameters:
value- the float to send- Returns:
- the data value
-
intVal
Builds a 32-bit signed integer value. Property type:UITypes.INT.- Parameters:
value- the int to send- Returns:
- the data value
-
boolVal
Builds a boolean value. Property type:UITypes.BOOLEAN.- Parameters:
value- the boolean to send- Returns:
- the data value
-
byteVal
Builds a signed 8-bit value. Matches JavabyteandUITypes.BYTE("SByte").Ui.ObjBuilder.put(String, byte)uses this factory.- Parameters:
value- the signed byte to send- Returns:
- the data value
-
ubyteVal
Builds an unsigned 8-bit value. Property type:UITypes.UBYTE("Byte").Java has no unsigned byte type. Pass bit patterns with a cast, for example
(byte) 200for channel value 200.- Parameters:
value- the byte bits to interpret as unsigned on the client- Returns:
- the data value
-
shortVal
Builds a 16-bit signed integer value. Property type:UITypes.SHORT.- Parameters:
value- the short to send- Returns:
- the data value
-
longVal
Builds a 64-bit signed integer value. Property type:UITypes.LONG.- Parameters:
value- the long to send- Returns:
- the data value
-
doubleVal
Builds a 64-bit float value. Property type:UITypes.DOUBLE.- Parameters:
value- the double to send- Returns:
- the data value
-
enumVal
Builds an enum value by ordinal in the registered view-model enum.0is the first member in the list passed toUIModule.registerEnumDefinition(String, java.util.List).- Parameters:
ordinal- zero-based index of the enum member- Returns:
- the data value
-
commandVal
Builds a command binding for XAMLICommandproperties. Property type:UITypes.COMMAND.The
commandIdmust match an ID fromUISurface.registerCommand(String, UICommandHandler)on the same surface. PreferUi.ObjBuilder.put(String, CommandDefinition)when you already hold theCommandDefinitionreturned by registration.- Parameters:
commandId- the registered command ID- Returns:
- the data value
-
obj
@Nonnull public static UIObjectDataValue obj(@Nonnull String typeName, @Nonnull Map<String, UIDataValue> properties) Builds an object value with the given type name and property map. Preferobj(String)for fluent construction.- Parameters:
typeName- registered view-model type, for example"Server.MyMod.GameState", or a native type name fromUITypesproperties- property name to value map- Returns:
- the object data value
-
obj
Returns a fluent builder for aUIObjectDataValue. Prefer this over a rawHashMapwhen the object has many properties.- Parameters:
typeName- registered view-model type, for example"Server.MyMod.GameState", or a native type name fromUITypes- Returns:
- a new builder
-
list
@Nonnull public static UIListDataValue list(@Nonnull String itemTypeName, @Nonnull UIDataValue... items) Builds a list value whose items shareitemTypeName. UseUITypes.collection(String)when you declare the property type.- Parameters:
itemTypeName- registered item type name, for example"Server.MyMod.ListEntry"items- list elements, usually fromobj(String)or a primitive factory- Returns:
- the list data value
-
color
Builds a XAMLColorvalue with full opacity. Property type declaration:"Color".- Parameters:
r- red channel bits (interpreted as unsigned)g- green channel bitsb- blue channel bits- Returns:
- the compact color value
-
color
Builds a XAMLColorvalue with the given RGBA components. Property type declaration:"Color".- Parameters:
r- red channel bits (interpreted as unsigned)g- green channel bitsb- blue channel bitsa- alpha channel bits- Returns:
- the compact color value
-
color
Builds a XAMLColorvalue from a protocolColorwith full opacity. Property type declaration:"Color".- Parameters:
c- protocol color- Returns:
- the compact color value
-
color
Builds a XAMLColorvalue from a protocolColorwith the given alpha. Property type declaration:"Color".- Parameters:
c- protocol coloralpha- alpha channel bits- Returns:
- the compact color value
-
color
- Parameters:
c- protocol color with alpha- Returns:
- the compact color value
-
brush
Builds aSolidColorBrushobject value with full opacity. Property type declaration:"SolidColorBrush".- Parameters:
r- red channel bitsg- green channel bitsb- blue channel bits- Returns:
- the brush object value
-
brush
Builds aSolidColorBrushobject value with the given RGBA components. Property type declaration:"SolidColorBrush".- Parameters:
r- red channel bitsg- green channel bitsb- blue channel bitsa- alpha channel bits- Returns:
- the brush object value
-
brush
Builds aSolidColorBrushfrom a protocolColorwith full opacity. Property type declaration:"SolidColorBrush".- Parameters:
c- protocol color- Returns:
- the brush object value
-
brush
Builds aSolidColorBrushfrom a protocolColorwith the given alpha. Property type declaration:"SolidColorBrush".- Parameters:
c- protocol coloralpha- alpha channel bits- Returns:
- the brush object value
-
brush
- Parameters:
c- protocol color with alpha- Returns:
- the brush object value
-