Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ val deps = listOf(
"com.google.code.gson:gson:2.13.2",
"org.bouncycastle:bcpkix-jdk18on:1.82",
"org.apache.httpcomponents.client5:httpclient5:5.5.1",
"org.tomlj:tomlj:1.1.1"
"org.tomlj:tomlj:1.1.1",
"com.h2database:h2-mvstore:2.4.240"
)

dependencies {
// minecraft/loaders uses these, so we cant just implement them because it wont resolve in gradle
deps.forEach { compileOnly(it) }
deps.forEach { runtimeOnly(it) }
deps.forEach { testImplementation(it) }

testImplementation("org.junit.jupiter:junit-jupiter:6.0.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

import java.nio.file.Path;

public class GlobalVariables {
// More or less constants
// TODO cleanup
public class Constants {
public static final Logger LOGGER = LogManager.getLogger("AutoModpack");
public static final String MOD_ID = "automodpack"; // For real its "automodpack_mod" but we use this for resource locations etc.
public static Boolean DEBUG = false;
Expand All @@ -30,6 +32,7 @@ public class GlobalVariables {
public static Jsons.ClientConfigFieldsV2 clientConfig;
public static Jsons.KnownHostsFields knownHosts;
public static final Path automodpackDir = Path.of("automodpack");
public static final Path storeDir = automodpackDir.resolve("store");
public static final Path hostModpackDir = automodpackDir.resolve("host-modpack");
// TODO More server modpacks
// Main - required
Expand All @@ -39,6 +42,8 @@ public class GlobalVariables {
public static Path hostModpackContentFile = hostModpackDir.resolve("automodpack-content.json");
public static Path serverConfigFile = automodpackDir.resolve("automodpack-server.json");
public static Path clientLocalMetadataFile = automodpackDir.resolve("automodpack-client-metadata.json");
public static Path hashCacheDBFile = automodpackDir.resolve("hash-cache.db");
public static Path modCacheDBFile = automodpackDir.resolve("mod-cache.db");
public static Path clientDummyFilesFile = automodpackDir.resolve("automodpack-dummy-files.json");
public static Path clientDeletionTimeStamps = automodpackDir.resolve("automodpack-deletion-timestamps-files.json");
public static Path serverCoreConfigFile = automodpackDir.resolve("automodpack-core.json");
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/pl/skidam/automodpack_core/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import pl.skidam.automodpack_core.protocol.netty.NettyServer;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashSet;

import static pl.skidam.automodpack_core.GlobalVariables.*;
import static pl.skidam.automodpack_core.Constants.*;

public class Server {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.security.SecureRandom;
import java.util.Base64;

import static pl.skidam.automodpack_core.GlobalVariables.*;
import static pl.skidam.automodpack_core.Constants.*;

public class Secrets {
public static class Secret { // unfortunately has to be a class instead of record because of older gson version in 1.18 mc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pl.skidam.automodpack_core.auth;

import pl.skidam.automodpack_core.GlobalVariables;
import pl.skidam.automodpack_core.Constants;
import pl.skidam.automodpack_core.config.ConfigTools;
import pl.skidam.automodpack_core.config.Jsons;

Expand Down Expand Up @@ -52,8 +52,8 @@ public void save(String key, Secrets.Secret secret) throws IllegalArgumentExcept
}
}

private static final SecretsCache hostSecrets = new SecretsCache(GlobalVariables.serverSecretsFile);
private static final SecretsCache clientSecrets = new SecretsCache(GlobalVariables.clientSecretsFile);
private static final SecretsCache hostSecrets = new SecretsCache(Constants.serverSecretsFile);
private static final SecretsCache clientSecrets = new SecretsCache(Constants.clientSecretsFile);

public static Map.Entry<String, Secrets.Secret> getHostSecret(String secret) {
hostSecrets.load();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;

import static pl.skidam.automodpack_core.GlobalVariables.*;
import static pl.skidam.automodpack_core.Constants.*;

public class ConfigTools {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.*;
import java.util.regex.Pattern;

import static pl.skidam.automodpack_core.GlobalVariables.*;
import static pl.skidam.automodpack_core.Constants.*;

public class ConfigUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public ModpackContentItem(String file, String size, String type, boolean editabl

@Override
public String toString() {
return String.format("ModpackContentItems(file=%s, size=%s, type=%s, editable=%s, sha1=%s, murmur=%s)", file, size, type, editable, sha1, murmur);
return String.format("ModpackContentItems(file=%s, size=%s, type=%s, editable=%s, forceCopy=%s, sha1=%s, murmur=%s)", file, size, type, editable, forceCopy, sha1, murmur);
}

// if the relative file path is the same, we consider the items equal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package pl.skidam.automodpack_core.loader;

import pl.skidam.automodpack_core.utils.FileInspection;

import java.util.Collection;

public interface LoaderManagerService {
enum ModPlatform { FABRIC, QUILT, FORGE, NEOFORGE }
enum EnvironmentType { CLIENT, SERVER, UNIVERSAL }

ModPlatform getPlatformType();
Collection<FileInspection.Mod> getModList();
boolean isModLoaded(String modId);
String getLoaderVersion();
EnvironmentType getEnvironmentType();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package pl.skidam.automodpack_core.loader;

import pl.skidam.automodpack_core.utils.FileInspection;
import pl.skidam.automodpack_core.utils.cache.FileMetadataCache;

import java.nio.file.Path;
import java.util.List;

public interface ModpackLoaderService {
void loadModpack(List<Path> modpackMods);
List<FileInspection.Mod> getModpackNestedConflicts(Path modpackDir); // Returns list of mods from the modpack Dir that are conflicting with the mods from standard mods dir
List<FileInspection.Mod> getModpackNestedConflicts(Path modpackDir, FileMetadataCache cache); // Returns list of mods from the modpack Dir that are conflicting with the mods from standard mods dir
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package pl.skidam.automodpack_core.loader;

import pl.skidam.automodpack_core.utils.FileInspection;

import java.util.Collection;

public class NullLoaderManager implements LoaderManagerService {
@Override
public ModPlatform getPlatformType() {
Expand All @@ -15,11 +11,6 @@ public boolean isModLoaded(String modId) {
return false;
}

@Override
public Collection<FileInspection.Mod> getModList() {
return null;
}

@Override
public String getLoaderVersion() {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pl.skidam.automodpack_core.loader;

import pl.skidam.automodpack_core.utils.FileInspection;
import pl.skidam.automodpack_core.utils.cache.FileMetadataCache;

import java.nio.file.Path;
import java.util.List;
Expand All @@ -13,7 +14,7 @@ public void loadModpack(List<Path> modpackMods) {
}

@Override
public List<FileInspection.Mod> getModpackNestedConflicts(Path modpackDir) {
public List<FileInspection.Mod> getModpackNestedConflicts(Path modpackDir, FileMetadataCache cache) {
throw new AssertionError("Loader class not found");
}
}
Loading