forked from Jorbon/cool_elytra
-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
- Updated to support 1.20.2. | ||
- Fixed compatibility with Equipment Compare. (#89) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/client/java/nl/enjarai/doabarrelroll/util/MixinCancelChecker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package nl.enjarai.doabarrelroll.util; | ||
|
||
import org.objectweb.asm.AnnotationVisitor; | ||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.service.MixinService; | ||
import org.spongepowered.asm.util.Annotations; | ||
|
||
import java.io.IOException; | ||
|
||
public class MixinCancelChecker { | ||
/** | ||
* Check if a mixin does not have the expected priority. | ||
* If priority is not set on the target mixin, expectedPriority should be 0. | ||
*/ | ||
public static boolean hasChangedPriority(String mixinClassName, int expectedPriority) { | ||
try { | ||
var classNode = MixinService.getService().getBytecodeProvider().getClassNode(mixinClassName); | ||
var annotationNode = Annotations.getInvisible(classNode, Mixin.class); | ||
var visitor = new Visitor(); | ||
annotationNode.accept(visitor); | ||
|
||
return visitor.getPriority() != expectedPriority; | ||
} catch (ClassNotFoundException | IOException | NullPointerException e) { | ||
return false; | ||
} | ||
} | ||
|
||
static class Visitor extends AnnotationVisitor { | ||
private int priority; | ||
|
||
protected Visitor() { | ||
super(Opcodes.ASM9); | ||
} | ||
|
||
@Override | ||
public void visit(String name, Object value) { | ||
if (name.equals("priority")) { | ||
this.priority = (int) value; | ||
} | ||
super.visit(name, value); | ||
} | ||
|
||
public int getPriority() { | ||
return priority; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters