mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-22 06:12:12 +00:00
Allow NEW injection point class argument to be specified using target
This commit is contained in:
1 parent
27aefc0337
commit
f7892e6e33
2 files changed
+12
-7
No files matched your search
@@ -106,10 +106,10 @@ public @interface At {
|
||||
public String[] args() default { };
|
||||
|
||||
/**
|
||||
* Target member used by INVOKE, INVOKE_STRING, INVOKE_ASSIGN and FIELD.
|
||||
* This <b>must be specified as a fully-qualified member path</b> including
|
||||
* the class name and signature. Failing to fully-qualify the target member
|
||||
* will result in an error at obfuscation time.
|
||||
* Target identifier used by INVOKE, INVOKE_STRING, INVOKE_ASSIGN, FIELD and
|
||||
* NEW. This <b>must be specified as a fully-qualified member path</b>
|
||||
* including the class name and signature. Failing to fully-qualify the
|
||||
* target member will result in an error at obfuscation time.
|
||||
*
|
||||
* @return target reference for supported InjectionPoint types
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,8 @@ import org.spongepowered.asm.lib.tree.TypeInsnNode;
|
||||
import org.spongepowered.asm.mixin.injection.InjectionPoint;
|
||||
import org.spongepowered.asm.mixin.injection.struct.InjectionPointData;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
/**
|
||||
* <p>This injection point searches for NEW opcodes matching its arguments and
|
||||
* returns a list of insns immediately prior to matching instructions. It
|
||||
@@ -51,9 +53,12 @@ import org.spongepowered.asm.mixin.injection.struct.InjectionPointData;
|
||||
* The default value is <b>-1</b> which supresses ordinal matching</dd>
|
||||
* </dl>
|
||||
*
|
||||
* <p>Example:</p>
|
||||
* <p>Examples:</p>
|
||||
* <blockquote><pre>
|
||||
* @At(value = "NEW", args = { "class=java/lang/String" })</pre>
|
||||
* @At(value = "NEW", args = "class=java/lang/String")</pre>
|
||||
* </blockquote>
|
||||
* <blockquote><pre>
|
||||
* @At(value = "NEW", target = "java/lang/String"</pre>
|
||||
* </blockquote>
|
||||
*
|
||||
* <p>Note that like all standard injection points, this class matches the insn
|
||||
@@ -77,7 +82,7 @@ public class BeforeNew extends InjectionPoint {
|
||||
|
||||
public BeforeNew(InjectionPointData data) {
|
||||
this.ordinal = data.getOrdinal();
|
||||
this.className = data.get("class", null).replace('.', '/');
|
||||
this.className = Strings.emptyToNull(data.get("class", data.get("target", "")).replace('.', '/'));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user