mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-30 13:05:25 -05:00
Proper mods metadata
This commit is contained in:
@@ -20,10 +20,12 @@ import me.shedaniel.architectury.Architectury;
|
||||
import me.shedaniel.architectury.ArchitecturyPopulator;
|
||||
import me.shedaniel.architectury.Populatable;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.SharedConstants;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class Platform {
|
||||
private Platform() {}
|
||||
@@ -39,6 +41,11 @@ public final class Platform {
|
||||
return Architectury.getModLoader();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getMinecraftVersion() {
|
||||
return SharedConstants.getCurrentVersion().getId();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Path getGameFolder() {
|
||||
return IMPL.getGameFolder();
|
||||
@@ -63,11 +70,29 @@ public final class Platform {
|
||||
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
|
||||
public static Collection<Mod> getMods() {
|
||||
return IMPL.getMods();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Collection<String> getModIds() {
|
||||
return IMPL.getModIds();
|
||||
}
|
||||
|
||||
public static boolean isDevelopmentEnvironment() {
|
||||
return IMPL.isDevelopmentEnvironment();
|
||||
}
|
||||
|
||||
public interface Impl {
|
||||
Path getGameFolder();
|
||||
|
||||
@@ -82,6 +107,10 @@ public final class Platform {
|
||||
Mod getMod(String id);
|
||||
|
||||
Collection<Mod> getMods();
|
||||
|
||||
Collection<String> getModIds();
|
||||
|
||||
boolean isDevelopmentEnvironment();
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
Reference in New Issue
Block a user