Skip to content

Commit

Permalink
New: Support @WrapWithCondition v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
LlamaLad7 committed Jan 25, 2024
1 parent ef494e4 commit c63cef2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ public final class Annotation {
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;";
public static final String MIXIN_EXTRAS_WRAP_WITH_CONDITION_V2 = "Lcom/llamalad7/mixinextras/injector/v2/WrapWithCondition;";
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
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;
import net.fabricmc.tinyremapper.extension.mixin.soft.annotation.injection.WrapWithConditionV2AnnotationVisitor;

class SoftTargetMixinMethodVisitor extends MethodVisitor {
private final CommonData data;
Expand Down Expand Up @@ -88,6 +89,8 @@ public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
av = new WrapOperationAnnotationVisitor(data, av, remap, targets);
} else if (Annotation.MIXIN_EXTRAS_WRAP_WITH_CONDITION.equals(descriptor)) {
av = new WrapWithConditionAnnotationVisitor(data, av, remap, targets);
} else if (Annotation.MIXIN_EXTRAS_WRAP_WITH_CONDITION_V2.equals(descriptor)) {
av = new WrapWithConditionV2AnnotationVisitor(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 WrapWithConditionV2AnnotationVisitor extends CommonInjectionAnnotationVisitor {
public WrapWithConditionV2AnnotationVisitor(CommonData data, AnnotationVisitor delegate, boolean remap, List<String> targets) {
super(Annotation.MIXIN_EXTRAS_WRAP_WITH_CONDITION_V2, data, delegate, remap, targets);
}
}

0 comments on commit c63cef2

Please sign in to comment.