From ed7af627b00adcb918b18d400f42918e741f40b1 Mon Sep 17 00:00:00 2001 From: Cat Core <34719527+arthurbambou@users.noreply.github.com> Date: Mon, 21 Aug 2023 15:40:14 +0200 Subject: [PATCH] Remove NEI Compat in this version --- .../compat/BetterClassWriter.java | 8 --- .../compat/mixin/nei/NEITransformerMixin.java | 52 ------------------- 2 files changed, 60 deletions(-) delete mode 100644 mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/NEITransformerMixin.java diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/BetterClassWriter.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/BetterClassWriter.java index 2af51b92..5ebe1780 100644 --- a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/BetterClassWriter.java +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/BetterClassWriter.java @@ -18,14 +18,6 @@ protected String getCommonSuperClass(String type1, String type2) { try { return super.getCommonSuperClass(type1, type2); } catch (TypeNotPresentException e) { - if ("net/minecraft/class_1071".equals(type1) && "net/minecraft/class_987".equals(type2)) { - return "java/lang/Object"; - } - - if ("net/minecraft/class_987".equals(type1) && "java/lang/Object".equals(type2)) { - return type2; - } - System.out.println("Common of: " + type1 + " " + type2); e.printStackTrace(); return "java/lang/Object"; diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/NEITransformerMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/NEITransformerMixin.java deleted file mode 100644 index 8e3fbb8f..00000000 --- a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/NEITransformerMixin.java +++ /dev/null @@ -1,52 +0,0 @@ -package fr.catcore.fabricatedforge.compat.mixin.nei; - -import codechicken.core.asm.ClassHeirachyManager; -import codechicken.core.asm.InstructionComparator; -import codechicken.core.asm.ObfuscationManager; -import codechicken.nei.asm.NEITransformer; -import fr.catcore.fabricatedforge.compat.CompatUtils; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.InsnList; -import org.objectweb.asm.tree.MethodNode; -import org.objectweb.asm.tree.VarInsnNode; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; - -@Mixin(NEITransformer.class) -public class NEITransformerMixin { - /** - * @author CatCore - * @reason fix classwriter - */ - @Overwrite(remap = false) - public byte[] transformer001(String name, byte[] bytes) { - ObfuscationManager.ClassMapping classmap = new ObfuscationManager.ClassMapping("aqh"); - - if (ClassHeirachyManager.classExtends(name, classmap.classname, bytes)) { - ClassNode node = CompatUtils.createNode(bytes, 0); - - ObfuscationManager.MethodMapping methodmap = new ObfuscationManager.MethodMapping("apn", "c", "()V"); - ObfuscationManager.MethodMapping supermap = new ObfuscationManager.MethodMapping(node.superName, methodmap); - InsnList supercall = new InsnList(); - supercall.add(new VarInsnNode(25, 0)); - supercall.add(supermap.toInsn(183)); - - for(MethodNode methodnode : node.methods) { - if (methodmap.matches(methodnode)) { - InsnList importantNodeList = InstructionComparator.getImportantList(methodnode.instructions); - - if (!InstructionComparator.insnListMatches(importantNodeList, supercall, 0)) { - methodnode.instructions.insertBefore(methodnode.instructions.getFirst(), supercall); - System.out.println("Inserted super call into " + name + "." + supermap.name); - } - } - } - - bytes = CompatUtils.writeClass(node, 3); - } - - return bytes; - } -}