Class Ui

java.lang.Object
com.hypixel.hytale.server.core.modules.ui.Ui

public final class Ui extends Object
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.

  • Method Details

    • stringVal

      @Nonnull public static UIStringDataValue stringVal(@Nonnull String value)
      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

      @Nonnull public static UIFloatDataValue floatVal(float value)
      Builds a 32-bit float value. Property type: UITypes.FLOAT.
      Parameters:
      value - the float to send
      Returns:
      the data value
    • intVal

      @Nonnull public static UIIntDataValue intVal(int value)
      Builds a 32-bit signed integer value. Property type: UITypes.INT.
      Parameters:
      value - the int to send
      Returns:
      the data value
    • boolVal

      @Nonnull public static UIBoolDataValue boolVal(boolean value)
      Builds a boolean value. Property type: UITypes.BOOLEAN.
      Parameters:
      value - the boolean to send
      Returns:
      the data value
    • byteVal

      @Nonnull public static UISByteDataValue byteVal(byte value)
      Builds a signed 8-bit value. Matches Java byte and UITypes.BYTE ("SByte"). Ui.ObjBuilder.put(String, byte) uses this factory.
      Parameters:
      value - the signed byte to send
      Returns:
      the data value
    • ubyteVal

      @Nonnull public static UIByteDataValue ubyteVal(byte value)
      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) 200 for channel value 200.

      Parameters:
      value - the byte bits to interpret as unsigned on the client
      Returns:
      the data value
    • shortVal

      @Nonnull public static UIShortDataValue shortVal(short value)
      Builds a 16-bit signed integer value. Property type: UITypes.SHORT.
      Parameters:
      value - the short to send
      Returns:
      the data value
    • longVal

      @Nonnull public static UILongDataValue longVal(long value)
      Builds a 64-bit signed integer value. Property type: UITypes.LONG.
      Parameters:
      value - the long to send
      Returns:
      the data value
    • doubleVal

      @Nonnull public static UIDoubleDataValue doubleVal(double value)
      Builds a 64-bit float value. Property type: UITypes.DOUBLE.
      Parameters:
      value - the double to send
      Returns:
      the data value
    • enumVal

      @Nonnull public static UIEnumDataValue enumVal(long ordinal)
      Builds an enum value by ordinal in the registered view-model enum. 0 is the first member in the list passed to UIModule.registerEnumDefinition(String, java.util.List).
      Parameters:
      ordinal - zero-based index of the enum member
      Returns:
      the data value
    • commandVal

      @Nonnull public static UICommandDataValue commandVal(@Nonnull String commandId)
      Builds a command binding for XAML ICommand properties. Property type: UITypes.COMMAND.

      The commandId must match an ID from UISurface.registerCommand(String, UICommandHandler) on the same surface. Prefer Ui.ObjBuilder.put(String, CommandDefinition) when you already hold the CommandDefinition returned 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. Prefer obj(String) for fluent construction.
      Parameters:
      typeName - registered view-model type, for example "Server.MyMod.GameState", or a native type name from UITypes
      properties - property name to value map
      Returns:
      the object data value
    • obj

      @Nonnull public static Ui.ObjBuilder obj(@Nonnull String typeName)
      Returns a fluent builder for a UIObjectDataValue. Prefer this over a raw HashMap when the object has many properties.
      Parameters:
      typeName - registered view-model type, for example "Server.MyMod.GameState", or a native type name from UITypes
      Returns:
      a new builder
    • list

      @Nonnull public static UIListDataValue list(@Nonnull String itemTypeName, @Nonnull UIDataValue... items)
      Builds a list value whose items share itemTypeName. Use UITypes.collection(String) when you declare the property type.
      Parameters:
      itemTypeName - registered item type name, for example "Server.MyMod.ListEntry"
      items - list elements, usually from obj(String) or a primitive factory
      Returns:
      the list data value
    • color

      @Nonnull public static UIColorDataValue color(byte r, byte g, byte b)
      Builds a XAML Color value with full opacity. Property type declaration: "Color".
      Parameters:
      r - red channel bits (interpreted as unsigned)
      g - green channel bits
      b - blue channel bits
      Returns:
      the compact color value
    • color

      @Nonnull public static UIColorDataValue color(byte r, byte g, byte b, byte a)
      Builds a XAML Color value with the given RGBA components. Property type declaration: "Color".
      Parameters:
      r - red channel bits (interpreted as unsigned)
      g - green channel bits
      b - blue channel bits
      a - alpha channel bits
      Returns:
      the compact color value
    • color

      @Nonnull public static UIColorDataValue color(@Nonnull Color c)
      Builds a XAML Color value from a protocol Color with full opacity. Property type declaration: "Color".
      Parameters:
      c - protocol color
      Returns:
      the compact color value
    • color

      @Nonnull public static UIColorDataValue color(@Nonnull Color c, byte alpha)
      Builds a XAML Color value from a protocol Color with the given alpha. Property type declaration: "Color".
      Parameters:
      c - protocol color
      alpha - alpha channel bits
      Returns:
      the compact color value
    • color

      @Nonnull public static UIColorDataValue color(@Nonnull ColorAlpha c)
      Builds a XAML Color value from a protocol ColorAlpha. Property type declaration: "Color".
      Parameters:
      c - protocol color with alpha
      Returns:
      the compact color value
    • brush

      @Nonnull public static UIObjectDataValue brush(byte r, byte g, byte b)
      Builds a SolidColorBrush object value with full opacity. Property type declaration: "SolidColorBrush".
      Parameters:
      r - red channel bits
      g - green channel bits
      b - blue channel bits
      Returns:
      the brush object value
    • brush

      @Nonnull public static UIObjectDataValue brush(byte r, byte g, byte b, byte a)
      Builds a SolidColorBrush object value with the given RGBA components. Property type declaration: "SolidColorBrush".
      Parameters:
      r - red channel bits
      g - green channel bits
      b - blue channel bits
      a - alpha channel bits
      Returns:
      the brush object value
    • brush

      @Nonnull public static UIObjectDataValue brush(@Nonnull Color c)
      Builds a SolidColorBrush from a protocol Color with full opacity. Property type declaration: "SolidColorBrush".
      Parameters:
      c - protocol color
      Returns:
      the brush object value
    • brush

      @Nonnull public static UIObjectDataValue brush(@Nonnull Color c, byte alpha)
      Builds a SolidColorBrush from a protocol Color with the given alpha. Property type declaration: "SolidColorBrush".
      Parameters:
      c - protocol color
      alpha - alpha channel bits
      Returns:
      the brush object value
    • brush

      @Nonnull public static UIObjectDataValue brush(@Nonnull ColorAlpha c)
      Builds a SolidColorBrush from a protocol ColorAlpha. Property type declaration: "SolidColorBrush".
      Parameters:
      c - protocol color with alpha
      Returns:
      the brush object value