Enum Class Side

java.lang.Object
java.lang.Enum<Side>
org.moddingx.launcherlib.util.Side
All Implemented Interfaces:
Serializable, Comparable<Side>, Constable

public enum Side extends Enum<Side>
Marks a physical side for a mod to be placed in.
  • Enum Constant Details

    • CLIENT

      public static final Side CLIENT
      Only the physical client without server.
    • SERVER

      public static final Side SERVER
      Only the dedicated server without the client.
    • COMMON

      public static final Side COMMON
      Both client and server.
  • Field Details

    • id

      public final String id
      The id of this side.
    • client

      public final boolean client
      Whether this side includes the client.
    • server

      public final boolean server
      Whether this side includes the dedicated server.
  • Method Details

    • values

      public static Side[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Side valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • byId

      public static Side byId(String id)
      Gets a Side from its id.
      Throws:
      IllegalArgumentException - if an invalid id is given.
    • get

      @Nullable public static Side get(boolean client, boolean server)
      Gets a side object that matches the given availability on client and server. If both client and server are false, null is returned.
    • merge

      public static Side merge(Side... sides)
      Merges multiple Sides to return a Side that includes all of them. Merging zero sides returns COMMON. Otherwise if sides contains only CLIENT values, CLIENT is returned, if sides contains only SERVER values, SERVER is returned. If sides contains both CLIENT and SERVER or contains COMMON, COMMON is returned.
    • and

      @Nullable public static Side and(Side... sides)
      Adds multiple Sides. This can be used to determine the required side for transitive dependencies. Suppose a mod A is installed on side sideA and has a dependency for side sideB. and(sideA, sideB) would then be the side, on which the dependency is required.

      If the dependency is not required at all (for example because mod A is only installed on the server but mod B is a client only dependency of mod A), this method returns null.