Skip to content

Commit

Permalink
Develop 1.21.1 beta 6 (#1636)
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD authored Jan 20, 2025
2 parents 99441a8 + e83b753 commit 75b3692
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 30 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ org.gradle.caching=true
#org.gradle.configuration-cache=true

# Versions
versionConnector=2.0.0-beta.5
versionConnector=2.0.0-beta.6
versionAdapter=1.13.20+1.21.1-20240811.191740
versionAdapterDefinition=1.13.23+1.21.1
versionAdapterRuntime=1.0.0+1.21.1

versionMc=1.21.1
versionNeoForge=21.1.90
versionNeoForge=21.1.97
versionParchmentMc=1.21
versionParchment=2024.07.28
versionForgeAutoRenamingTool=1.0.12
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.sinytra.connector.locator;

import com.mojang.logging.LogUtils;
import cpw.mods.jarhandling.SecureJar;
import net.neoforged.fml.loading.moddiscovery.readers.JarModsDotTomlModFileReader;
import net.neoforged.neoforgespi.ILaunchContext;
Expand All @@ -12,9 +11,7 @@
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.filter.MarkerFilter;
import org.sinytra.connector.ConnectorEarlyLoader;
import org.sinytra.connector.service.DummyVirtualJar;
import org.slf4j.Logger;

import java.util.Arrays;
import java.util.Locale;
Expand All @@ -27,26 +24,9 @@
* An ugly hack to sort FML dependency providers and make sure {@link ConnectorLocator ours} comes last.
*/
public class ConnectorEarlyLocatorBootstrap implements IModFileCandidateLocator {
private static final Logger LOGGER = LogUtils.getLogger();

private static ILaunchContext launchContext;

public ConnectorEarlyLocatorBootstrap() {
// Unfortunately, FML doesn't provide a way to sort mod/dependency locators by priority, so we have to create our own
try {
// Method method = FMLLoader.class.getDeclaredMethod("getModDiscoverer");
// method.setAccessible(true);
// ModDiscoverer discoverer = (ModDiscoverer) method.invoke(null);
// Field field = ModDiscoverer.class.getDeclaredField("dependencyLocatorList");
// field.setAccessible(true);
// List<IDependencyLocator> dependencyLocatorList = (List<IDependencyLocator>) field.get(discoverer);
// // 1 - move under; 0 - preserve original order
// dependencyLocatorList.sort(Comparator.comparingInt(loc -> loc instanceof ConnectorLocator ? 1 : 0));
} catch (Throwable t) {
LOGGER.error("Error sorting FML dependency locators", t);
// We can't throw here as that would prevent the connector mod from loading and lead to fabric loader being loaded twice instead
ConnectorEarlyLoader.addGenericLoadingException(t, "Error sorting FML dependency locators");
}
injectLogMarkers();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.sinytra.connector.locator.filter.SplitPackageMerger;
import org.sinytra.connector.transformer.jar.JarTransformer;
import org.sinytra.connector.util.ConnectorUtil;
import org.sinytra.connector.util.PriorityModLoadingException;
import org.slf4j.Logger;

import java.io.IOException;
Expand Down Expand Up @@ -75,6 +76,8 @@ public void scanMods(List<IModFile> loadedMods, IDiscoveryPipeline pipeline) {
}

loadEmbeddedJars(pipeline);
} catch (PriorityModLoadingException e) {
throw e;
} catch (ModLoadingException e) {
// Let these pass through
ConnectorEarlyLoader.addGenericLoadingException(e.getIssues());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.sinytra.adapter.patch.api.PatchAuditTrail;
import org.sinytra.connector.transformer.jar.JarTransformer;
import org.sinytra.connector.util.ConnectorConfig;
import org.sinytra.connector.util.PriorityModLoadingException;
import org.slf4j.Logger;

import java.util.List;
Expand Down Expand Up @@ -41,6 +42,6 @@ public static void trigger(List<JarTransformer.TransformedFabricModPath> failing
builder.append("\n");
});

throw new ModLoadingException(ModLoadingIssue.error(builder.toString()));
throw new PriorityModLoadingException(ModLoadingIssue.error(builder.toString()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import net.fabricmc.loader.impl.FabricLoaderImpl;
import net.neoforged.fml.loading.LoadingModList;
import net.neoforged.fml.loading.moddiscovery.ModFileInfo;
import net.neoforged.fml.loading.moddiscovery.ModFileParser;
import org.sinytra.connector.ConnectorEarlyLoader;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.FabricUtil;
Expand All @@ -49,13 +50,13 @@ public static void init() {
Map<String, ModFileInfo> configToModMap = new HashMap<>();

for (ModFileInfo modFile : LoadingModList.get().getModFiles()) {
List<String> mixinConfigs = modFile.getFile().getMixinConfigs();
List<ModFileParser.MixinConfig> mixinConfigs = modFile.getFile().getMixinConfigs();
if (mixinConfigs != null) {
for (String config : mixinConfigs) {
if (Files.exists(modFile.getFile().findResource(config))) {
ModFileInfo prev = configToModMap.putIfAbsent(config, modFile);
for (ModFileParser.MixinConfig config : mixinConfigs) {
if (Files.exists(modFile.getFile().findResource(config.config()))) {
ModFileInfo prev = configToModMap.putIfAbsent(config.config(), modFile);
if (prev != null)
LOGGER.debug("Non-unique Mixin config name {} used by the mods {} and {}", config, prev.moduleName(), modFile.moduleName());
LOGGER.debug("Non-unique Mixin config name {} used by the mods {} and {}", config.config(), prev.moduleName(), modFile.moduleName());
}
}
}
Expand Down Expand Up @@ -122,7 +123,7 @@ else if (dep.getKind() == ModDependency.Kind.BREAKS) {

if (reqIntervals.isEmpty()) throw new IllegalStateException("mod " + metadata.getId() + " is incompatible with every loader version?"); // shouldn't get there

Version minLoaderVersion = reqIntervals.get(0).getMin(); // it is sorted, to 0 has the absolute lower bound
Version minLoaderVersion = reqIntervals.getFirst().getMin(); // it is sorted, to 0 has the absolute lower bound

if (minLoaderVersion != null) { // has a lower bound
for (LoaderMixinVersionEntry version : VERSIONS) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.sinytra.connector.util;

import net.neoforged.fml.ModLoadingException;
import net.neoforged.fml.ModLoadingIssue;

import java.util.List;

public class PriorityModLoadingException extends ModLoadingException {
public PriorityModLoadingException(ModLoadingIssue issue) {
super(issue);
}

public PriorityModLoadingException(List<ModLoadingIssue> issues) {
super(issues);
}
}
2 changes: 1 addition & 1 deletion src/mod/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ config="connector.mixins.json"
[[dependencies.connector]]
modId="neoforge"
type="required"
versionRange="*"
versionRange="[21.1.97,)"
ordering="NONE"
side="BOTH"
[[dependencies.connector]]
Expand Down

0 comments on commit 75b3692

Please sign in to comment.