GasStation compat

This commit is contained in:
FalsePattern committed 2022-09-01 20:30:26 +02:00
1 parent 84b934d41c
commit bdf73dd29a
5 files changed
+29 -96

No files matched your search

@@ -32,7 +32,7 @@ import java.util.List;
public class IMixinPluginTransformer implements IClassNodeTransformer {
private static final String CLASSNODE_MIXINBOOTER = "org/spongepowered/libraries/org/objectweb/asm/tree/ClassNode";
private static final String CLASSNODE_SPONGEMIXINS = "org/spongepowered/asm/lib/tree/ClassNode";
private static final String CLASSNODE_REGULAR = "org/spongepowered/asm/lib/tree/ClassNode";
private static final String IMIXINPLUGIN = Tags.GROUPNAME + ".mixin.IMixinPlugin";
private static final String IMIXINPLUGIN_INTERNAL = IMIXINPLUGIN.replace('.', '/');
private static final String IMIXINCONFIGPLUGIN_INTERNAL = "org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin";
@@ -57,18 +57,18 @@ public class IMixinPluginTransformer implements IClassNodeTransformer {
}
private static void transformIMixinPlugin(ClassNode cn) {
if (!MixinInfo.isMixinBooterLegacy()) {
FPTransformer.LOG.info("Could not detect MixinBooterLegacy. Converting IMixinPlugin to legacy compat mode.");
doRename(cn.methods, CLASSNODE_MIXINBOOTER, CLASSNODE_SPONGEMIXINS);
if (MixinInfo.isMixinBooterLegacy()) {
FPTransformer.LOG.info("Detected MixinBooterLegacy. Converting IMixinPlugin to compat mode.");
doRename(cn.methods, CLASSNODE_REGULAR, CLASSNODE_MIXINBOOTER);
}
}
private static void transformPlugin(ClassNode cn, String transformedName) {
FPTransformer.LOG.info("Transforming " + transformedName + " to fit current mixin environment.");
if (!MixinInfo.isMixinBooterLegacy()) {
doRename(cn.methods, CLASSNODE_MIXINBOOTER, CLASSNODE_SPONGEMIXINS);
doRename(cn.methods, CLASSNODE_MIXINBOOTER, CLASSNODE_REGULAR);
} else {
doRename(cn.methods, CLASSNODE_SPONGEMIXINS, CLASSNODE_MIXINBOOTER);
doRename(cn.methods, CLASSNODE_REGULAR, CLASSNODE_MIXINBOOTER);
}
}
@@ -21,13 +21,13 @@
package com.falsepattern.lib.mixin;
import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.mixin.stubpackage.org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import com.falsepattern.lib.util.FileUtil;
import lombok.val;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.lib.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import org.spongepowered.libraries.org.objectweb.asm.tree.ClassNode;
import net.minecraft.launchwrapper.Launch;
@@ -146,14 +146,14 @@ public interface IMixinPlugin extends IMixinConfigPlugin {
return success;
}
@Override
@StableAPI.Expose(since = "__INTERNAL__")
@Override
default void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
@Override
@StableAPI.Expose(since = "__INTERNAL__")
@Override
default void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
@@ -1,41 +0,0 @@
/*
* This file is part of Mixin, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.falsepattern.lib.mixin.stubpackage.org.spongepowered.asm.mixin.extensibility;
import java.util.List;
import java.util.Set;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import org.spongepowered.libraries.org.objectweb.asm.tree.ClassNode;
public interface IMixinConfigPlugin {
void onLoad(String mixinPackage);
String getRefMapperConfig();
boolean shouldApplyMixin(String targetClassName, String mixinClassName);
void acceptTargets(Set<String> myTargets, Set<String> otherTargets);
List<String> getMixins();
void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo);
void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo);
}