Skip to content

Commit

Permalink
Patch unilib
Browse files Browse the repository at this point in the history
  • Loading branch information
kappa-maintainer committed Dec 9, 2024
1 parent 5ad4706 commit aa8f3f6
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ If you are still using 0.1.0 Cleanroom, use 0.5.4. But that's not recommended.
* Thaumic Fixes
* Erebus Fix
* Uncrafting Blacklist
* Unilib

## Note
Add + to start of the file if it's not there.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ dependencies {
//Calculator
compileOnly(fg.deobf("curse.maven:calculator-225104:2847174"))

compileOnly(fg.deobf("curse.maven:unilib-1056812:5946214"))

implementation("com.cleanroommc:groovyscript:1.1.1") {
transitive = false
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mappings_version=39-1.12
mod_id=fugue
mod_name=Fugue
mod_main_class=Fugue
mod_version=0.17.2
mod_version=0.17.3
mod_base_package=com.cleanroommc.fugue
mod_authors=kappa_maintainer
mod_description=A mod that patch dead mods for Cleanroom
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
case "litematica" -> Loader.isModLoaded("litematica") && FugueConfig.modPatchConfig.enableLitematica;
case "betterrecords" -> Loader.isModLoaded("betterrecords") && FugueConfig.modPatchConfig.enableBetterRecords;
case "refinedrelocation" -> Loader.isModLoaded("refinedrelocation") && FugueConfig.modPatchConfig.enableRefinedRelocation2Patch;
case "unilib" -> Loader.isModLoaded("unilib") && FugueConfig.modPatchConfig.enableUnilib;
default -> true;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,7 @@ public class ModPatchConfig {
public boolean enableUncraftingBlacklist = true;
@Config.Name("Enable Calculator Patch")
public boolean enableCalculator = true;
@Config.Comment("This patches the CraftPresence spam log")
@Config.Name("Enable Unilib Patch")
public boolean enableUnilib = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.cleanroommc.fugue.mixin.unilib;

import com.cleanroommc.fugue.common.Fugue;
import io.github.cdagaming.unicore.utils.FileUtils;
import net.minecraft.launchwrapper.Launch;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Arrays;

@Mixin(value = FileUtils.class, remap = false)
public class FileUtilsMixin {
@Inject(method = "getValidClass(Ljava/lang/ClassLoader;ZZ[Ljava/lang/String;)Ljava/lang/Class;", at = @At("HEAD"), cancellable = true)
private static void getValidClass(ClassLoader loader, boolean init, boolean forceCache, String[] paths, CallbackInfoReturnable<Class<?>> cir) {
//Arrays.stream(paths).forEach(Fugue.LOGGER::info);
try {
Class<?> clazz = Launch.classLoader.findClass(paths[0]);
cir.setReturnValue(clazz);
} catch (ClassNotFoundException ignored) {}
}
}
1 change: 1 addition & 0 deletions src/main/resources/fugue.mixin.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"solarflux.INetworkSFMixin",
"solarflux.SolarFluxMixin",
"subaquatic.IBubbleColumnMixin",
"unilib.FileUtilsMixin",
"waterpower.ClassEngineMixin",
"xaeroplus.ChunkHighlightSavingCacheMixin",
"xaeroplus.XaeroPlusSettingsReflectionHaxMixin"
Expand Down

0 comments on commit aa8f3f6

Please sign in to comment.