format
This commit is contained in:
parent
e352bb835f
commit
e222633c13
|
@ -3,8 +3,8 @@ package dev.frogmc.frogloader.api.mod;
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.lang.invoke.MethodType;
|
import java.lang.invoke.MethodType;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
@ -79,6 +79,7 @@ public interface ModProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this mod's paths
|
* Get this mod's paths
|
||||||
|
*
|
||||||
* @return Where this mod is loaded from
|
* @return Where this mod is loaded from
|
||||||
*/
|
*/
|
||||||
Collection<Path> paths();
|
Collection<Path> paths();
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package dev.frogmc.frogloader.api.plugin;
|
package dev.frogmc.frogloader.api.plugin;
|
||||||
|
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
|
|
||||||
public interface FrogModProvider {
|
public interface FrogModProvider {
|
||||||
String id();
|
String id();
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ public interface FrogModProvider {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
default void initMods(Collection<ModProperties> mods) {};
|
default void initMods(Collection<ModProperties> mods) {
|
||||||
|
}
|
||||||
|
|
||||||
default ModProperties loadMod(Path path) {
|
default ModProperties loadMod(Path path) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package dev.frogmc.frogloader.api.plugin;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import dev.frogmc.frogloader.api.FrogLoader;
|
import dev.frogmc.frogloader.api.FrogLoader;
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
|
|
|
@ -1,22 +1,5 @@
|
||||||
package dev.frogmc.frogloader.impl;
|
package dev.frogmc.frogloader.impl;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import dev.frogmc.frogloader.api.FrogLoader;
|
|
||||||
import dev.frogmc.frogloader.api.env.Env;
|
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
|
||||||
import dev.frogmc.frogloader.api.plugin.FrogGamePlugin;
|
|
||||||
import dev.frogmc.frogloader.api.plugin.FrogModProvider;
|
|
||||||
import dev.frogmc.frogloader.api.plugin.FrogPlugin;
|
|
||||||
import dev.frogmc.frogloader.impl.gui.LoaderGui;
|
|
||||||
import dev.frogmc.frogloader.impl.launch.MixinClassLoader;
|
|
||||||
import dev.frogmc.frogloader.impl.mod.ModUtil;
|
|
||||||
import dev.frogmc.frogloader.impl.util.CrashReportGenerator;
|
|
||||||
import dev.frogmc.frogloader.impl.util.SystemProperties;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.spongepowered.asm.mixin.MixinEnvironment;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
|
@ -27,6 +10,22 @@ import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import dev.frogmc.frogloader.api.FrogLoader;
|
||||||
|
import dev.frogmc.frogloader.api.env.Env;
|
||||||
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
|
import dev.frogmc.frogloader.api.plugin.FrogGamePlugin;
|
||||||
|
import dev.frogmc.frogloader.api.plugin.FrogModProvider;
|
||||||
|
import dev.frogmc.frogloader.impl.gui.LoaderGui;
|
||||||
|
import dev.frogmc.frogloader.impl.launch.MixinClassLoader;
|
||||||
|
import dev.frogmc.frogloader.impl.mod.ModUtil;
|
||||||
|
import dev.frogmc.frogloader.impl.util.CrashReportGenerator;
|
||||||
|
import dev.frogmc.frogloader.impl.util.SystemProperties;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.spongepowered.asm.mixin.MixinEnvironment;
|
||||||
|
|
||||||
public class FrogLoaderImpl implements FrogLoader {
|
public class FrogLoaderImpl implements FrogLoader {
|
||||||
public static final String MOD_FILE_EXTENSION = ".frogmod";
|
public static final String MOD_FILE_EXTENSION = ".frogmod";
|
||||||
private static final boolean DEV_ENV = Boolean.getBoolean(SystemProperties.DEVELOPMENT);
|
private static final boolean DEV_ENV = Boolean.getBoolean(SystemProperties.DEVELOPMENT);
|
||||||
|
@ -57,7 +56,7 @@ public class FrogLoaderImpl implements FrogLoader {
|
||||||
private final Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
|
|
||||||
// Map<Provider ID, Map<Mod ID, ModProperties>>
|
// Map<Provider ID, Map<Mod ID, ModProperties>>
|
||||||
private Map<String, Map<String, ModProperties>> mods = new HashMap<>();
|
private final Map<String, Map<String, ModProperties>> mods = new HashMap<>();
|
||||||
// private Map<String, ModProperties> mods;
|
// private Map<String, ModProperties> mods;
|
||||||
private Collection<String> modIds = new ArrayList<>();
|
private Collection<String> modIds = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package dev.frogmc.frogloader.impl.gui.component;
|
package dev.frogmc.frogloader.impl.gui.component;
|
||||||
|
|
||||||
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.plaf.basic.BasicBorders;
|
import javax.swing.plaf.basic.BasicBorders;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class DependencyErrorEntry extends JPanel {
|
public class DependencyErrorEntry extends JPanel {
|
||||||
|
|
||||||
private final JPanel actions;
|
private final JPanel actions;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package dev.frogmc.frogloader.impl.gui.page;
|
package dev.frogmc.frogloader.impl.gui.page;
|
||||||
|
|
||||||
import dev.frogmc.frogloader.impl.gui.component.DependencyErrorEntry;
|
|
||||||
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import dev.frogmc.frogloader.impl.gui.component.DependencyErrorEntry;
|
||||||
|
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
||||||
|
|
||||||
public class BreakingDepPage extends JScrollPane {
|
public class BreakingDepPage extends JScrollPane {
|
||||||
|
|
||||||
public BreakingDepPage(ModDependencyResolver.BreakingModException ex) {
|
public BreakingDepPage(ModDependencyResolver.BreakingModException ex) {
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package dev.frogmc.frogloader.impl.gui.page;
|
package dev.frogmc.frogloader.impl.gui.page;
|
||||||
|
|
||||||
import dev.frogmc.frogloader.impl.gui.component.DependencyErrorEntry;
|
|
||||||
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
|
||||||
import dev.frogmc.frogloader.impl.util.PlatformUtil;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import dev.frogmc.frogloader.impl.gui.component.DependencyErrorEntry;
|
||||||
|
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
|
||||||
|
import dev.frogmc.frogloader.impl.util.PlatformUtil;
|
||||||
|
|
||||||
public class UnfulfilledDepPage extends JScrollPane {
|
public class UnfulfilledDepPage extends JScrollPane {
|
||||||
|
|
||||||
public UnfulfilledDepPage(ModDependencyResolver.UnfulfilledDependencyException ex) {
|
public UnfulfilledDepPage(ModDependencyResolver.UnfulfilledDependencyException ex) {
|
||||||
|
|
|
@ -6,7 +6,8 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.google.common.collect.*;
|
import com.google.common.collect.Multimap;
|
||||||
|
import com.google.common.collect.MultimapBuilder;
|
||||||
import dev.frogmc.frogloader.api.mod.ModDependencies;
|
import dev.frogmc.frogloader.api.mod.ModDependencies;
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
import dev.frogmc.frogloader.api.mod.SemVer;
|
import dev.frogmc.frogloader.api.mod.SemVer;
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package dev.frogmc.frogloader.impl.plugin.game.minecraft;
|
package dev.frogmc.frogloader.impl.plugin.game.minecraft;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.invoke.MethodHandle;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.lang.invoke.MethodType;
|
||||||
|
import java.nio.file.*;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import dev.frogmc.frogloader.api.FrogLoader;
|
import dev.frogmc.frogloader.api.FrogLoader;
|
||||||
import dev.frogmc.frogloader.api.plugin.FrogGamePlugin;
|
import dev.frogmc.frogloader.api.plugin.FrogGamePlugin;
|
||||||
|
@ -9,13 +16,6 @@ import dev.frogmc.thyroxine.Thyroxine;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.invoke.MethodHandle;
|
|
||||||
import java.lang.invoke.MethodHandles;
|
|
||||||
import java.lang.invoke.MethodType;
|
|
||||||
import java.nio.file.*;
|
|
||||||
|
|
||||||
public class MinecraftGamePlugin implements FrogGamePlugin {
|
public class MinecraftGamePlugin implements FrogGamePlugin {
|
||||||
|
|
||||||
protected final String[] MINECRAFT_CLASSES = new String[]{
|
protected final String[] MINECRAFT_CLASSES = new String[]{
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
package dev.frogmc.frogloader.impl.plugin.mod;
|
package dev.frogmc.frogloader.impl.plugin.mod;
|
||||||
|
|
||||||
import dev.frogmc.frogloader.api.FrogLoader;
|
|
||||||
import dev.frogmc.frogloader.api.extensions.PreLaunchExtension;
|
|
||||||
import dev.frogmc.frogloader.api.mod.ModProperties;
|
|
||||||
import dev.frogmc.frogloader.api.plugin.FrogModProvider;
|
|
||||||
import dev.frogmc.frogloader.impl.mod.ModPropertiesReader;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.FileSystem;
|
import java.nio.file.FileSystem;
|
||||||
import java.nio.file.FileSystems;
|
import java.nio.file.FileSystems;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import dev.frogmc.frogloader.api.extensions.PreLaunchExtension;
|
||||||
|
import dev.frogmc.frogloader.api.mod.ModProperties;
|
||||||
|
import dev.frogmc.frogloader.api.plugin.FrogModProvider;
|
||||||
|
import dev.frogmc.frogloader.impl.mod.ModPropertiesReader;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class FrogmodModProvider implements FrogModProvider {
|
public class FrogmodModProvider implements FrogModProvider {
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ public class FrogmodModProvider implements FrogModProvider {
|
||||||
@Override
|
@Override
|
||||||
public boolean isFileApplicable(Path path) {
|
public boolean isFileApplicable(Path path) {
|
||||||
if (!path.toString().endsWith(".frogmod")) {
|
if (!path.toString().endsWith(".frogmod")) {
|
||||||
LOGGER.info("File {} is not a frogmod file", path.toString());
|
LOGGER.info("File {} is not a frogmod file", path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try (FileSystem fs = FileSystems.newFileSystem(path)) {
|
try (FileSystem fs = FileSystems.newFileSystem(path)) {
|
||||||
|
|
Loading…
Reference in a new issue