-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from LlamaLad7/version/0.3.4
Version/0.3.4
- Loading branch information
Showing
13 changed files
with
210 additions
and
120 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
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
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
61 changes: 0 additions & 61 deletions
61
src/main/java/com/llamalad7/mixinextras/injector/WrapWithConditionInjectionInfo.java
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/main/java/com/llamalad7/mixinextras/injector/WrapWithConditionV1InjectionInfo.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,28 @@ | ||
package com.llamalad7.mixinextras.injector; | ||
|
||
import com.llamalad7.mixinextras.utils.InjectorUtils; | ||
import org.objectweb.asm.tree.AnnotationNode; | ||
import org.objectweb.asm.tree.MethodNode; | ||
import org.spongepowered.asm.mixin.injection.code.Injector; | ||
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo; | ||
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo.HandlerPrefix; | ||
import org.spongepowered.asm.mixin.transformer.MixinTargetContext; | ||
|
||
@InjectionInfo.AnnotationType(WrapWithCondition.class) | ||
@HandlerPrefix("wrapWithCondition") | ||
public class WrapWithConditionV1InjectionInfo extends MixinExtrasInjectionInfo { | ||
public WrapWithConditionV1InjectionInfo(MixinTargetContext mixin, MethodNode method, AnnotationNode annotation) { | ||
super(mixin, method, annotation); | ||
} | ||
|
||
@Override | ||
protected Injector parseInjector(AnnotationNode injectAnnotation) { | ||
return new WrapWithConditionInjector(this); | ||
} | ||
|
||
@Override | ||
public void prepare() { | ||
super.prepare(); | ||
InjectorUtils.checkForImmediatePops(targetNodes); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/com/llamalad7/mixinextras/injector/v2/WrapWithCondition.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,65 @@ | ||
package com.llamalad7.mixinextras.injector.v2; | ||
|
||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Slice; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Allows you to wrap a | ||
* {@link org.spongepowered.asm.mixin.injection.points.BeforeInvoke void method call} or | ||
* {@link org.spongepowered.asm.mixin.injection.points.BeforeFieldAccess field write} | ||
* with a conditional check. | ||
* <p> | ||
* Your handler method receives the targeted instruction's arguments (optionally followed by the enclosing method's | ||
* parameters), and should return a boolean indicating whether the operation should go ahead: | ||
* <table width="100%"> | ||
* <tr> | ||
* <th width="25%">Targeted operation</th> | ||
* <th>Handler signature</th> | ||
* </tr> | ||
* <tr> | ||
* <td>Non-static method call</td> | ||
* <td><code>private (static) boolean handler(<b>ReceiverType</b> instance, <b><params of the original | ||
* call></b>)</code></td> | ||
* </tr> | ||
* <tr> | ||
* <td>Static method call</td> | ||
* <td><code>private (static) boolean handler(<b><params of the original call></b>)</code></td> | ||
* </tr> | ||
* <tr> | ||
* <td>Non-static field write</td> | ||
* <td><code>private (static) boolean handler(<b>ReceiverType</b> instance, <b>FieldType</b> newValue) | ||
* </tr> | ||
* <tr> | ||
* <td>Static field write</td> | ||
* <td><code>private (static) boolean handler(<b>FieldType</b> newValue)</code></td> | ||
* </tr> | ||
* </table> | ||
* This chains when used by multiple people, unlike | ||
* {@link org.spongepowered.asm.mixin.injection.Redirect @Redirect}. | ||
* <p> | ||
* <b>If you always return false then you risk other people's code being silently ignored.</b> | ||
* <p> | ||
* See <a href="https://github.com/LlamaLad7/MixinExtras/wiki/WrapWithCondition">the wiki article</a> for more info. | ||
*/ | ||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface WrapWithCondition { | ||
String[] method(); | ||
|
||
At[] at(); | ||
|
||
Slice[] slice() default {}; | ||
|
||
boolean remap() default true; | ||
|
||
int require() default -1; | ||
|
||
int expect() default 1; | ||
|
||
int allow() default -1; | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/com/llamalad7/mixinextras/injector/v2/WrapWithConditionInjectionInfo.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,35 @@ | ||
package com.llamalad7.mixinextras.injector.v2; | ||
|
||
import com.llamalad7.mixinextras.injector.MixinExtrasLateInjectionInfo; | ||
import com.llamalad7.mixinextras.injector.WrapWithConditionInjector; | ||
import com.llamalad7.mixinextras.utils.InjectorUtils; | ||
import org.objectweb.asm.tree.AnnotationNode; | ||
import org.objectweb.asm.tree.MethodNode; | ||
import org.spongepowered.asm.mixin.injection.code.Injector; | ||
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo; | ||
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo.HandlerPrefix; | ||
import org.spongepowered.asm.mixin.transformer.MixinTargetContext; | ||
|
||
@InjectionInfo.AnnotationType(WrapWithCondition.class) | ||
@HandlerPrefix("wrapWithCondition") | ||
public class WrapWithConditionInjectionInfo extends MixinExtrasLateInjectionInfo { | ||
public WrapWithConditionInjectionInfo(MixinTargetContext mixin, MethodNode method, AnnotationNode annotation) { | ||
super(mixin, method, annotation); | ||
} | ||
|
||
@Override | ||
protected Injector parseInjector(AnnotationNode injectAnnotation) { | ||
return new WrapWithConditionInjector(this); | ||
} | ||
|
||
@Override | ||
public void prepare() { | ||
super.prepare(); | ||
InjectorUtils.checkForImmediatePops(targetNodes); | ||
} | ||
|
||
@Override | ||
public String getLateInjectionType() { | ||
return "WrapWithCondition"; | ||
} | ||
} |
Oops, something went wrong.