-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f65665
commit efe2c67
Showing
6 changed files
with
94 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
loader/src/main/java/net/neoforged/fml/loading/MixinSyntheticPackageProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.fml.loading; | ||
|
||
import cpw.mods.jarhandling.VirtualJar; | ||
import cpw.mods.modlauncher.api.IEnvironment; | ||
import cpw.mods.modlauncher.api.IModuleLayerManager; | ||
import cpw.mods.modlauncher.api.ITransformationService; | ||
import cpw.mods.modlauncher.api.ITransformer; | ||
import cpw.mods.modlauncher.api.IncompatibleEnvironmentException; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.util.Constants; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class MixinSyntheticPackageProvider implements ITransformationService { | ||
@Override | ||
public @NotNull String name() { | ||
return "mixin-synthetic-package"; | ||
} | ||
|
||
@Override | ||
public void initialize(IEnvironment environment) { | ||
|
||
} | ||
|
||
@Override | ||
public void onLoad(IEnvironment env, Set<String> otherServices) throws IncompatibleEnvironmentException { | ||
|
||
} | ||
|
||
@Override | ||
public List<Resource> beginScanning(IEnvironment environment) { | ||
try { | ||
return List.of( | ||
new Resource(IModuleLayerManager.Layer.GAME, List.of( | ||
new VirtualJar("mixinsynthetic", Path.of(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()), | ||
Constants.SYNTHETIC_PACKAGE, Constants.SYNTHETIC_PACKAGE + ".args") | ||
)) | ||
); | ||
} catch (Exception exception) { | ||
throw new RuntimeException("Failed to intialise synthetic Mixin virtual jar", exception); | ||
} | ||
} | ||
|
||
@Override | ||
public @NotNull List<ITransformer> transformers() { | ||
return List.of(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
loader/src/main/resources/META-INF/services/cpw.mods.modlauncher.api.ITransformationService
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
net.neoforged.fml.loading.FMLServiceProvider | ||
net.neoforged.fml.loading.FMLServiceProvider | ||
net.neoforged.fml.loading.MixinSyntheticPackageProvider |