Skip to content

Commit 35a3559

Browse files
committed
Merge remote-tracking branch 'FabricMC/main'
2 parents ec31a23 + a3cd815 commit 35a3559

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description=CleanMix (Cleanroom Mixin)
55
url=https://cleanroommc.com/
66
organization=CleanroomMC
77
buildVersion=0.1.0
8-
upstreamFabricVersion=0.16.4
8+
upstreamFabricVersion=0.16.5
99
upstreamMixinVersion=0.8.7
1010
buildType=RELEASE
1111
asmVersion=9.8

src/main/java/org/spongepowered/asm/mixin/ModUtil.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ public final class ModUtil {
5252
public static final int FABRIC_COMPATIBILITY_0_14_0 = 14000; // 0.14.0+mixin.0.8.6
5353

5454
/**
55-
* Latest Fabric compatibility version
55+
* Fabric compatibility version 0.16.5
5656
*/
57-
public static final int FABRIC_COMPATIBILITY_LATEST = FABRIC_COMPATIBILITY_0_14_0;
57+
public static final int COMPATIBILITY_0_16_5 = 16005; // 0.16.5+mixin.0.8.7
58+
59+
/**
60+
* Latest compatibility version
61+
*/
62+
public static final int COMPATIBILITY_LATEST = COMPATIBILITY_0_16_5;
5863

5964
public static String getModId(IMixinConfig config) {
6065
return getModId(config, UNKNOWN_MOD_ID);

src/main/java/org/spongepowered/asm/mixin/injection/InjectionPoint.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.objectweb.asm.tree.AnnotationNode;
4646
import org.objectweb.asm.tree.InsnList;
4747
import org.objectweb.asm.tree.MethodNode;
48+
import org.spongepowered.asm.mixin.ModUtil;
4849
import org.spongepowered.asm.mixin.MixinEnvironment;
4950
import org.spongepowered.asm.mixin.MixinEnvironment.Option;
5051
import org.spongepowered.asm.mixin.injection.callback.CallbackInjector;
@@ -552,14 +553,20 @@ static final class Shift extends InjectionPoint {
552553

553554
private final InjectionPoint input;
554555
private final int shift;
556+
private final boolean respectSpecifier;
555557

556558
public Shift(InjectionPoint input, int shift) {
559+
this(input, shift, ModUtil.COMPATIBILITY_LATEST);
560+
}
561+
562+
public Shift(InjectionPoint input, int shift, int fabricCompatibility) {
557563
if (input == null) {
558564
throw new IllegalArgumentException("Must supply an input injection point for SHIFT");
559565
}
560566

561567
this.input = input;
562568
this.shift = shift;
569+
this.respectSpecifier = fabricCompatibility >= ModUtil.COMPATIBILITY_0_16_5;
563570
}
564571

565572
/* (non-Javadoc)
@@ -606,6 +613,11 @@ public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> no
606613

607614
return nodes.size() > 0;
608615
}
616+
617+
@Override
618+
public Specifier getSpecifier(Specifier defaultSpecifier) {
619+
return this.respectSpecifier ? this.input.getSpecifier(defaultSpecifier) : super.getSpecifier(defaultSpecifier);
620+
}
609621
}
610622

611623
/**
@@ -871,15 +883,17 @@ private static InjectionPoint create(IMixinContext context, InjectionPointData d
871883

872884
private static InjectionPoint shift(IInjectionPointContext context, InjectionPoint point,
873885
At.Shift shift, int by) {
886+
887+
int fabricCompatibility = ModUtil.getCompatibility(context);
874888

875889
if (point != null) {
876890
if (shift == At.Shift.BEFORE) {
877-
return InjectionPoint.before(point);
891+
return new InjectionPoint.Shift(point, -1, fabricCompatibility);
878892
} else if (shift == At.Shift.AFTER) {
879-
return InjectionPoint.after(point);
893+
return new InjectionPoint.Shift(point, 1, fabricCompatibility);
880894
} else if (shift == At.Shift.BY) {
881895
InjectionPoint.validateByValue(context.getMixin(), context.getMethod(), context.getAnnotationNode(), point, by);
882-
return InjectionPoint.shift(point, by);
896+
return new InjectionPoint.Shift(point, by, fabricCompatibility);
883897
}
884898
}
885899

0 commit comments

Comments
 (0)