Class BackendDescriptor

java.lang.Object
dev.xichil.mvui.BackendDescriptor

public final class BackendDescriptor extends Object
What one backend serves (TODO.md 0.6, 5.3): per platform, the DataVersion range it was checked against, plus the runtime names it is remapped to. Read from the <id>.properties file each backend's build writes into BackendRegistry.DESCRIPTORS. Immutable; equal by id(). Part of the backend contract; mods don't need it.

A descriptor file looks like this (other keys are ignored):

id=e8-fabric
names=official
fabric=4786-
Here backend e8-fabric serves Fabric from DataVersion 4786 on, with no upper bound, and its classes are in package dev.xichil.mvui.backend.e8_fabric.
  • Field Details

  • Constructor Details

    • BackendDescriptor

      public BackendDescriptor(String id, String runtimeNames, Map<UiPlatform, int[]> ranges)
      A descriptor; usually made by parse(Properties).
      Parameters:
      id - the backend id: lower case, digits and single dashes, e.g. e5-7-fabric
      runtimeNames - the runtime-name family, e.g. intermediary, mcp-srg, mojmap, official
      ranges - per platform {first, last} DataVersion, last OPEN for no upper bound; copied
      Throws:
      IllegalArgumentException - if the id is malformed, the names are empty, no platform is served, or a range isn't two ascending numbers
  • Method Details

    • parse

      public static BackendDescriptor parse(Properties p)
      Parses a descriptor file: id, names and one <platform>=first-last per served platform (empty last: open-ended). Other keys (minecraft, java…) are ignored.
      Parameters:
      p - the loaded properties
      Returns:
      the descriptor
      Throws:
      IllegalArgumentException - if a range or another value is malformed
    • id

      public String id()
      The backend id, e.g. e8-fabric; also names its package (packageName()).
      Returns:
      the backend's id
    • runtimeNames

      public String runtimeNames()
      The runtime-name family (TODO.md §3.2), e.g. intermediary; for logs and checks.
      Returns:
      the backend's runtime-name family, e.g. mojmap
    • serves

      public boolean serves(UiPlatform platform)
      Whether the backend serves platform.
      Parameters:
      platform - a loader
      Returns:
      true if the descriptor has a range for it
    • first

      public int first(UiPlatform platform)
      First DataVersion the backend was checked against on platform; selection starts here.
      Parameters:
      platform - the loader whose range to read
      Returns:
      the first DataVersion of the range
      Throws:
      IllegalArgumentException - if the backend doesn't serve platform
    • last

      public int last(UiPlatform platform)
      Last DataVersion the backend was checked against on platform, or OPEN. Doesn't limit selection (BackendRegistry); the build's coverage check uses it.
      Parameters:
      platform - the loader whose range to read
      Returns:
      the last DataVersion of the range, or OPEN
      Throws:
      IllegalArgumentException - if the backend doesn't serve platform
    • packageName

      public String packageName()
      dev.xichil.mvui.backend.<id with _ for ->: the backend's own package.
      Returns:
      the backend's package, e.g. dev.xichil.mvui.backend.e8_fabric
    • entryClassName

      public String entryClassName()
      The backend's UiBackend implementation.
      Returns:
      the fully qualified name of the implementation's class
    • mixinPackage

      public String mixinPackage()
      Package of the backend's mixins (Fabric and Legacy Fabric backends).
      Returns:
      the mixin package, e.g. dev.xichil.mvui.backend.e8_fabric.mixin
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object