diff --git a/common/src/main/java/me/shedaniel/architectury/platform/Platform.java b/common/src/main/java/me/shedaniel/architectury/platform/Platform.java index f39d577a..a878d35d 100644 --- a/common/src/main/java/me/shedaniel/architectury/platform/Platform.java +++ b/common/src/main/java/me/shedaniel/architectury/platform/Platform.java @@ -29,6 +29,7 @@ import org.jetbrains.annotations.ApiStatus; import java.nio.file.Path; import java.util.Collection; +import java.util.NoSuchElementException; import java.util.Optional; public final class Platform { @@ -77,49 +78,118 @@ public final class Platform { return SharedConstants.getCurrentVersion().getId(); } + /** + * Gets the root directory for the current instance of Minecraft. + *
+ * The returned path is guaranteed to be absolute.
+ */
@ExpectPlatform
public static Path getGameFolder() {
throw new AssertionError();
}
+ /**
+ * Gets the main config folder for the current instance of Minecraft.
+ *
+ * The returned path is guaranteed to be absolute.
+ */
@ExpectPlatform
public static Path getConfigFolder() {
throw new AssertionError();
}
+ /**
+ * Gets the mods folder of the current instance of Minecraft.
+ *
+ * The returned path is guaranteed to be absolute.
+ */
+ @ExpectPlatform
+ public static Path getModsFolder() {
+ throw new AssertionError();
+ }
+
+ /**
+ * Returns the current Environment the game is running in,
+ * being one of either CLIENT or SERVER.
+ *
+ * The class returned is a platform-agnostic wrapper around the
+ * EnvType and Dist enums, respectively.
+ *
+ * @return The current Environment, as an instance of {@link Env}
+ * @see Env
+ * @see #getEnv()
+ */
@ExpectPlatform
public static Env getEnvironment() {
throw new AssertionError();
}
+ /**
+ * Returns the current Environment the game is running in,
+ * as a member of the {@link EnvType} enum. This is remapped
+ * on Forge to be the Dist enum, instead.
+ *
+ * @return The current Environment, as an instance of {@link EnvType}
+ * (or Dist on Forge)
+ */
@ExpectPlatform
public static EnvType getEnv() {
throw new AssertionError();
}
+ /**
+ * Checks whether a mod with the given mod ID is present.
+ *
+ * @param id The mod ID to check.
+ * @return true if the mod is loaded, false otherwise.
+ */
@ExpectPlatform
public static boolean isModLoaded(String id) {
throw new AssertionError();
}
+ /**
+ * Gets a {@link Mod} container by its mod ID.
+ *
+ * @param id The mod ID to look for.
+ * @return The mod container, if found.
+ * @throws NoSuchElementException if no mod with the given ID exists
+ */
@ExpectPlatform
public static Mod getMod(String id) {
throw new AssertionError();
}
+ /**
+ * Optionally gets a {@link Mod} container by its mod ID if it exists.
+ *
+ * @param id The mod ID to look for.
+ * @return An optional representing the mod container, if found,
+ * or an empty optional otherwise.
+ */
public static Optional