Skip to content

Commit

Permalink
Revert "Fix: Fix NEW descriptor gating."
Browse files Browse the repository at this point in the history
This reverts commit 74a1696.
  • Loading branch information
LlamaLad7 committed Aug 15, 2024
1 parent a4aaaa9 commit 2307a33
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.TypeInsnNode;
import org.spongepowered.asm.mixin.FabricUtil;
import org.spongepowered.asm.mixin.injection.InjectionPoint;
import org.spongepowered.asm.mixin.injection.InjectionPoint.AtCode;
import org.spongepowered.asm.mixin.injection.selectors.ITargetSelector;
Expand Down Expand Up @@ -107,11 +106,6 @@ public class BeforeNew extends InjectionPoint {
*/
private final int ordinal;

/**
* Fabric: Whether to ignore the supplied descriptor in keeping with 0.8.5 and below.
*/
private final boolean ignoreDesc;

public BeforeNew(InjectionPointData data) {
super(data);

Expand All @@ -124,8 +118,7 @@ public BeforeNew(InjectionPointData data) {
}
ITargetSelectorConstructor targetSelector = (ITargetSelectorConstructor)member;
this.target = targetSelector.toCtorType();
this.desc = targetSelector.toCtorDesc();
this.ignoreDesc = FabricUtil.getCompatibility(data.getContext()) < FabricUtil.COMPATIBILITY_0_14_0;
this.desc = org.spongepowered.asm.mixin.FabricUtil.getCompatibility(data.getContext()) >= org.spongepowered.asm.mixin.FabricUtil.COMPATIBILITY_0_14_0 ? targetSelector.toCtorDesc() : null;
}

/**
Expand All @@ -139,7 +132,7 @@ public boolean hasDescriptor() {
* Gets the descriptor from the injection point, can return null
*/
public String getDescriptor() {
return this.ignoreDesc ? null : this.desc;
return this.desc;
}

@SuppressWarnings("unchecked")
Expand All @@ -166,7 +159,7 @@ public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> no

if (this.desc != null) {
for (TypeInsnNode newNode : newNodes) {
if (BeforeNew.findInitNodeFor(insns, newNode, this.getDescriptor()) != null) {
if (BeforeNew.findInitNodeFor(insns, newNode, this.desc) != null) {
nodes.add(newNode);
found = true;
}
Expand Down

0 comments on commit 2307a33

Please sign in to comment.