mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 04:04:25 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8521f934f6 | ||
|
|
1695f87e50 |
No files matched your search
+1
-3
@@ -120,9 +120,7 @@ public final class TransformationPlan {
|
||||
}
|
||||
|
||||
ClassNode classNode = new ClassNode();
|
||||
// Expanded frames are required to derive the stack map frames of inserted branch targets
|
||||
// without loading any class (see FrameCapture). The writer compresses them again.
|
||||
new ClassReader(classBytecode).accept(classNode, ClassReader.EXPAND_FRAMES);
|
||||
new ClassReader(classBytecode).accept(classNode, 0);
|
||||
return this.transform(internalClassName, classNode, classBytecode, rules);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public final class TransformerBootstrapSupport {
|
||||
}
|
||||
|
||||
public static byte[] toByteArray(ClassNode classNode) {
|
||||
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
|
||||
classNode.accept(classWriter);
|
||||
return classWriter.toByteArray();
|
||||
}
|
||||
|
||||
-97
@@ -1,97 +0,0 @@
|
||||
package customskinloader.bootstrap.transformer.patch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.commons.AnalyzerAdapter;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.FrameNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
/**
|
||||
* Computes the operand stack / local variable state around a given instruction without loading any
|
||||
* class. Only usable when the method already carries expanded (F_NEW) stack map frames, which is
|
||||
* the case for the byte array based transformation paths. Platforms that recompute frames (e.g.
|
||||
* ModLauncher) hand over compressed frames; callers must then fall back to letting the platform
|
||||
* compute the frames.
|
||||
*/
|
||||
final class FrameCapture {
|
||||
final Object[] localsBefore;
|
||||
final Object[] stackBefore;
|
||||
final Object[] localsAfter;
|
||||
final Object[] stackAfter;
|
||||
|
||||
private FrameCapture(Object[] localsBefore, Object[] stackBefore, Object[] localsAfter, Object[] stackAfter) {
|
||||
this.localsBefore = localsBefore;
|
||||
this.stackBefore = stackBefore;
|
||||
this.localsAfter = localsAfter;
|
||||
this.stackAfter = stackAfter;
|
||||
}
|
||||
|
||||
static FrameCapture capture(String owner, MethodNode methodNode, AbstractInsnNode target) {
|
||||
if (!hasExpandedFrames(methodNode)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AnalyzerAdapter analyzer = new AnalyzerAdapter(owner, methodNode.access, methodNode.name, methodNode.desc, null);
|
||||
for (AbstractInsnNode instruction = methodNode.instructions.getFirst(); instruction != null; instruction = instruction.getNext()) {
|
||||
if (instruction == target) {
|
||||
Object[] localsBefore = toFrameTypes(analyzer.locals);
|
||||
Object[] stackBefore = toFrameTypes(analyzer.stack);
|
||||
if (localsBefore == null || stackBefore == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
instruction.accept(analyzer);
|
||||
|
||||
Object[] localsAfter = toFrameTypes(analyzer.locals);
|
||||
Object[] stackAfter = toFrameTypes(analyzer.stack);
|
||||
if (localsAfter == null || stackAfter == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new FrameCapture(localsBefore, stackBefore, localsAfter, stackAfter);
|
||||
}
|
||||
|
||||
instruction.accept(analyzer);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean hasExpandedFrames(MethodNode methodNode) {
|
||||
for (AbstractInsnNode instruction : methodNode.instructions) {
|
||||
if (instruction instanceof FrameNode && ((FrameNode) instruction).type != Opcodes.F_NEW) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the slot based lists maintained by {@link AnalyzerAdapter} into the expanded frame
|
||||
* format expected by {@link FrameNode}. Long and double values occupy two slots but only one
|
||||
* frame entry, so the implicit {@code TOP} following them must be dropped.
|
||||
*/
|
||||
private static Object[] toFrameTypes(List<Object> slots) {
|
||||
if (slots == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Object> types = new ArrayList<>(slots.size());
|
||||
for (int index = 0; index < slots.size(); index++) {
|
||||
Object slot = slots.get(index);
|
||||
if (!(slot instanceof String) && !(slot instanceof Integer)) {
|
||||
// Uninitialized types are represented by analyzer owned labels that cannot be mapped
|
||||
// back to labels of the method being transformed.
|
||||
return null;
|
||||
}
|
||||
|
||||
types.add(slot);
|
||||
if (slot instanceof Integer && (slot.equals(Opcodes.LONG) || slot.equals(Opcodes.DOUBLE))) {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
return types.toArray();
|
||||
}
|
||||
}
|
||||
+7
-24
@@ -4,8 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import customskinloader.bootstrap.BootstrapLogger;
|
||||
import customskinloader.bootstrap.transformer.ClassTransformationContext;
|
||||
import customskinloader.bootstrap.transformer.TransformationRule;
|
||||
import customskinloader.bootstrap.transformer.TransformationRuleProvider;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -209,13 +207,12 @@ abstract class PatchSupport implements TransformationRuleProvider, Opcodes {
|
||||
return current;
|
||||
}
|
||||
|
||||
protected void replaceInstructionSafely(ClassTransformationContext context, MethodNode methodNode, AbstractInsnNode original, AbstractInsnNode replacement) {
|
||||
this.replaceInstructionSafely(context, methodNode, new InsnNode(ICONST_1), IFNE, original, replacement);
|
||||
protected void replaceInstructionSafely(MethodNode methodNode, AbstractInsnNode original, AbstractInsnNode replacement) {
|
||||
this.replaceInstructionSafely(methodNode, new InsnNode(ICONST_1), IFNE, original, replacement);
|
||||
}
|
||||
|
||||
protected void replaceInstructionSafely(ClassTransformationContext context, MethodNode methodNode, AbstractInsnNode condition, int jumpOpcode, AbstractInsnNode original, AbstractInsnNode replacement) {
|
||||
LabelNode label0 = new LabelNode();
|
||||
LabelNode label1 = new LabelNode();
|
||||
protected void replaceInstructionSafely(MethodNode methodNode, AbstractInsnNode condition, int jumpOpcode, AbstractInsnNode original, AbstractInsnNode replacement) {
|
||||
LabelNode label0 = new LabelNode(), label1 = new LabelNode();
|
||||
|
||||
InsnList before = new InsnList();
|
||||
before.add(condition);
|
||||
@@ -223,29 +220,15 @@ abstract class PatchSupport implements TransformationRuleProvider, Opcodes {
|
||||
before.add(new LdcInsnNode("Modified by CustomSkinLoader."));
|
||||
before.add(new InsnNode(POP));
|
||||
|
||||
methodNode.instructions.insertBefore(original, before);
|
||||
|
||||
// The original instruction is kept as dead code so later Mixin / coremod transformations
|
||||
// can still locate it. Both branch targets therefore need a real stack map frame: the
|
||||
// replacement starts with the state the original instruction would have seen, and the
|
||||
// merge point continues with the state the original instruction would have produced.
|
||||
FrameCapture frames = FrameCapture.capture(context.getInternalClassName(), methodNode, original);
|
||||
if (frames == null) {
|
||||
BootstrapLogger.LOGGER.debug("Could not derive stack map frames for " + methodNode.name + methodNode.desc + "; the inserted branch targets carry no frame");
|
||||
}
|
||||
|
||||
InsnList after = new InsnList();
|
||||
after.add(new JumpInsnNode(GOTO, label1));
|
||||
after.add(label0);
|
||||
if (frames != null) {
|
||||
after.add(new FrameNode(F_NEW, frames.localsBefore.length, frames.localsBefore, frames.stackBefore.length, frames.stackBefore));
|
||||
}
|
||||
after.add(new FrameNode(F_SAME, 0, null, 0, null));
|
||||
after.add(replacement);
|
||||
after.add(label1);
|
||||
if (frames != null) {
|
||||
after.add(new FrameNode(F_NEW, frames.localsAfter.length, frames.localsAfter, frames.stackAfter.length, frames.stackAfter));
|
||||
}
|
||||
after.add(new FrameNode(F_SAME, 0, null, 0, null));
|
||||
|
||||
methodNode.instructions.insertBefore(original, before);
|
||||
methodNode.instructions.insert(original, after);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -88,7 +88,7 @@ public final class RenderPatch extends PatchSupport {
|
||||
|
||||
MethodInsnNode methodInsnNode = (MethodInsnNode) instruction;
|
||||
if (remappedOwner.equals(methodInsnNode.owner) && remappedName.equals(methodInsnNode.name) && "()Z".equals(methodInsnNode.desc)) {
|
||||
this.replaceInstructionSafely(context, methodNode, instruction, new MethodInsnNode(INVOKESTATIC, OBJECTS, "nonNull", "(" + objectDesc(OBJECT) + ")Z"));
|
||||
this.replaceInstructionSafely(methodNode, instruction, new MethodInsnNode(INVOKESTATIC, OBJECTS, "nonNull", "(" + objectDesc(OBJECT) + ")Z"));
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public final class RenderPatch extends PatchSupport {
|
||||
|
||||
MethodInsnNode methodInsnNode = (MethodInsnNode) instruction;
|
||||
if (remappedOwner.equals(methodInsnNode.owner) && originalName.equals(methodInsnNode.name) && remappedDesc.equals(methodInsnNode.desc)) {
|
||||
this.replaceInstructionSafely(context, methodNode, instruction, new MethodInsnNode(INVOKESTATIC, remappedOwner, replacementName, remappedDesc, false));
|
||||
this.replaceInstructionSafely(methodNode, instruction, new MethodInsnNode(INVOKESTATIC, remappedOwner, replacementName, remappedDesc, false));
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
+16
-24
@@ -7,7 +7,6 @@ import org.objectweb.asm.Handle;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.FrameNode;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.InvokeDynamicInsnNode;
|
||||
@@ -68,17 +67,17 @@ public final class SkinManagerPatch extends PatchSupport {
|
||||
// 19w37a- (1.14.4-)
|
||||
this.rule("skin-manager.register-skins.v1", SKIN_MANAGER, "[,553]", context ->
|
||||
this.replaceExecutorProfileLoadAtInvocation(
|
||||
context, context.findMethod(SKIN_MANAGER, "registerSkins", "(" + objectDesc(GAME_PROFILE) + objectDesc(SKIN_MANAGER_SKIN_TEXTURE_CALLBACK) + "Z)V"),
|
||||
context.findMethod(SKIN_MANAGER, "registerSkins", "(" + objectDesc(GAME_PROFILE) + objectDesc(SKIN_MANAGER_SKIN_TEXTURE_CALLBACK) + "Z)V"),
|
||||
EXECUTOR_SERVICE, "submit", "(" + objectDesc(RUNNABLE) + ")" + objectDesc(FUTURE)));
|
||||
// 19w38a ~ 1.18-exp7 (1.15 ~ 1.17.1)
|
||||
this.rule("skin-manager.register-skins.v2", SKIN_MANAGER, "[554,756],[801,803],[0x40000001,0x4000002F]+[2205,2831]", context ->
|
||||
this.replaceExecutorProfileLoadAtInvocation(
|
||||
context, context.findMethod(SKIN_MANAGER, "registerSkins", "(" + objectDesc(GAME_PROFILE) + objectDesc(SKIN_MANAGER_SKIN_TEXTURE_CALLBACK) + "Z)V"),
|
||||
context.findMethod(SKIN_MANAGER, "registerSkins", "(" + objectDesc(GAME_PROFILE) + objectDesc(SKIN_MANAGER_SKIN_TEXTURE_CALLBACK) + "Z)V"),
|
||||
EXECUTOR, "execute", "(" + objectDesc(RUNNABLE) + ")V"));
|
||||
// 21w37a ~ 1.20.1 (1.18 ~ 1.20.1)
|
||||
this.rule("skin-manager.register-skins.v3", SKIN_MANAGER, "[757,763],[0x40000029,0x4000008E]+[2834,3465]", context ->
|
||||
this.replaceExecutorProfileLoadAtInvocation(
|
||||
context, context.findMethod(SKIN_MANAGER, "registerSkins", "(" + objectDesc(GAME_PROFILE) + objectDesc(SKIN_MANAGER_SKIN_TEXTURE_CALLBACK) + "Z)V"),
|
||||
context.findMethod(SKIN_MANAGER, "registerSkins", "(" + objectDesc(GAME_PROFILE) + objectDesc(SKIN_MANAGER_SKIN_TEXTURE_CALLBACK) + "Z)V"),
|
||||
EXECUTOR_SERVICE, "execute", "(" + objectDesc(RUNNABLE) + ")V"));
|
||||
|
||||
this.rule("skin-manager.get-insecure-skin-information", SKIN_MANAGER, "[,763],[801,803],[0x40000001,0x4000008E]", context -> {
|
||||
@@ -90,14 +89,13 @@ public final class SkinManagerPatch extends PatchSupport {
|
||||
injection.add(new VarInsnNode(ALOAD, 1));
|
||||
injection.add(new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_MANAGER, "loadSkinFromCache", "(" + objectDesc(GAME_PROFILE) + ")" + objectDesc(MAP), false));
|
||||
injection.add(new InsnNode(ARETURN));
|
||||
injection.add(new FrameNode(F_SAME, 0, null, 0, null));
|
||||
methodNode.instructions.insert(injection);
|
||||
return true;
|
||||
});
|
||||
|
||||
// 1.13.2 ~ 1.20.1
|
||||
this.rule("skin-manager.lambda-register-skins-4", SKIN_MANAGER, "[404,763],[801,803],[0x40000001,0x4000008E]", context ->
|
||||
this.replaceGetTexturesWithFakeUserProfile(context, context.findMethod(SKIN_MANAGER, "lambda$registerSkins$4",
|
||||
this.replaceGetTexturesWithFakeUserProfile(context.findMethod(SKIN_MANAGER, "lambda$registerSkins$4",
|
||||
"(" + objectDesc(GAME_PROFILE) + "Z" + objectDesc(SKIN_MANAGER_SKIN_TEXTURE_CALLBACK) + ")V")));
|
||||
|
||||
// 23w42a ~ 25w33a (1.20.3 ~ 1.21.8)
|
||||
@@ -143,7 +141,7 @@ public final class SkinManagerPatch extends PatchSupport {
|
||||
MethodInsnNode methodInsnNode = (MethodInsnNode) instruction;
|
||||
if (MINECRAFT_SESSION_SERVICE.equals(methodInsnNode.owner) && "getTextures".equals(methodInsnNode.name)
|
||||
&& ("(" + objectDesc(GAME_PROFILE) + "Z)" + objectDesc(MAP)).equals(methodInsnNode.desc)) {
|
||||
this.replaceInstructionSafely(context, methodNode, instruction, new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_MANAGER, "loadSkinFromCache", "(" + objectDesc(OBJECT) + objectDesc(GAME_PROFILE) + "Z)" + objectDesc(MAP), false));
|
||||
this.replaceInstructionSafely(methodNode, instruction, new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_MANAGER, "loadSkinFromCache", "(" + objectDesc(OBJECT) + objectDesc(GAME_PROFILE) + "Z)" + objectDesc(MAP), false));
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
@@ -164,7 +162,7 @@ public final class SkinManagerPatch extends PatchSupport {
|
||||
|
||||
// 1.12.2-
|
||||
this.rule("skin-manager-3.get-user-profile", SKIN_MANAGER_3, "[,340]", context ->
|
||||
this.replaceGetTexturesWithFakeUserProfile(context, context.findMethod(SKIN_MANAGER_3, "run", "()V")));
|
||||
this.replaceGetTexturesWithFakeUserProfile(context.findMethod(SKIN_MANAGER_3, "run", "()V")));
|
||||
|
||||
// 23w31a+ (1.20.2+)
|
||||
this.rule("skin-manager-cache-key.access", SKIN_MANAGER_CACHE_KEY, "[764,800],[804,0x40000000],[0x40000090,]", context -> {
|
||||
@@ -318,7 +316,7 @@ public final class SkinManagerPatch extends PatchSupport {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean replaceExecutorProfileLoadAtInvocation(ClassTransformationContext context, MethodNode methodNode, String owner, String name, String desc) {
|
||||
private boolean replaceExecutorProfileLoadAtInvocation(MethodNode methodNode, String owner, String name, String desc) {
|
||||
if (methodNode == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -334,7 +332,7 @@ public final class SkinManagerPatch extends PatchSupport {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.replaceInstructionSafely(context, methodNode, instruction, methodInsnNode = new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_MANAGER, "loadProfileTextures", "(" + objectDesc(OBJECT) + objectDesc(RUNNABLE) + ")V", false));
|
||||
this.replaceInstructionSafely(methodNode, instruction, methodInsnNode = new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_MANAGER, "loadProfileTextures", "(" + objectDesc(OBJECT) + objectDesc(RUNNABLE) + ")V", false));
|
||||
if (!desc.endsWith("V")) {
|
||||
methodNode.instructions.insert(methodInsnNode, new InsnNode(ACONST_NULL));
|
||||
}
|
||||
@@ -344,7 +342,7 @@ public final class SkinManagerPatch extends PatchSupport {
|
||||
return modified;
|
||||
}
|
||||
|
||||
private boolean replaceGetTexturesWithFakeUserProfile(ClassTransformationContext context, MethodNode methodNode) {
|
||||
private boolean replaceGetTexturesWithFakeUserProfile(MethodNode methodNode) {
|
||||
if (methodNode == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -360,7 +358,7 @@ public final class SkinManagerPatch extends PatchSupport {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.replaceInstructionSafely(context, methodNode, instruction, new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_MANAGER, "getUserProfile", "(" + objectDesc(OBJECT) + objectDesc(GAME_PROFILE) + "Z)" + objectDesc(MAP), false));
|
||||
this.replaceInstructionSafely(methodNode, instruction, new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_MANAGER, "getUserProfile", "(" + objectDesc(OBJECT) + objectDesc(GAME_PROFILE) + "Z)" + objectDesc(MAP), false));
|
||||
modified = true;
|
||||
}
|
||||
return modified;
|
||||
@@ -386,20 +384,14 @@ public final class SkinManagerPatch extends PatchSupport {
|
||||
continue;
|
||||
}
|
||||
|
||||
AbstractInsnNode newNode = this.findPreviousTypeInstruction(methodInsnNode, NEW, owner);
|
||||
AbstractInsnNode dupNode = this.nextRealInstruction(newNode);
|
||||
if (newNode == null || dupNode == null || dupNode.getOpcode() != DUP) {
|
||||
continue;
|
||||
}
|
||||
|
||||
methodNode.instructions.remove(newNode);
|
||||
methodNode.instructions.remove(dupNode);
|
||||
|
||||
InsnList replacement = new InsnList();
|
||||
replacement.add(new InsnNode(DUP2_X2));
|
||||
replacement.add(new InsnNode(POP2));
|
||||
replacement.add(new InsnNode(POP2));
|
||||
replacement.add(new VarInsnNode(ALOAD, 1));
|
||||
replacement.add(new MethodInsnNode(INVOKESTATIC, FAKE_CACHE_KEY, "createFakeCacheKey", replacementDesc, false));
|
||||
methodNode.instructions.insertBefore(methodInsnNode, replacement);
|
||||
methodNode.instructions.remove(methodInsnNode);
|
||||
MethodInsnNode createFakeCacheKey = new MethodInsnNode(INVOKESTATIC, FAKE_CACHE_KEY, "createFakeCacheKey", replacementDesc, false);
|
||||
this.replaceInstructionSafely(methodNode, methodInsnNode, createFakeCacheKey);
|
||||
methodNode.instructions.insertBefore(createFakeCacheKey, replacement);
|
||||
modified = true;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ public final class SkinTexturePatch extends PatchSupport {
|
||||
load.instructions.insertBefore(instruction, new VarInsnNode(ALOAD, 0));
|
||||
load.instructions.insertBefore(instruction, new FieldInsnNode(GETFIELD, owner, processTaskField, objectDesc(RUNNABLE)));
|
||||
MethodInsnNode processLegacySkin = new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_BUFFER, "processLegacySkin", replacementDesc, false);
|
||||
this.replaceInstructionSafely(context, load, new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_BUFFER, "shouldProcessLegacySkin", conditionDesc, false), IFNE, instruction, processLegacySkin);
|
||||
this.replaceInstructionSafely(load, new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_BUFFER, "shouldProcessLegacySkin", conditionDesc, false), IFNE, instruction, processLegacySkin);
|
||||
|
||||
InsnList injection = new InsnList();
|
||||
if (methodInsnNode.getOpcode() == INVOKESTATIC) {
|
||||
@@ -120,7 +120,7 @@ public final class SkinTexturePatch extends PatchSupport {
|
||||
|
||||
MethodInsnNode methodInsnNode = (MethodInsnNode) instruction;
|
||||
if (methodInsnNode.getOpcode() == INVOKESTATIC && owner.equals(methodInsnNode.owner) && originalName.equals(methodInsnNode.name) && originalDesc.equals(methodInsnNode.desc)) {
|
||||
this.replaceInstructionSafely(context, methodNode, instruction, new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_BUFFER, "processLegacySkin", originalDesc, false));
|
||||
this.replaceInstructionSafely(methodNode, instruction, new MethodInsnNode(INVOKESTATIC, FAKE_SKIN_BUFFER, "processLegacySkin", originalDesc, false));
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -40,11 +40,11 @@ public final class MixinConfigPlugin implements IMixinConfigPlugin {
|
||||
|
||||
@Override
|
||||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
TransformerBootstrap.transformTargetClass(targetClassName, targetClass);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
TransformerBootstrap.transformTargetClass(targetClassName, targetClass);
|
||||
}
|
||||
}
|
||||
+2
@@ -74,6 +74,8 @@ final class TransformerBootstrap {
|
||||
Method addMixinMethod = ReflectionUtils.findMethod(ClassInfo.class, "addMixin", mixinInfoClass);
|
||||
|
||||
for (String targetClassName : SUPPORT.getTargetClassNames()) {
|
||||
//applyMixinTarget(mixinConfig, DUMMY_MIXIN, targetClassName);
|
||||
|
||||
boolean applied = false;
|
||||
for (Object mixinInfo : (List<?>) mixinsField.get(mixinConfig)) {
|
||||
String currentMixinName = ((IMixinInfo) mixinInfo).getClassName();
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
|
||||
import java.util.Map;
|
||||
|
||||
@IFMLLoadingPlugin.Name("CustomSkinLoaderBootstrap")
|
||||
@IFMLLoadingPlugin.SortingIndex(1010)
|
||||
@IFMLLoadingPlugin.SortingIndex(900)
|
||||
@IFMLLoadingPlugin.TransformerExclusions("customskinloader.bootstrap.")
|
||||
public final class LoadingPlugin implements IFMLLoadingPlugin {
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ final class TransformerBootstrap implements ITransformer<ClassNode> {
|
||||
|
||||
@Override
|
||||
public ClassNode transform(ClassNode input, ITransformerVotingContext context) {
|
||||
String internalClassName = input.name;
|
||||
String internalClassName = context.getClassName().replace('.', '/');
|
||||
ClassTransformationReport report = SUPPORT.transform(internalClassName, input);
|
||||
if (report.isModified()) {
|
||||
LOGGER.info("Transformed ModLauncher target " + internalClassName + " with " + report.getAppliedRuleNames());
|
||||
|
||||
+3
-3
@@ -27,8 +27,8 @@ final class TransformerBootstrap implements ClassProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ProcessorName> runsBefore() {
|
||||
return Collections.singleton(ClassProcessorIds.MIXIN);
|
||||
public Set<ProcessorName> runsAfter() {
|
||||
return Collections.singleton(ClassProcessorIds.SIMPLE_PROCESSORS_GROUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,6 +53,6 @@ final class TransformerBootstrap implements ClassProcessor {
|
||||
|
||||
@Override
|
||||
public OrderingHint orderingHint() {
|
||||
return OrderingHint.EARLY;
|
||||
return OrderingHint.LATE;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user