Repository navigation
feature: Start integrating Fugue to Cleanroom #753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CaliforniaDemise
wants to merge
6
commits into
develop/0.8
Choose a base branch
from
feature/mod_patches
base: develop/0.8
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b79c22a
feature: Start integrating Fugue to Cleanroom
CaliforniaDemise efd18ec
feature: Add transformer patches
CaliforniaDemise 65f5342
fix: Remove redundant mod transformers
CaliforniaDemise 1d5bb2e
feature: Add config options, missing mixins and remove redundant patches
CaliforniaDemise 722e8d8
fix: Fix wrong mod page urls
CaliforniaDemise 9593372
fix: Remove even more redundant patches (Howling Moon & Colytra)
CaliforniaDemise File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,41 @@ | ||
| // Applied below dependencies block in build.gradle | ||
|
|
||
| repositories { | ||
| exclusiveContent { | ||
| forRepository { | ||
| maven { | ||
| name 'CleanroomMC CurseMaven' | ||
| url 'https://curse.cleanroommc.com' | ||
| } | ||
| } | ||
| filter { | ||
| includeGroup 'curse.maven' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| compileOnly 'curse.maven:armourers-workshop-229523:3101995' | ||
| compileOnly 'curse.maven:better-records-222722:2930159' | ||
| compileOnly 'curse.maven:carry-on-274259:4507139' | ||
| compileOnly 'curse.maven:charset-284523:3656492' | ||
| compileOnly 'curse.maven:codechicken-lib-242818:2779848' | ||
| compileOnly 'curse.maven:creativecore-257814:4722163' | ||
| compileOnly 'curse.maven:custom-main-menu-226406:2857869' | ||
| compileOnly 'curse.maven:custom-npcs-221826:2996912' | ||
| compileOnly 'curse.maven:dark-theme-323440:3146120' | ||
| compileOnly 'curse.maven:requiem-265729:2942107' | ||
| compileOnly 'curse.maven:ender-utilities-224320:2977010' | ||
| compileOnly 'curse.maven:howling-moon-236149:2567452' | ||
| compileOnly 'curse.maven:little-tiles-257818:5180387' | ||
| compileOnly 'curse.maven:lockdown-244019:2477270' | ||
| compileOnly 'curse.maven:mcjty-lib-233105:2745846' | ||
| compileOnly 'curse.maven:cb-multipart-258426:2755790' | ||
| compileOnly 'curse.maven:project-red-core-228702:2745545' | ||
| compileOnly 'curse.maven:recurrent-complex-223150:8562927' | ||
| compileOnly 'curse.maven:refined-storage-243076:2940914' | ||
| compileOnly 'curse.maven:water-power-224579:2464789' | ||
| compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:2.3.10' | ||
| compileOnly 'curse.maven:xaero-plus-866084:9067807' | ||
| compileOnly 'curse.maven:mpm-221939:2837187' | ||
| } | ||
This file contains hidden or 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
36 changes: 36 additions & 0 deletions
36
module/cleanroom/src/main/java/com/cleanroommc/cleanroom/modpatch/ModPatchMixinPlugin.java
This file contains hidden or 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,36 @@ | ||
| /* | ||
| * Copyright (c) 2026 CleanroomMC contributors | ||
| * | ||
| * This file is licensed under the CleanroomMC License Version 1.0. | ||
| * See the applicable LICENSE file in this directory or a parent directory | ||
| * for the full licence terms. | ||
| * | ||
| * This is visible-source software and is not open-source software. | ||
| */ | ||
|
|
||
| package com.cleanroommc.cleanroom.modpatch; | ||
|
|
||
| import com.cleanroommc.cleanroom.compatibility.CompatibilityConfig; | ||
|
|
||
| import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; | ||
|
|
||
| public final class ModPatchMixinPlugin implements IMixinConfigPlugin { | ||
|
|
||
| @Override | ||
| public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { | ||
| return switch (mixinClassName.split("\\.")[5]) { | ||
| case "betterrecords" -> CompatibilityConfig.mods.betterRecords; | ||
| case "codechickenlib" -> CompatibilityConfig.mods.codeChickenLib; | ||
| case "creativecore" -> CompatibilityConfig.mods.creativeCore; | ||
| case "custommainmenu" -> CompatibilityConfig.mods.customMainMenu; | ||
| case "lockdown" -> CompatibilityConfig.mods.lockdown; | ||
| case "mcjtylib" -> CompatibilityConfig.mods.mcjtyLib; | ||
| case "projectred_core" -> CompatibilityConfig.mods.projectRedCore; | ||
| case "waterpower" -> CompatibilityConfig.mods.waterPower; | ||
| case "xaeroplus" -> CompatibilityConfig.mods.xaeroPlus; | ||
| default -> | ||
| throw new UnsupportedOperationException("Mod " + mixinClassName.split("\\.")[5] + " is not supported"); | ||
| }; | ||
| } | ||
|
|
||
| } |
53 changes: 53 additions & 0 deletions
53
module/cleanroom/src/main/java/com/cleanroommc/cleanroom/modpatch/ModPatchTransformer.java
This file contains hidden or 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,53 @@ | ||
| /* | ||
| * Copyright (c) 2026 CleanroomMC contributors | ||
| * | ||
| * This file is licensed under the CleanroomMC License Version 1.0. | ||
| * See the applicable LICENSE file in this directory or a parent directory | ||
| * for the full licence terms. | ||
| * | ||
| * This is visible-source software and is not open-source software. | ||
| */ | ||
|
|
||
| package com.cleanroommc.cleanroom.modpatch; | ||
|
|
||
| import com.cleanroommc.cleanroom.modpatch.transformer.ModTransformers; | ||
| import com.cleanroommc.discovery.CleanroomModDiscoverer; | ||
| import top.outlands.foundation.boot.ActualClassLoader; | ||
| import top.outlands.foundation.boot.TransformerHolder; | ||
| import top.outlands.foundation.function.ExplicitTransformerFunction; | ||
|
|
||
| import org.spongepowered.asm.mixin.Mixins; | ||
| import org.spongepowered.asm.mixin.edit.MixinEdits; | ||
|
|
||
| import net.minecraftforge.fml.relauncher.FMLLaunchHandler; | ||
|
|
||
| public final class ModPatchTransformer { | ||
|
|
||
| private ModPatchTransformer() { } | ||
|
|
||
| public static byte[] transform(String name, byte[] bytes) { | ||
| if (bytes == null || name.startsWith("com.cleanroommc.cleanroom.")) { | ||
| return bytes; | ||
| } | ||
| if (isJava9OrHigher(bytes)) { | ||
| return bytes; | ||
| } | ||
| bytes = ModTransformers.transform(name, bytes); | ||
| return bytes; | ||
| } | ||
|
|
||
| public static void install() { | ||
| if (FMLLaunchHandler.side().isClient()) { | ||
| MixinEdits.of("org.embeddedt.vintagefix.mixin.bugfix.tab_complete_ddos.ChatTabCompleterMixin").cancel(); | ||
| } | ||
| TransformerHolder holder = ActualClassLoader.getTransformerHolder(); | ||
| ExplicitTransformerFunction previous = holder.runExplicitTransformersFunction; | ||
| holder.runExplicitTransformersFunction = (name, bytes) -> transform(name, previous.apply(name, bytes)); | ||
| Mixins.addConfiguration("mixin.cleanroom.modpatch.json"); | ||
| } | ||
|
|
||
| private static boolean isJava9OrHigher(byte[] bytes) { | ||
| return (short) (((bytes[6] & 0xFF) << 8) | (bytes[7] & 0xFF)) > 52; | ||
| } | ||
|
|
||
| } |
95 changes: 95 additions & 0 deletions
95
...c/main/java/com/cleanroommc/cleanroom/modpatch/mixin/betterrecords/SoundManagerMixin.java
This file contains hidden or 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,95 @@ | ||
| /* | ||
| * Copyright (c) 2026 CleanroomMC contributors | ||
| * | ||
| * This file is licensed under the CleanroomMC License Version 1.0. | ||
| * See the applicable LICENSE file in this directory or a parent directory | ||
| * for the full licence terms. | ||
| * | ||
| * This is visible-source software and is not open-source software. | ||
| */ | ||
|
|
||
| package com.cleanroommc.cleanroom.modpatch.mixin.betterrecords; | ||
|
|
||
| import tech.feldman.betterrecords.api.sound.Sound; | ||
| import tech.feldman.betterrecords.client.sound.SoundManager; | ||
| import tech.feldman.betterrecords.client.sound.SoundPlayer; | ||
|
|
||
| import com.llamalad7.mixinextras.sugar.Local; | ||
| import com.llamalad7.mixinextras.sugar.ref.LocalRef; | ||
| import org.spongepowered.asm.mixin.Mixin; | ||
| import org.spongepowered.asm.mixin.Unique; | ||
| import org.spongepowered.asm.mixin.injection.At; | ||
| import org.spongepowered.asm.mixin.injection.Inject; | ||
| import org.spongepowered.asm.mixin.injection.Redirect; | ||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
|
||
| import net.minecraft.util.math.BlockPos; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
|
|
||
| @Mixin(value = SoundManager.class, remap = false) | ||
| public class SoundManagerMixin { | ||
|
|
||
| @Unique private static final Map<Thread, AtomicBoolean> threads = new ConcurrentHashMap<>(); | ||
|
|
||
| @Redirect(method = "stopQueueAt", at = @At(value = "INVOKE", target = "Ljava/lang/Thread;stop()V")) | ||
| private void stopQueueAt(Thread thread) { | ||
| Optional.ofNullable(threads.get(thread)).ifPresent(t -> t.set(false)); | ||
| thread.interrupt(); | ||
| threads.remove(thread); | ||
| } | ||
|
|
||
| @Inject( | ||
| method = "queueSongsAt", | ||
| at = @At( | ||
| value = "INVOKE", target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;" | ||
| ) | ||
| ) | ||
| private void hackThread( | ||
| BlockPos pos, int dimension, List<Sound> sounds, boolean shuffle, boolean repeat, CallbackInfo ci, | ||
| @Local LocalRef<Thread> job) { | ||
| AtomicBoolean interrupted = new AtomicBoolean(false); | ||
| Thread thread = new SoundThread(interrupted, sounds, pos, dimension, repeat); | ||
| job.set(thread); | ||
| threads.put(thread, interrupted); | ||
| } | ||
|
|
||
| public static class SoundThread extends Thread { | ||
|
|
||
| private final AtomicBoolean interrupted; | ||
| private final List<Sound> sounds; | ||
| private final BlockPos pos; | ||
| private final int dim; | ||
| private final boolean repeat; | ||
|
|
||
| public SoundThread(AtomicBoolean interrupted, List<Sound> sounds, BlockPos pos, int dim, boolean repeat) { | ||
| super("Better Records Sound Thread"); | ||
| this.interrupted = interrupted; | ||
| this.sounds = sounds; | ||
| this.pos = pos; | ||
| this.dim = dim; | ||
| this.repeat = repeat; | ||
| } | ||
|
|
||
| @Override | ||
| public void interrupt() { | ||
| interrupted.set(true); | ||
| } | ||
|
|
||
| @Override | ||
| public void run() { | ||
| while (!interrupted.get()) { | ||
| sounds.forEach(sound -> SoundPlayer.INSTANCE.playSound(pos, dim, sound)); | ||
| if (!repeat) { | ||
| return; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } |
40 changes: 40 additions & 0 deletions
40
.../java/com/cleanroommc/cleanroom/modpatch/mixin/codechickenlib/ReflectionManagerMixin.java
This file contains hidden or 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,40 @@ | ||
| /* | ||
| * Copyright (c) 2026 CleanroomMC contributors | ||
| * | ||
| * This file is licensed under the CleanroomMC License Version 1.0. | ||
| * See the applicable LICENSE file in this directory or a parent directory | ||
| * for the full licence terms. | ||
| * | ||
| * This is visible-source software and is not open-source software. | ||
| */ | ||
|
|
||
| package com.cleanroommc.cleanroom.modpatch.mixin.codechickenlib; | ||
|
|
||
| import codechicken.lib.reflect.ObfMapping; | ||
| import codechicken.lib.reflect.ReflectionManager; | ||
|
|
||
| import org.spongepowered.asm.mixin.Mixin; | ||
| import org.spongepowered.asm.mixin.injection.At; | ||
| import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
|
||
| import java.lang.reflect.Field; | ||
|
|
||
| @Mixin(value = ReflectionManager.class, remap = false) | ||
| public class ReflectionManagerMixin { | ||
|
|
||
| @Redirect( | ||
| method = "removeFinal", | ||
| at = @At( | ||
| value = "INVOKE", | ||
| target = "Lcodechicken/lib/reflect/ReflectionManager;getField(Lcodechicken/lib/reflect/ObfMapping;)Ljava/lang/reflect/Field;" | ||
| ) | ||
| ) | ||
| private static Field getField(ObfMapping e) { | ||
| try { | ||
| return Field.class.getDeclaredField("modifiers"); | ||
| } catch (NoSuchFieldException nsfe) { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| } |
40 changes: 40 additions & 0 deletions
40
...n/java/com/cleanroommc/cleanroom/modpatch/mixin/creativecore/ConfigEventHandlerMixin.java
This file contains hidden or 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,40 @@ | ||
| /* | ||
| * Copyright (c) 2026 CleanroomMC contributors | ||
| * | ||
| * This file is licensed under the CleanroomMC License Version 1.0. | ||
| * See the applicable LICENSE file in this directory or a parent directory | ||
| * for the full licence terms. | ||
| * | ||
| * This is visible-source software and is not open-source software. | ||
| */ | ||
|
|
||
| package com.cleanroommc.cleanroom.modpatch.mixin.creativecore; | ||
|
|
||
| import com.creativemd.creativecore.common.config.event.ConfigEventHandler; | ||
|
|
||
| import org.spongepowered.asm.mixin.Mixin; | ||
| import org.spongepowered.asm.mixin.injection.At; | ||
| import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
|
||
| import java.io.File; | ||
| import java.io.FileWriter; | ||
| import java.io.IOException; | ||
| import java.nio.charset.StandardCharsets; | ||
|
|
||
| @Mixin(value = ConfigEventHandler.class, remap = false) | ||
| public class ConfigEventHandlerMixin { | ||
|
|
||
| @Redirect(method = "saveClientFields", at = @At(value = "NEW", target = "(Ljava/io/File;)Ljava/io/FileWriter;")) | ||
| private static FileWriter fixCharset(File file) throws IOException { | ||
| return new FileWriter(file, StandardCharsets.UTF_8); | ||
| } | ||
|
|
||
| @Redirect( | ||
| method = "save(Ljava/lang/String;Lnet/minecraftforge/fml/relauncher/Side;)V", | ||
| at = @At(value = "NEW", target = "(Ljava/io/File;)Ljava/io/FileWriter;") | ||
| ) | ||
| private static FileWriter fixCharset2(File file) throws IOException { | ||
| return new FileWriter(file, StandardCharsets.UTF_8); | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to
src/module/modpatches/build.gradle?