Merge 1.20 into 1.20.4
This commit is contained in:
commit
16ef9253e6
|
|
@ -1,7 +1,6 @@
|
||||||
package org.embeddedt.modernfix.fabric.mappings;
|
package org.embeddedt.modernfix.fabric.mappings;
|
||||||
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.*;
|
||||||
import net.fabricmc.loader.api.MappingResolver;
|
|
||||||
import net.fabricmc.loader.impl.launch.FabricLauncherBase;
|
import net.fabricmc.loader.impl.launch.FabricLauncherBase;
|
||||||
import net.fabricmc.loader.impl.launch.MappingConfiguration;
|
import net.fabricmc.loader.impl.launch.MappingConfiguration;
|
||||||
import org.embeddedt.modernfix.util.CommonModUtil;
|
import org.embeddedt.modernfix.util.CommonModUtil;
|
||||||
|
|
@ -9,18 +8,36 @@ import org.embeddedt.modernfix.util.CommonModUtil;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Designed for Fabric Loader 0.14.x, probably has issues on other versions. The entire thing is wrapped in a try-catch
|
* Designed for Fabric Loader 0.14.x, probably has issues on other versions. The entire thing is wrapped in a try-catch
|
||||||
* so it should never cause crashes, just fail to work.
|
* so it should never cause crashes, just fail to work.
|
||||||
*/
|
*/
|
||||||
public class MappingsClearer {
|
public class MappingsClearer {
|
||||||
|
private static final Version LOADER_015;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
LOADER_015 = Version.parse("0.15.0");
|
||||||
|
} catch (VersionParsingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static void clear() {
|
public static void clear() {
|
||||||
// TODO: Port this to Fabric Loader 0.15
|
// TODO: Port this to Fabric Loader 0.15
|
||||||
|
|
||||||
if(true) //FabricLoader.getInstance().isDevelopmentEnvironment())
|
if(true) //FabricLoader.getInstance().isDevelopmentEnvironment())
|
||||||
return; // never do this in dev
|
return; // never do this in dev
|
||||||
|
|
||||||
|
Optional<Version> loaderVersion = FabricLoader.getInstance().getModContainer("fabricloader").map(m -> m.getMetadata().getVersion());
|
||||||
|
if(!loaderVersion.isPresent() || LOADER_015.compareTo(loaderVersion.get()) < 0) {
|
||||||
|
// Fabric Loader is probably too new, abort
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CommonModUtil.runWithoutCrash(() -> {
|
CommonModUtil.runWithoutCrash(() -> {
|
||||||
// For now, force the mapping resolver to be initialized. Fabric Loader 0.14.23 stops initializing it early,
|
// For now, force the mapping resolver to be initialized. Fabric Loader 0.14.23 stops initializing it early,
|
||||||
// which means that we actually need to keep the TinyMappingFactory tree around for initialization to work
|
// which means that we actually need to keep the TinyMappingFactory tree around for initialization to work
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user