package com.blogspot.richardreigens.regrowableleaves;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.init.Blocks;
import net.minecraftforge.event.world.BlockEvent;


/**
 * Created by LiLRichy on 12/26/2015.
 */
public class EventHandler {

    @SubscribeEvent
    public void BreakEvent(BlockEvent.BreakEvent e) {
        int x = e.x;
        int y = e.y;
        int z = e.z;

        // LogHelper.info(e.blockMetadata);
        if (e.block == Blocks.leaves) {
            if (e.blockMetadata == 0 || e.blockMetadata == 4 || e.blockMetadata == 8 || e.blockMetadata == 12) {
                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 0, 3);
            } else if (e.blockMetadata == 1 || e.blockMetadata == 5 || e.blockMetadata == 9 || e.blockMetadata == 13) {
                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 1, 3);
            } else if (e.blockMetadata == 2 || e.blockMetadata == 6 || e.blockMetadata == 10 || e.blockMetadata == 14) {
                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 2, 3);
            } else if (e.blockMetadata == 3 || e.blockMetadata == 7 || e.blockMetadata == 11 || e.blockMetadata == 15) {
                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 3, 3);
            }
            e.setCanceled(true);
        } else if (e.block == Blocks.leaves2) {
            if (e.blockMetadata == 0 || e.blockMetadata == 4 || e.blockMetadata == 8 || e.blockMetadata == 12) {
                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 5, 3);
            } else if (e.blockMetadata == 1 || e.blockMetadata == 5 || e.blockMetadata == 9 || e.blockMetadata == 13) {
                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 6, 3);
            }
            e.setCanceled(true);
        }
    }
}

@@ -485,17 +485,16 @@
 leaves) 
-%7B
 %0A       
@@ -498,792 +498,134 @@
     
-    if (e.blockMetadata == 0 %7C%7C e.blockMetadata == 4 %7C%7C e.blockMetadata == 8 %7C%7C e.blockMetadata == 12) %7B%0A                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 0, 3);%0A            %7D else if (e.blockMetadata == 1 %7C%7C e.blockMetadata == 5 %7C%7C e.blockMetadata == 9 %7C%7C e.blockMetadata == 13) %7B%0A                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 1, 3);%0A            %7D else if (e.blockMetadata == 2 %7C%7C e.blockMetadata == 6 %7C%7C e.blockMetadata == 10 %7C%7C e.blockMetadata == 14) %7B%0A                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 2, 3);%0A            %7D else if (e.blockMetadata == 3 %7C%7C e.blockMetadata == 7 %7C%7C e.blockMetadata == 11 %7C%7C e.blockMetadata == 15) %7B%0A                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 3, 3
+%7B%0A            e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, e.blockMetadata %25 4, 3);%0A            e.setCanceled(true
 );%0A 
@@ -623,36 +623,32 @@
 (true);%0A        
-    
 %7D%0A            e.
@@ -645,43 +645,8 @@
     
- 
-   e.setCanceled(true);%0A        %7D 
 else
@@ -676,31 +676,25 @@
 leaves2)
- %7B%0A    
+%0A
         
 if (e.bl
@@ -689,402 +689,109 @@
     
-if (e.blockMetadata == 0 %7C%7C e.blockMetadata == 4 %7C%7C e.blockMetadata == 8 %7C%7C e.blockMetadata == 12) %7B%0A                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 5, 3);%0A            %7D else if (e.blockMetadata == 1 %7C%7C e.blockMetadata == 5 %7C%7C e.blockMetadata == 9 %7C%7C e.blockMetadata == 13) %7B%0A                e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, 6, 3);%0A            %7D
+%7B%0A            e.world.setBlock(x, y, z, regrowableleaves.blockLeafAir, (e.blockMetadata %25 4) + 5, 3);
 %0A   

Update EventHandler.java (simplify)