Skip to content
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

Mixin Extras support #118

Merged
merged 2 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, 2018, Player, asie
* Copyright (c) 2021, FabricMC
* Copyright (c) 2016, 2023, FabricMC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -63,4 +63,10 @@ public final class Annotation {
public static final String MIXIN_MERGED = "Lorg/spongepowered/asm/mixin/transformer/meta/MixinMerged;";
public static final String MIXIN_PROXY = "Lorg/spongepowered/asm/mixin/transformer/meta/MixinProxy;";
public static final String MIXIN_RENAMED = "Lorg/spongepowered/asm/mixin/transformer/meta/MixinRenamed;";

public static final String MIXIN_EXTRAS_MODIFY_EXPRESSION_VALUE = "Lcom/llamalad7/mixinextras/injector/ModifyExpressionValue;";
public static final String MIXIN_EXTRAS_MODIFY_RECEIVER = "Lcom/llamalad7/mixinextras/injector/ModifyReceiver;";
public static final String MIXIN_EXTRAS_MODIFY_RETURN_VALUE = "Lcom/llamalad7/mixinextras/injector/ModifyReturnValue;";
public static final String MIXIN_EXTRAS_WRAP_OPERATION = "Lcom/llamalad7/mixinextras/injector/wrapoperation/WrapOperation;";
public static final String MIXIN_EXTRAS_WRAP_WITH_CONDITION = "Lcom/llamalad7/mixinextras/injector/WrapWithCondition;";
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, 2018, Player, asie
* Copyright (c) 2021, FabricMC
* Copyright (c) 2021, 2023, FabricMC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -34,8 +34,13 @@
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.ModifyArgAnnotationVisitor;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.ModifyArgsAnnotationVisitor;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.ModifyConstantAnnotationVisitor;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.ModifyExpressionValueAnnotationVisitor;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.ModifyReceiverAnnotationVisitor;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.ModifyReturnValueAnnotationVisitor;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.ModifyVariableAnnotationVisitor;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.RedirectAnnotationVisitor;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.WrapOperationAnnotationVisitor;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.WrapWithConditionAnnotationVisitor;

class SoftTargetMixinMethodVisitor extends MethodVisitor {
private final CommonData data;
Expand Down Expand Up @@ -73,6 +78,16 @@ public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
av = new ModifyVariableAnnotationVisitor(data, av, remap, targets);
} else if (Annotation.REDIRECT.equals(descriptor)) {
av = new RedirectAnnotationVisitor(data, av, remap, targets);
} else if (Annotation.MIXIN_EXTRAS_MODIFY_EXPRESSION_VALUE.equals(descriptor)) {
av = new ModifyExpressionValueAnnotationVisitor(data, av, remap, targets);
} else if (Annotation.MIXIN_EXTRAS_MODIFY_RECEIVER.equals(descriptor)) {
av = new ModifyReceiverAnnotationVisitor(data, av, remap, targets);
} else if (Annotation.MIXIN_EXTRAS_MODIFY_RETURN_VALUE.equals(descriptor)) {
av = new ModifyReturnValueAnnotationVisitor(data, av, remap, targets);
} else if (Annotation.MIXIN_EXTRAS_WRAP_OPERATION.equals(descriptor)) {
av = new WrapOperationAnnotationVisitor(data, av, remap, targets);
} else if (Annotation.MIXIN_EXTRAS_WRAP_WITH_CONDITION.equals(descriptor)) {
av = new WrapWithConditionAnnotationVisitor(data, av, remap, targets);
}

return av;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2016, 2018, Player, asie
* Copyright (c) 2023, FabricMC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection;

import java.util.List;

import org.objectweb.asm.AnnotationVisitor;

import net.fabricmc.tinyremapper.extension.mixin.common.data.Annotation;
import net.fabricmc.tinyremapper.extension.mixin.common.data.CommonData;

public class ModifyExpressionValueAnnotationVisitor extends CommonInjectionAnnotationVisitor {
public ModifyExpressionValueAnnotationVisitor(CommonData data, AnnotationVisitor delegate, boolean remap, List<String> targets) {
super(Annotation.MIXIN_EXTRAS_MODIFY_EXPRESSION_VALUE, data, delegate, remap, targets);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2016, 2018, Player, asie
* Copyright (c) 2023, FabricMC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection;

import java.util.List;

import org.objectweb.asm.AnnotationVisitor;

import net.fabricmc.tinyremapper.extension.mixin.common.data.Annotation;
import net.fabricmc.tinyremapper.extension.mixin.common.data.CommonData;

public class ModifyReceiverAnnotationVisitor extends CommonInjectionAnnotationVisitor {
public ModifyReceiverAnnotationVisitor(CommonData data, AnnotationVisitor delegate, boolean remap, List<String> targets) {
super(Annotation.MIXIN_EXTRAS_MODIFY_RECEIVER, data, delegate, remap, targets);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2016, 2018, Player, asie
* Copyright (c) 2023, FabricMC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection;

import java.util.List;

import org.objectweb.asm.AnnotationVisitor;

import net.fabricmc.tinyremapper.extension.mixin.common.data.Annotation;
import net.fabricmc.tinyremapper.extension.mixin.common.data.CommonData;

public class ModifyReturnValueAnnotationVisitor extends CommonInjectionAnnotationVisitor {
public ModifyReturnValueAnnotationVisitor(CommonData data, AnnotationVisitor delegate, boolean remap, List<String> targets) {
super(Annotation.MIXIN_EXTRAS_MODIFY_RETURN_VALUE, data, delegate, remap, targets);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2016, 2018, Player, asie
* Copyright (c) 2023, FabricMC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection;

import java.util.List;

import org.objectweb.asm.AnnotationVisitor;

import net.fabricmc.tinyremapper.extension.mixin.common.data.Annotation;
import net.fabricmc.tinyremapper.extension.mixin.common.data.CommonData;

public class WrapOperationAnnotationVisitor extends CommonInjectionAnnotationVisitor {
public WrapOperationAnnotationVisitor(CommonData data, AnnotationVisitor delegate, boolean remap, List<String> targets) {
super(Annotation.MIXIN_EXTRAS_WRAP_OPERATION, data, delegate, remap, targets);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2016, 2018, Player, asie
* Copyright (c) 2023, FabricMC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection;

import java.util.List;

import org.objectweb.asm.AnnotationVisitor;

import net.fabricmc.tinyremapper.extension.mixin.common.data.Annotation;
import net.fabricmc.tinyremapper.extension.mixin.common.data.CommonData;

public class WrapWithConditionAnnotationVisitor extends CommonInjectionAnnotationVisitor {
public WrapWithConditionAnnotationVisitor(CommonData data, AnnotationVisitor delegate, boolean remap, List<String> targets) {
super(Annotation.MIXIN_EXTRAS_WRAP_WITH_CONDITION, data, delegate, remap, targets);
}
}