Skip to content

Commit

Permalink
Make colytra patch robust
Browse files Browse the repository at this point in the history
  • Loading branch information
kappa-maintainer committed Aug 18, 2024
1 parent 64783fc commit f9346c2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/main/java/com/cleanroommc/fugue/common/Fugue.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.cleanroommc.fugue.common;

import com.cleanroommc.fugue.Reference;
import com.cleanroommc.fugue.handler.PlayerJoinHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.Instance;
Expand Down Expand Up @@ -31,7 +33,9 @@ public static boolean isModNewerThan(String modid, String version) {

@Instance(Reference.MOD_ID)
public static Fugue _instance;
public Fugue() {}
public Fugue() {

}

@NetworkCheckHandler
public boolean checker(Map<String, String> mods, Side side) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ public class ModPatchConfig {
@Config.Name("Enable 5zig Patch")
public boolean enable5zig = true;
@Config.Name("Enable Ears Patch")
@Config.Comment("This mod is packing a copy of ASM itself")
@Config.Comment("This mod is packing a copy of ASM itself, wtf")
public boolean enableEars = true;
@Config.Name("Enable Colytra Patch")
@Config.Comment("Do NOT enable this if you don't have Colytra installed")
public boolean enableColytra = false;
public boolean enableColytra = true;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cleanroommc.fugue.transformer;

import net.minecraft.launchwrapper.Launch;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
Expand All @@ -9,6 +10,7 @@
public class EntityLivingBaseTransformer implements IExplicitTransformer {
@Override
public byte[] transform(byte[] bytes) {
if (!Launch.classLoader.isClassLoaded("c4.colytra.asm.ColytraLoadingPlugin")) return bytes;
ClassNode classNode = new ClassNode();
ClassReader classReader = new ClassReader(bytes);
classReader.accept(classNode, 0);
Expand Down
Empty file.
Empty file.

0 comments on commit f9346c2

Please sign in to comment.