Update LibJF
This commit is contained in:
parent
d9cdc43254
commit
9d45d0f23d
|
@ -9,4 +9,5 @@ dependencies {
|
|||
|
||||
// Compat fix
|
||||
include modImplementation(fabricApi.module("fabric-command-api-v1", "${project.fabric_version}"))
|
||||
include modImplementation('io.gitlab.jfronny:gson:2.9.0.2022.4.2.19.45.43') // Dependency of LibJF 2.7.0
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# https://fabricmc.net/develop/
|
||||
minecraft_version=1.18.2
|
||||
yarn_mappings=build.1
|
||||
yarn_mappings=build.2
|
||||
loader_version=0.13.3
|
||||
# Mod Properties
|
||||
maven_group=io.gitlab.jfronny
|
||||
archives_base_name=modsmod
|
||||
|
||||
jfapi_version=2.5.0
|
||||
fabric_version=0.47.8+1.18.2
|
||||
jfapi_version=2.7.1
|
||||
fabric_version=0.48.0+1.18.2
|
||||
|
||||
modrinth_id=4GhX11Ed
|
||||
modrinth_optional_dependencies=mOgUt4GM
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.gitlab.jfronny.modsmod;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import io.gitlab.jfronny.gson.reflect.TypeToken;
|
||||
import io.gitlab.jfronny.modsmod.util.IteratorCallbackList;
|
||||
import net.fabricmc.loader.impl.FabricLoaderImpl;
|
||||
import net.fabricmc.loader.impl.ModContainerImpl;
|
||||
|
@ -30,7 +30,7 @@ public class FabricLoaderInterface {
|
|||
CREATE_PLAIN_METHOD = ModCandidate.class.getDeclaredMethod("createPlain", new TypeToken<List<Path>>(){}.getRawType(), LoaderModMetadata.class, boolean.class, new TypeToken<Collection<ModCandidate>>(){}.getRawType());
|
||||
CREATE_PLAIN_METHOD.setAccessible(true);
|
||||
} catch (NoSuchMethodException | NoSuchFieldException e) {
|
||||
ModsMod.LOGGER.error("Failed to get reference to fabric-loader internals. The fabric-loader version may be incompatible with patchwork-runtime.", e);
|
||||
MMSafeLog.error("Failed to get reference to fabric-loader internals. The fabric-loader version may be incompatible with patchwork-runtime.", e);
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
@ -41,12 +41,12 @@ public class FabricLoaderInterface {
|
|||
try {
|
||||
MODS_FIELD.set(fabricLoader, modContainers);
|
||||
} catch (IllegalAccessException e) {
|
||||
ModsMod.LOGGER.error("Failed to reset mods field", e);
|
||||
MMSafeLog.error("Failed to reset mods field", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, ModsMod::loadMods));
|
||||
} catch (IllegalAccessException e) {
|
||||
ModsMod.LOGGER.error("Failed to make mods list synchronized.", e);
|
||||
MMSafeLog.error("Failed to make mods list synchronized.", e);
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class FabricLoaderInterface {
|
|||
try {
|
||||
ADD_MOD_METHOD.invoke(fabricLoader, modCandidate);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
ModsMod.LOGGER.error("Failed to inject mod into fabric-loader.", e);
|
||||
MMSafeLog.error("Failed to inject mod into fabric-loader.", e);
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class FabricLoaderInterface {
|
|||
try {
|
||||
return (ModCandidate) CREATE_PLAIN_METHOD.invoke(null, List.of(path), metadata, requiresRemap, nestedMods);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
ModsMod.LOGGER.error("Failed to create plain mod container", e);
|
||||
MMSafeLog.error("Failed to create plain mod container", e);
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package io.gitlab.jfronny.modsmod;
|
||||
|
||||
import net.fabricmc.loader.impl.util.log.Log;
|
||||
import net.fabricmc.loader.impl.util.log.LogCategory;
|
||||
|
||||
public class MMSafeLog {
|
||||
private static final LogCategory LOG_CATEGORY = new LogCategory("modsmod");
|
||||
|
||||
public static void error(String text) {
|
||||
Log.error(LOG_CATEGORY, text);
|
||||
}
|
||||
|
||||
public static void error(String text, Throwable e) {
|
||||
Log.error(LOG_CATEGORY, text, e);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package io.gitlab.jfronny.modsmod;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.gitlab.jfronny.gson.Gson;
|
||||
import io.gitlab.jfronny.libjf.config.api.ConfigInstance;
|
||||
import io.gitlab.jfronny.libjf.config.impl.ConfigInstanceImpl;
|
||||
import io.gitlab.jfronny.libjf.config.impl.ConfigInstanceRoot;
|
||||
import io.gitlab.jfronny.libjf.unsafe.UltraEarlyInit;
|
||||
import io.gitlab.jfronny.modsmod.builder.JsonBuilder;
|
||||
import io.gitlab.jfronny.modsmod.builder.ModMeta;
|
||||
|
@ -12,8 +12,6 @@ import net.fabricmc.loader.impl.metadata.LoaderModMetadata;
|
|||
import net.fabricmc.loader.impl.metadata.ModMetadataParser;
|
||||
import net.fabricmc.loader.impl.metadata.ParseMetadataException;
|
||||
import net.fabricmc.loader.impl.util.FileSystemUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystem;
|
||||
|
@ -24,7 +22,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashSet;
|
||||
|
||||
public class ModsMod implements UltraEarlyInit {
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(ModsMod.MOD_ID);
|
||||
static final HashSet<ModMeta> MODS = new HashSet<>();
|
||||
static final FabricLoaderImpl LOADER = FabricLoaderImpl.INSTANCE;
|
||||
public static final Gson GSON = new Gson();
|
||||
|
@ -35,7 +32,7 @@ public class ModsMod implements UltraEarlyInit {
|
|||
public void init() {
|
||||
try {
|
||||
//Load config
|
||||
Path modsmodCfgFile = ((ConfigInstanceImpl)ConfigInstance.get(MOD_ID)).path;
|
||||
Path modsmodCfgFile = ((ConfigInstanceRoot)ConfigInstance.get(MOD_ID)).path;
|
||||
//make sure the modsmodcache dir is ok
|
||||
Path path = LOADER.getConfigDir().resolve(CACHE_NAME);
|
||||
if (!Files.isDirectory(path)) {
|
||||
|
|
Loading…
Reference in New Issue