Skip to content

Commit

Permalink
Blacklists should not be restricted to TileEntities.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe12o committed Feb 5, 2014
1 parent 0dd5e53 commit 426171d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/skcraft/alicefixes/util/ASMHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -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",
Expand Down

0 comments on commit 426171d

Please sign in to comment.