From 426171d2309eab302b4f90ebd46fbd2f9333c505 Mon Sep 17 00:00:00 2001 From: Joe12o Date: Tue, 4 Feb 2014 21:21:36 -0500 Subject: [PATCH] Blacklists should not be restricted to TileEntities. --- .../alicefixes/transformers/ClassTransformer.java | 6 +++--- .../java/com/skcraft/alicefixes/util/ASMHelper.java | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/skcraft/alicefixes/transformers/ClassTransformer.java b/src/main/java/com/skcraft/alicefixes/transformers/ClassTransformer.java index 1a87eae..edffed4 100644 --- a/src/main/java/com/skcraft/alicefixes/transformers/ClassTransformer.java +++ b/src/main/java/com/skcraft/alicefixes/transformers/ClassTransformer.java @@ -74,12 +74,12 @@ public ToolMethodVisitor(MethodVisitor mv, List vars, JsonHelperObject patch) { public void visitCode() { if(!patch.tileEntity) { if(vars.size() == 1) { - ASMHelper.injectCode(mv, vars.get(0), patch.returnType); + ASMHelper.injectCode(mv, vars.get(0), patch.returnType, patch.blacklist); } else if(vars.size() == 4) { - ASMHelper.injectCode(mv, vars.get(0), vars.get(1), vars.get(2), vars.get(3), patch.returnType); + ASMHelper.injectCode(mv, vars.get(0), vars.get(1), vars.get(2), vars.get(3), patch.returnType, patch.blacklist); } } else { - ASMHelper.injectCode(mv, patch.className, patch.facingVar, patch.varType, patch.returnType); + ASMHelper.injectCode(mv, patch.className, patch.facingVar, patch.varType, patch.returnType, patch.blacklist); } } } diff --git a/src/main/java/com/skcraft/alicefixes/util/ASMHelper.java b/src/main/java/com/skcraft/alicefixes/util/ASMHelper.java index f1a5b25..54df8dd 100644 --- a/src/main/java/com/skcraft/alicefixes/util/ASMHelper.java +++ b/src/main/java/com/skcraft/alicefixes/util/ASMHelper.java @@ -98,14 +98,14 @@ private static boolean fireEvent(EntityLivingBase player, int x, int y, int z) { return true; } - public static void injectCode(MethodVisitor mv, int entityVar, int xVar, int yVar, int zVar, String returnType) { + public static void injectCode(MethodVisitor mv, int entityVar, int xVar, int yVar, int zVar, String returnType, boolean blacklist) { Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, entityVar); mv.visitVarInsn(ILOAD, xVar); mv.visitVarInsn(ILOAD, yVar); mv.visitVarInsn(ILOAD, zVar); - mv.visitInsn(ICONST_0); + mv.visitInsn(blacklist ? ICONST_1 : ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "com/skcraft/alicefixes/util/ASMHelper", "canMine", "(L" + Obfs.get("EntityLivingBase") + ";IIIZLjava/lang/Object;)Z"); @@ -118,11 +118,11 @@ public static void injectCode(MethodVisitor mv, int entityVar, int xVar, int yVa mv.visitCode(); } - public static void injectCode(MethodVisitor mv, int entityVar, String returnType) { + public static void injectCode(MethodVisitor mv, int entityVar, String returnType, boolean blacklist) { Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, entityVar); - mv.visitInsn(ICONST_0); + mv.visitInsn(blacklist ? ICONST_1 : ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "com/skcraft/alicefixes/util/ASMHelper", "canMine", "(L" + Obfs.get("EntityLivingBase") + ";ZLjava/lang/Object;)Z"); @@ -135,13 +135,13 @@ public static void injectCode(MethodVisitor mv, int entityVar, String returnType mv.visitCode(); } - public static void injectCode(MethodVisitor mv, String className, String facingName, String facingType, String returnType) { + public static void injectCode(MethodVisitor mv, String className, String facingName, String facingType, String returnType, boolean blacklist) { Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, className.replace('.', '/'), facingName, AliceTransformer.primitives.get(facingType)); - mv.visitInsn(ICONST_1); + mv.visitInsn(blacklist ? ICONST_1 : ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "com/skcraft/alicefixes/util/ASMHelper",