Restore patch to vanilla command node (#464)

This commit is contained in:
IzzelAliz 2022-02-07 11:56:59 +08:00
parent b547770edb
commit 86ffdd103b
No known key found for this signature in database
GPG Key ID: EE50E123A11D8338

View File

@ -68,17 +68,18 @@ public class AbstractBootstrap {
removeCommand.name = "removeCommand";
removeCommand.desc = Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(String.class));
removeCommand.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
removeCommand.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
removeCommand.instructions.add(new FieldInsnNode(Opcodes.GETFIELD, "com/mojang/brigadier/tree/CommandNode", "children", Type.getDescriptor(Map.class)));
removeCommand.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
removeCommand.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, Type.getInternalName(Map.class), "remove", "(Ljava/lang/Object;)Ljava/lang/Object;", true));
removeCommand.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
removeCommand.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
removeCommand.instructions.add(new FieldInsnNode(Opcodes.GETFIELD, "com/mojang/brigadier/tree/CommandNode", "literals", Type.getDescriptor(Map.class)));
removeCommand.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
removeCommand.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, Type.getInternalName(Map.class), "remove", "(Ljava/lang/Object;)Ljava/lang/Object;", true));
removeCommand.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
removeCommand.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
removeCommand.instructions.add(new FieldInsnNode(Opcodes.GETFIELD, "com/mojang/brigadier/tree/CommandNode", "arguments", Type.getDescriptor(Map.class)));
removeCommand.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1));
removeCommand.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, Type.getInternalName(Map.class), "remove", "(Ljava/lang/Object;)Ljava/lang/Object;", true));
removeCommand.instructions.add(new InsnNode(Opcodes.RETURN));
node.methods.add(removeCommand);
}
var cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);