mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 14:34:28 +00:00
1.16.5 Initial Update.
This commit is contained in:
1 parent
dd10933ab0
commit
f173bde812
5 files changed
+29
-28
No files matched your search
@@ -24,20 +24,32 @@ import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.function.BiPredicate;
|
||||
|
||||
public class VersionSupportMatrix {
|
||||
private static final HashMap<String, ArtifactVersion> overrideVersions = new HashMap<>();
|
||||
private static final HashMap<String, List<ArtifactVersion>> overrideVersions = new HashMap<>();
|
||||
static {
|
||||
final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.mcVersion);
|
||||
if (MavenVersionAdapter.createFromVersionSpec("[1.16.4]").containsVersion(version)) {
|
||||
overrideVersions.put("languageloader.javafml", new DefaultArtifactVersion("34")); // we also work with javafml 34
|
||||
overrideVersions.put("mod.minecraft", new DefaultArtifactVersion("1.16.3")); // we work with anything declaring 1.16.3
|
||||
overrideVersions.put("mod.forge", new DefaultArtifactVersion("34.1.42")); // we work with anything that supports forge 34.1.42
|
||||
if (MavenVersionAdapter.createFromVersionSpec("[1.16.4,1.16.5]").containsVersion(version)) {
|
||||
// 1.16.4 is Compatible with 1.16.3
|
||||
add("languageloader.javafml", "34");
|
||||
add("mod.minecraft", "1.16.3");
|
||||
add("mod.forge", "34.1.42");
|
||||
// 1.16.5 is Compatible with 1.16.4, and thus 1.16.3
|
||||
add("languageloader.javafml", "35");
|
||||
add("mod.minecraft", "1.16.4");
|
||||
add("mod.forge", "35.1.37");
|
||||
}
|
||||
}
|
||||
private static void add(String key, String value) {
|
||||
overrideVersions.computeIfAbsent(key, k -> new ArrayList<>()).add(new DefaultArtifactVersion(value));
|
||||
}
|
||||
public static <T> boolean testVersionSupportMatrix(VersionRange declaredRange, String lookupId, String type, BiPredicate<String, VersionRange> standardLookup) {
|
||||
return standardLookup.test(lookupId, declaredRange) || overrideVersions.containsKey(type +"." +lookupId) && declaredRange.containsVersion(overrideVersions.get(type +"." +lookupId));
|
||||
if (standardLookup.test(lookupId, declaredRange)) return true;
|
||||
List<ArtifactVersion> custom = overrideVersions.get(type +"." +lookupId);
|
||||
return custom == null ? false : custom.stream().anyMatch(declaredRange::containsVersion);
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public class ModLoader
|
||||
{
|
||||
final Map<String, IModInfo> modInfoMap = modFile.getModFileInfo().getMods().stream().collect(Collectors.toMap(IModInfo::getModId, Function.identity()));
|
||||
|
||||
LOGGER.debug(LOADING, "ModContainer is {}", ModContainer.class.getClassLoader());
|
||||
LOGGER.trace(LOADING, "ModContainer is {}", ModContainer.class.getClassLoader());
|
||||
final List<ModContainer> containers = modFile.getScanResult().getTargets()
|
||||
.entrySet()
|
||||
.stream()
|
||||
|
||||
@@ -59,7 +59,7 @@ public class FMLModContainer extends ModContainer
|
||||
try
|
||||
{
|
||||
modClass = Class.forName(className, true, modClassLoader);
|
||||
LOGGER.debug(LOADING,"Loaded modclass {} with {}", modClass.getName(), modClass.getClassLoader());
|
||||
LOGGER.trace(LOADING,"Loaded modclass {} with {}", modClass.getName(), modClass.getClassLoader());
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
@@ -77,9 +77,9 @@ public class FMLModContainer extends ModContainer
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGGER.debug(LOADING, "Loading mod instance {} of type {}", getModId(), modClass.getName());
|
||||
LOGGER.trace(LOADING, "Loading mod instance {} of type {}", getModId(), modClass.getName());
|
||||
this.modInstance = modClass.newInstance();
|
||||
LOGGER.debug(LOADING, "Loaded mod instance {} of type {}", getModId(), modClass.getName());
|
||||
LOGGER.trace(LOADING, "Loaded mod instance {} of type {}", getModId(), modClass.getName());
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
@@ -87,9 +87,9 @@ public class FMLModContainer extends ModContainer
|
||||
throw new ModLoadingException(modInfo, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmod", e, modClass);
|
||||
}
|
||||
try {
|
||||
LOGGER.debug(LOADING, "Injecting Automatic event subscribers for {}", getModId());
|
||||
LOGGER.trace(LOADING, "Injecting Automatic event subscribers for {}", getModId());
|
||||
AutomaticEventSubscriber.inject(this, this.scanResults, this.modClass.getClassLoader());
|
||||
LOGGER.debug(LOADING, "Completed Automatic event subscribers for {}", getModId());
|
||||
LOGGER.trace(LOADING, "Completed Automatic event subscribers for {}", getModId());
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error(LOADING,"Failed to register automatic subscribers. ModID: {}, class {}", getModId(), modClass.getName(), e);
|
||||
throw new ModLoadingException(modInfo, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmod", e, modClass);
|
||||
@@ -116,9 +116,9 @@ public class FMLModContainer extends ModContainer
|
||||
@Override
|
||||
protected <T extends Event & IModBusEvent> void acceptEvent(final T e) {
|
||||
try {
|
||||
LOGGER.debug(LOADING, "Firing event for modid {} : {}", this.getModId(), e);
|
||||
LOGGER.trace(LOADING, "Firing event for modid {} : {}", this.getModId(), e);
|
||||
this.eventBus.post(e);
|
||||
LOGGER.debug(LOADING, "Fired event for modid {} : {}", this.getModId(), e);
|
||||
LOGGER.trace(LOADING, "Fired event for modid {} : {}", this.getModId(), e);
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error(LOADING,"Caught exception during event {} dispatch for modid {}", e, this.getModId(), t);
|
||||
throw new ModLoadingException(modInfo, modLoadingStage, "fml.modloading.errorduringevent", t);
|
||||
|
||||
Reference in new issue
Block a user