Advertisement
Draco18s

ASM Water

Aug 18th, 2015
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. public someclass {
  2.     public static void waterInHell(World world, int x, int y, int z) {
  3.         Block b = world.getBlock(x, y, z);
  4.         if (b.blockMaterial != Material.water) {
  5.             return;
  6.         }
  7.         if (world.provider.isHellWorld) {
  8.             world.setBlockToAir(x, y, z);
  9.             world.playAuxSFX(1004, x, y, z, 0);
  10.             world.playAuxSFX(2000, x, y, z, 4);
  11.         }
  12.     }
  13. }
  14.  
  15. /* somewhere in your ASM transformer */
  16.  
  17.     MethodNode method = ASMHelper.findMethod(classNode, "/*TODO: get obf name*/", "onBlockAdded", VOID_TYPE, WORLD_TYPE, INT_TYPE, INT_TYPE, INT_TYPE);
  18.     InsnList patch = new InsnList();
  19.     patch.add(new VarInsnNode(ALOAD, 1));
  20.     patch.add(new VarInsnNode(ILOAD, 2));
  21.     patch.add(new VarInsnNode(ILOAD, 3));
  22.     patch.add(new VarInsnNode(ILOAD, 4));
  23.     patch.add(new MethodInsnNode(INVOKESTATIC, "cofh/asm/whatever/someclass", "waterInHell", getMethodDescriptor(VOID_TYPE, WORLD_TYPE, INT_TYPE, INT_TYPE, INT_TYPE)));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement