Skip to content

Commit

Permalink
Develop beta 28 (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD authored Dec 2, 2023
2 parents fd56cff + ca2e4ed commit bceb367
Show file tree
Hide file tree
Showing 17 changed files with 409 additions and 99 deletions.
21 changes: 14 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
name: Bug Report
description: Report an issue you've encountered
labels: [bug]
labels: [ bug ]
body:
- type: markdown
attributes:
value: "## Welcome!"
value: "## 👋 Welcome!"
- type: markdown
attributes:
value: |
Thank you for taking your time to report this bug!
Make sure you are running the latest version before reporting.
### 📋 Checklist
Thank you for taking your time to report this bug!
Before reporting, please make ensure that:
- You are using the **latest** available version of Connector and its dependencies
- You've installed a **minimal set of mods** required to reproduce the issue.
Issues with modpacks and excessive amount of mods will *not* be accepted, as they take a long time to diagnose.
Knowing which mods are causing problems allows us to focus on fixing the issue as soon as possible.
If you're unsure which mods might be at fault, try using [binary search](https://www.reddit.com/r/feedthebeast/comments/evpy6r/tips_for_modpack_authors_how_to_find_misbehaving/) - removing half of installed mods
repeatedly until the faulty mod is found.
- type: input
id: description
attributes:
Expand All @@ -36,10 +43,10 @@ body:
attributes:
label: Logs
description: |
If applicable (crash, error output in console), please provide your crash report or latest.log
To upload logs, use an external site to post the crash report, such as [Ubuntu Pastebin](https://paste.ubuntu.com/), [Pastebin](http://pastebin.com/), or [Github Gist](https://gist.github.com/)
If applicable (crash, error output in console), please provide your debug.log **and** crash report
To upload logs, use an external paste site, such as [Github Gist](https://gist.github.com/) (recommended), [Ubuntu Pastebin](https://paste.ubuntu.com/) or [Pastebin](http://pastebin.com)
- type: textarea
id: context
attributes:
label: Additional context
description: "Add any other context about the problem here, such as the modpack you're playing or other mods that might be causing this bug."
description: "Add any other context about the problem here, such as your current environment or other mods that might be causing this bug."
19 changes: 13 additions & 6 deletions .github/ISSUE_TEMPLATE/mod_incompatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ labels: [compat]
body:
- type: markdown
attributes:
value: "## Welcome!"
value: "## 👋 Welcome!"
- type: markdown
attributes:
value: |
Thank you for taking your time to report this incompatibility!
Make sure you are running the latest version of Connector and its dependencies before reporting.
### 📋 Checklist
Thank you for taking your time to report this bug!
Before reporting, please make ensure that:
- You are using the **latest** available version of Connector and its dependencies
- You've installed a **minimal set of mods** required to reproduce the issue.
Issues with modpacks and excessive amount of mods will *not* be accepted, as they take a long time to diagnose.
Knowing which mods are causing problems allows us to focus on fixing the issue as soon as possible.
If you're unsure which mods might be at fault, try using [binary search](https://www.reddit.com/r/feedthebeast/comments/evpy6r/tips_for_modpack_authors_how_to_find_misbehaving/) - removing half of installed mods
repeatedly until the faulty mod is found.
- type: input
id: mod
attributes:
Expand Down Expand Up @@ -51,13 +58,13 @@ body:
attributes:
label: Logs
description: |
If applicable (crash, error output in console), please provide your crash report.
If applicable (crash, error output in console), please provide your debug.log **and** crash report.
Otherwise, we recommend uploading the debug.log found in your `.minecraft/logs` directory.
To upload logs, use an external site to post the crash report, such as [Ubuntu Pastebin](https://paste.ubuntu.com/), [Pastebin](http://pastebin.com/), or [Github Gist](https://gist.github.com/)
To upload logs, use an external paste site, such as [Github Gist](https://gist.github.com/) (recommended), [Ubuntu Pastebin](https://paste.ubuntu.com/) or [Pastebin](http://pastebin.com/)
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional context
description: "Add any other context about the problem here, such as the modpack you're playing or other mods that might be causing this bug."
description: "Add any other context about the problem here, such as your current environment or other mods that might be causing this bug."
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on [MinecraftForge](https://minecraftforge.net). Its goal is to bring the two pl
developers time and effort maintaining their mods for multiple platforms at once, as well as allowing players to play
all their favourite mods in one modpack.

### Recommendations
### 🔗 Related Projects

- Visit the [Mod Compatibility Thread](https://github.com/Sinytra/Connector/discussions/12) to can find information about known working / incompatible mods
- To learn more about how Connector works, read our [Introductory blog post](https://github.com/Sinytra/Connector/discussions/11)
Expand Down
55 changes: 28 additions & 27 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import me.modmuss50.mpp.ReleaseType
import net.minecraftforge.gradle.common.util.MavenArtifactDownloader
import net.minecraftforge.gradle.common.util.RunConfig
import net.minecraftforge.gradle.userdev.tasks.JarJar
import net.minecraftforge.gradle.userdev.util.MavenPomUtils
import net.minecraftforge.jarjar.metadata.*
import org.apache.maven.artifact.versioning.DefaultArtifactVersion
import org.apache.maven.artifact.versioning.VersionRange
import java.nio.file.FileSystems
import java.nio.file.Files
import java.nio.file.StandardOpenOption
import java.time.LocalDateTime
import kotlin.io.path.inputStream

plugins {
java
Expand All @@ -28,6 +31,7 @@ val versionMc: String by project
val versionForge: String by project
val versionForgeAutoRenamingTool: String by project
val versionFabricLoader: String by project
val versionFabricLoaderUpstream: String by project
val versionAccessWidener: String by project
val versionFabricApi: String by project
val versionMixin: String by project
Expand Down Expand Up @@ -91,33 +95,26 @@ val dummyFabricLoaderLangJar: Jar by tasks.creating(Jar::class) {
)
archiveClassifier.set("fabricloader")
}
// Generate JarJar metadata manually so that we control both the version and the file path
val createJarJarMetadata: Task by tasks.creating {
val jarPath = "META-INF/jarjar/" + dummyFabricLoaderLangJar.archiveFile.get().asFile.name
val output = project.layout.buildDirectory.dir("createJarJarMetadata").get().file("metadata.json")
inputs.property("jarPath", jarPath)
outputs.file(output)
extra["output"] = output
doFirst {
val metadata = Metadata(
listOf(
ContainedJarMetadata(
ContainedJarIdentifier("dev.su5ed.sinytra", "fabric-loader"),
ContainedVersion(VersionRange.createFromVersion("[$dummyFabricLoaderVersion,)"), DefaultArtifactVersion(dummyFabricLoaderVersion)),
jarPath,
false
)
)
)
Files.deleteIfExists(output.asFile.toPath())
Files.write(output.asFile.toPath(), MetadataIOHandler.toLines(metadata), StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE)
}
}
val modJar: Jar by tasks.creating(Jar::class) {
val modJar: JarJar by tasks.creating(JarJar::class) {
dependsOn(dummyFabricLoaderLangJar)
from(mod.output)
into("META-INF/jarjar/") {
from(createJarJarMetadata)
from(dummyFabricLoaderLangJar)
inputs.file(dummyFabricLoaderLangJar.archiveFile)
configurations = listOf(project.configurations.jarJar.get())
(includedDependencies as ConfigurableFileCollection).from(dummyFabricLoaderLangJar)
doLast {
FileSystems.newFileSystem(archiveFile.get().asFile.toPath()).use { fs ->
val jarPath = "META-INF/jarjar/" + dummyFabricLoaderLangJar.archiveFile.get().asFile.name
val metadataPath = fs.getPath("META-INF/jarjar/metadata.json")
val metadata = metadataPath.inputStream().use { ins -> MetadataIOHandler.fromStream(ins).orElseThrow() }
metadata.jars() += ContainedJarMetadata(
ContainedJarIdentifier("dev.su5ed.sinytra", "fabric-loader"),
ContainedVersion(VersionRange.createFromVersion("[$dummyFabricLoaderVersion,)"), DefaultArtifactVersion(dummyFabricLoaderVersion)),
jarPath,
false
)
Files.deleteIfExists(metadataPath)
Files.write(metadataPath, MetadataIOHandler.toLines(metadata), StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE)
}
}
manifest.attributes(
"Implementation-Version" to project.version,
Expand Down Expand Up @@ -153,6 +150,7 @@ val fullJar: Jar by tasks.creating(Jar::class) {
manifest {
from(tasks.jar.get().manifest)
attributes("Embedded-Dependencies-Mod" to "META-INF/jarjar/" + modJar.archiveFile.get().asFile.name)
attributes("Fabric-Loader-Version" to versionFabricLoaderUpstream)
}
}

Expand Down Expand Up @@ -274,8 +272,11 @@ dependencies {
shade(group = "io.github.steelwoolmc", name = "mixin-transmogrifier", version = versionMixinTransmog)
adapterData(group = "dev.su5ed.sinytra.adapter", name = "adapter", version = versionAdapter)

compileOnly(group = "net.fabricmc", name = "sponge-mixin", version = versionMixin)
annotationProcessor(group = "net.fabricmc", name = "sponge-mixin", version = versionMixin)
compileOnly(group = "net.fabricmc", name = "sponge-mixin", version = versionMixin)
implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.3.1")!!) {
jarJar.ranged(this, "[0.3.1,)")
}
compileOnly(group = "dev.su5ed.sinytra.fabric-api", name = "fabric-api", version = versionFabricApi)
runtimeOnly(fg.deobf("dev.su5ed.sinytra.fabric-api:fabric-api:$versionFabricApi"))

Expand Down
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=true

# Versions
versionConnector=1.0.0-beta.27
versionConnector=1.0.0-beta.28
versionAdapter=1.8.16-1.20.1-20231120.221506
versionAdapterDefinition=1.8.20
versionAdapterDefinition=1.8.21

versionMc=1.20.1
versionForge=47.1.3
versionForgeAutoRenamingTool=1.0.9
versionFabricLoader=2.5.2+0.14.21+1.20.1
versionFabricLoader=2.6.0+0.15.0+1.20.1
versionFabricLoaderUpstream=0.15.0
versionAccessWidener=2.1.0
versionFabricApi=0.90.7+1.9.33+1.20.1
versionMixin=0.12.5+mixin.0.8.5
versionMixinTransmog=0.4.1+1.20.1
versionMixinTransmog=0.4.2+1.20.1

# Publishing
curseForgeId=890127
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.mojang.logging.LogUtils;
import dev.su5ed.sinytra.connector.ConnectorUtil;
import dev.su5ed.sinytra.connector.locator.ConnectorConfig;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
import net.fabricmc.loader.impl.FabricLoaderImpl;
import net.fabricmc.loader.impl.entrypoint.EntrypointUtils;
import net.minecraftforge.fml.loading.EarlyLoadingException;
import net.minecraftforge.fml.loading.LoadingModList;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
Expand Down Expand Up @@ -128,7 +128,7 @@ public static void preLaunch() {
ProgressMeter progress = StartupNotificationManager.addProgressBar("[Connector] PreLaunch", 0);
try {
// Invoke prelaunch entrypoint
EntrypointUtils.invoke("preLaunch", PreLaunchEntrypoint.class, PreLaunchEntrypoint::onPreLaunch);
FabricLoader.getInstance().invokeEntrypoints("preLaunch", PreLaunchEntrypoint.class, PreLaunchEntrypoint::onPreLaunch);
} catch (Throwable t) {
LOGGER.error("Encountered an error in prelaunch entrypoint", t);
addGenericLoadingException(t, "Encountered an error in prelaunch entrypoint");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ private static ModCandidate createJavaMod() {
}

private static ModCandidate createFabricLoaderMod() {
ModMetadata metadata = new BuiltinModMetadata.Builder("fabricloader", Objects.requireNonNullElse(FabricLoader.class.getPackage().getImplementationVersion(), "0.0NONE"))
String version = EmbeddedDependencies.getFabricLoaderVersion();
ModMetadata metadata = new BuiltinModMetadata.Builder("fabricloader", Objects.requireNonNullElse(version, "0.0NONE"))
.setName("Fabric Loader")
.build();
GameProvider.BuiltinMod builtinMod = new GameProvider.BuiltinMod(Collections.singletonList(Path.of(uncheck(() -> FabricLoader.class.getProtectionDomain().getCodeSource().getLocation().toURI()))), metadata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public final class EmbeddedDependencies {
private static final Logger LOGGER = LogUtils.getLogger();
// Manifest attribute name prefix for embedded dependencies
private static final String JIJ_ATTRIBUTE_PREFIX = "Embedded-Dependencies-";
// Fabric Loader upstream version included by Connector
private static final String FABRIC_LOADER_VERSION = "Fabric-Loader-Version";
// Embedded mod jar name
private static final String MOD_JIJ_DEP = "Mod";

Expand Down Expand Up @@ -72,6 +74,10 @@ public static String getJarCacheVersion() {
return JAR_CACHE_VERSION.get();
}

public static String getFabricLoaderVersion() {
return ATTRIBUTES.getValue(FABRIC_LOADER_VERSION);
}

/**
* Get the root path inside an embedded jar.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

public class ConnectorLoaderService implements ITransformationService {
private static final String NAME = "connector_loader";
private static final String AUTHLIB_MODULE = "authlib";

@Override
public String name() {
Expand Down Expand Up @@ -55,10 +56,11 @@ public void onLoad(IEnvironment env, Set<String> otherServices) {
Map<String, ILaunchPluginService> plugins = (Map<String, ILaunchPluginService>) pluginsField.get(launchPluginHandler);
// Sort launch plugins
LinkedHashMap<String, ILaunchPluginService> sortedPlugins = new LinkedHashMap<>();
// Runtime Enum extender will fail if a mixin makes $VALUES mutable first, so it must come before us as well
sortedPlugins.put("runtime_enum_extender", plugins.remove("runtime_enum_extender"));
// Mixin must come after
// Mixin must come first
sortedPlugins.put("mixin", plugins.remove("mixin"));
// Handle cases where a mixin has already made the enum mutable
plugins.remove("runtime_enum_extender");
sortedPlugins.put("runtime_enum_extender", new LenientRuntimeEnumExtender());
// Our plugins come after mixin
injectPlugins.forEach(plugin -> sortedPlugins.put(plugin.name(), plugin));
// The rest goes to the end
Expand All @@ -72,7 +74,10 @@ public void onLoad(IEnvironment env, Set<String> otherServices) {
@Override
public List<Resource> completeScan(IModuleLayerManager layerManager) {
LoadingModList.get().getErrors().addAll(ConnectorEarlyLoader.getLoadingExceptions());
return List.of(new Resource(IModuleLayerManager.Layer.GAME, List.of(new FabricASMFixer.FabricASMGeneratedClassesSecureJar())));
return List.of(new Resource(IModuleLayerManager.Layer.GAME, List.of(
new FabricASMFixer.FabricASMGeneratedClassesSecureJar(),
ModuleLayerMigrator.moveModule(AUTHLIB_MODULE)
)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package dev.su5ed.sinytra.connector.service;

import net.minecraftforge.fml.common.asm.RuntimeEnumExtender;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;

import java.util.List;

public class LenientRuntimeEnumExtender extends RuntimeEnumExtender {
@Override
public int processClassWithFlags(Phase phase, ClassNode classNode, Type classType, String reason) {
if ((classNode.access & Opcodes.ACC_ENUM) == 0)
return ComputeFlags.NO_REWRITE;
// Modified query flags that do not include ACC_FINAL
int flags = Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC;
Type array = Type.getType("[" + classType.getDescriptor());
List<FieldNode> values = classNode.fields.stream().filter(f -> f.desc.contentEquals(array.getDescriptor()) && (f.access & flags) == flags)
.toList();
if (values.size() == 1) {
FieldNode node = values.get(0);
if ((node.access & Opcodes.ACC_FINAL) == 0) {
// It is likely a mixin already made the field mutable
// Make it final before it is processed and de-finalized again by super
node.access |= Opcodes.ACC_FINAL;
return super.processClassWithFlags(phase, classNode, classType, reason);
}
}
// Let super deal with this
return super.processClassWithFlags(phase, classNode, classType, reason);
}
}
Loading

0 comments on commit bceb367

Please sign in to comment.