|
@@ -20,10 +20,12 @@ import me.shedaniel.architectury.Architectury;
|
|
import me.shedaniel.architectury.ArchitecturyPopulator;
|
|
import me.shedaniel.architectury.ArchitecturyPopulator;
|
|
import me.shedaniel.architectury.Populatable;
|
|
import me.shedaniel.architectury.Populatable;
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.EnvType;
|
|
|
|
+import net.minecraft.SharedConstants;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
|
import java.nio.file.Path;
|
|
import java.nio.file.Path;
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
public final class Platform {
|
|
public final class Platform {
|
|
private Platform() {}
|
|
private Platform() {}
|
|
@@ -39,6 +41,11 @@ public final class Platform {
|
|
return Architectury.getModLoader();
|
|
return Architectury.getModLoader();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @NotNull
|
|
|
|
+ public static String getMinecraftVersion() {
|
|
|
|
+ return SharedConstants.getCurrentVersion().getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
@NotNull
|
|
@NotNull
|
|
public static Path getGameFolder() {
|
|
public static Path getGameFolder() {
|
|
return IMPL.getGameFolder();
|
|
return IMPL.getGameFolder();
|
|
@@ -63,11 +70,29 @@ public final class Platform {
|
|
return IMPL.getMod(id);
|
|
return IMPL.getMod(id);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @NotNull
|
|
|
|
+ public static Optional<Mod> getOptionalMod(String id) {
|
|
|
|
+ try {
|
|
|
|
+ return Optional.of(IMPL.getMod(id));
|
|
|
|
+ } catch (NullPointerException e) {
|
|
|
|
+ return Optional.empty();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@NotNull
|
|
@NotNull
|
|
public static Collection<Mod> getMods() {
|
|
public static Collection<Mod> getMods() {
|
|
return IMPL.getMods();
|
|
return IMPL.getMods();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @NotNull
|
|
|
|
+ public static Collection<String> getModIds() {
|
|
|
|
+ return IMPL.getModIds();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static boolean isDevelopmentEnvironment() {
|
|
|
|
+ return IMPL.isDevelopmentEnvironment();
|
|
|
|
+ }
|
|
|
|
+
|
|
public interface Impl {
|
|
public interface Impl {
|
|
Path getGameFolder();
|
|
Path getGameFolder();
|
|
|
|
|
|
@@ -82,6 +107,10 @@ public final class Platform {
|
|
Mod getMod(String id);
|
|
Mod getMod(String id);
|
|
|
|
|
|
Collection<Mod> getMods();
|
|
Collection<Mod> getMods();
|
|
|
|
+
|
|
|
|
+ Collection<String> getModIds();
|
|
|
|
+
|
|
|
|
+ boolean isDevelopmentEnvironment();
|
|
}
|
|
}
|
|
|
|
|
|
static {
|
|
static {
|