-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jesus age Christ this took some work, but damn is it worth it. - Enchantments are now working outside dev - Potions and Enchantments are now fully extended. Okay, back into the hole.
- Loading branch information
1 parent
d095e79
commit f400c9a
Showing
4 changed files
with
111 additions
and
45 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.dimdev.jeid; | ||
|
||
import org.objectweb.asm.tree.*; | ||
|
||
import java.util.Iterator; | ||
|
||
public class ASMException extends RuntimeException { | ||
private static final long serialVersionUID = -8581611883691404427L; | ||
|
||
public ASMException(String message) { | ||
super("MaxPotionIDExtender - Class transformation error\n"+message); | ||
} | ||
|
||
public ASMException(String message, ClassNode node) { | ||
this(message+"\n"+getStringDescriptor(node)); | ||
} | ||
|
||
public ASMException(String message, MethodNode node) { | ||
this(message+"\n"+getStringDescriptor(node)); | ||
} | ||
|
||
private static String getStringDescriptor(MethodNode node) { | ||
StringBuilder sb = new StringBuilder(); | ||
Iterator<AbstractInsnNode> i = node.instructions.iterator(); | ||
while (i.hasNext()) { | ||
AbstractInsnNode n = i.next(); | ||
sb.append("["+n.getOpcode()+"] - "+getInsnDesc(n)+"\n"); | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
private static String getInsnDesc(AbstractInsnNode n) { | ||
if (n instanceof LdcInsnNode) { | ||
return "LDC - "+((LdcInsnNode)n).cst.toString(); | ||
} | ||
if (n instanceof LabelNode) { | ||
return "Label - "+((LabelNode)n).getLabel().toString(); | ||
} | ||
if (n instanceof LineNumberNode) { | ||
return "Line - "+((LineNumberNode)n).line; | ||
} | ||
if (n instanceof IntInsnNode) { | ||
return "Int - "+((IntInsnNode)n).operand; | ||
} | ||
if (n instanceof MethodInsnNode) { | ||
MethodInsnNode m = (MethodInsnNode)n; | ||
return "Method - "+m.name+", "+m.desc+", "+m.owner; | ||
} | ||
return n.getClass().getName(); | ||
} | ||
|
||
private static String getStringDescriptor(ClassNode node) { | ||
StringBuilder sb = new StringBuilder(); | ||
node.methods.forEach(m -> sb.append(m.name+": "+m.desc+"\n")); | ||
return sb.toString(); | ||
} | ||
} |
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
36 changes: 0 additions & 36 deletions
36
src/main/java/org/dimdev/jeid/mixin/core/MixinItemStack.java
This file was deleted.
Oops, something went wrong.
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