Advertisement
Guest User

Untitled

a guest
May 26th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. public abstract class AntiCactiClassTransformer implements IClassTransformer
  2. {
  3. private static final String[] classesBeingTransformed =
  4. {
  5. "net.minecraft.block.BlockCactus"
  6. };
  7.  
  8.  
  9.  
  10. private byte[] transformGuiOptions(byte[] bytecode, boolean obf) throws IOException {
  11.  
  12. String className = obf ? "ajt;" : "Lnet.minecraft.block.BlockCactus;";
  13.  
  14. String methodName = obf ? "a" : "onBlockPlacedBy";
  15.  
  16. ClassNode classNode = new ClassNode();
  17. ClassReader classReader = new ClassReader(bytecode);
  18. classReader.accept(classNode, 0);
  19.  
  20. insertHook(classNode, methodName, "()V", HOOKS_CLASS, "onBlockPlacedBy", "(Lnet/minecraft/world/World;IIILnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;)V",
  21. true, false, null, new int[]{0}, new int[]{Opcodes.ALOAD});
  22.  
  23.  
  24. ClassWriter writer = new ClassWriter(0);
  25. classNode.accept(writer);
  26. return writer.toByteArray();
  27. }
  28.  
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement