package crazypants.enderio.item;

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

import org.lwjgl.input.Mouse;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO;
import crazypants.enderio.api.tool.IConduitControl;
import crazypants.enderio.conduit.ConduitDisplayMode;
import crazypants.enderio.network.PacketHandler;

public class ToolTickHandler {
  protected int slotSelected = -1;
  public static int dWheel;

  @SideOnly(Side.CLIENT)
  @SubscribeEvent
  public void onClientTick(TickEvent.ClientTickEvent event) {

    if(event.phase == Phase.START) {
      dWheel = Mouse.getDWheel() / 120;
      EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
      if(isToolSelected(player)
          && player.isSneaking()) {
        slotSelected = player.inventory.currentItem;
      } else {
        slotSelected = -1;
      }
    } else {

      EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
      if(player != null) {
        if(slotSelected > -1 && dWheel != Mouse.getDWheel()) {
          player.inventory.currentItem = slotSelected;
          Minecraft.getMinecraft().playerController.updateController();

          ItemStack stack = player.inventory.getStackInSlot(slotSelected);
          if(stack == null) {
            slotSelected = -1;
            return;
          }          
          if(stack.getItem() == EnderIO.itemConduitProbe) {            
            changeConduitProbeMode(stack);              
          } else if(stack.getItem() instanceof IConduitControl) {          
            changeDisplayMode(stack, player);
          }
        }
        slotSelected = -1;

      }
    }
  }

  private void changeDisplayMode(ItemStack stack, EntityPlayer player) {
    if (!((IConduitControl)stack.getItem()).showOverlay(stack, player)) {
      return;
    }
    ConduitDisplayMode curMode = ConduitDisplayMode.getDisplayMode(stack);
    if(curMode == null) {
      curMode = ConduitDisplayMode.ALL;
    }

    int dif = dWheel - Mouse.getDWheel();
    ConduitDisplayMode newMode = null;
    if(dif < 0) {
      newMode = curMode.next();
      ConduitDisplayMode.setDisplayMode(stack, newMode);
    } else if(dif > 0) {
      newMode = curMode.previous();
      ConduitDisplayMode.setDisplayMode(stack, newMode);
    }
    if(newMode != null) {
      PacketHandler.INSTANCE.sendToServer(new YetaWrenchPacketProcessor(slotSelected, newMode));
    }
  }

  private void changeConduitProbeMode(ItemStack stack) {
    int newMeta = stack.getItemDamage() == 0 ? 1 : 0;
    stack.setItemDamage(newMeta);
    PacketHandler.INSTANCE.sendToServer(new PacketConduitProbeMode());
  }

  private boolean isToolSelected(EntityClientPlayerMP player) {
    return player != null && player.getCurrentEquippedItem() != null && 
        (player.getCurrentEquippedItem().getItem() instanceof IConduitControl || player.getCurrentEquippedItem().getItem() == EnderIO.itemConduitProbe);
  }

}

package crazypants.enderio.item;

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.MouseEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.api.tool.IConduitControl;
import crazypants.enderio.conduit.ConduitDisplayMode;
import crazypants.enderio.network.PacketHandler;

@SideOnly(Side.CLIENT)
public class ToolTickHandler {

  @SubscribeEvent
  public void onMouseEvent(MouseEvent event) {
    EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
    if(event.dwheel != 0 && player != null && player.isSneaking()) {
      ItemStack stack = player.getCurrentEquippedItem();
      if (stack != null) {
        Item item = stack.getItem();
        if (item instanceof IConduitControl) {
          changeDisplayMode(stack, player, event.dwheel);
          event.setCanceled(true);
        } else if (item instanceof ItemConduitProbe) {
          changeConduitProbeMode(stack);
          event.setCanceled(true);
        }
      }
    }
  }

  private void changeDisplayMode(ItemStack stack, EntityPlayer player, int dWheel) {
    if (!((IConduitControl)stack.getItem()).showOverlay(stack, player)) {
      return;
    }
    ConduitDisplayMode mode = ConduitDisplayMode.getDisplayMode(stack);
    if(mode == null) {
      mode = ConduitDisplayMode.ALL;
    }
    mode = dWheel < 0 ? mode.next() : mode.previous();
    ConduitDisplayMode.setDisplayMode(stack, mode);
    PacketHandler.INSTANCE.sendToServer(new YetaWrenchPacketProcessor(player.inventory.currentItem, mode));
  }

  private void changeConduitProbeMode(ItemStack stack) {
    int newMeta = stack.getItemDamage() == 0 ? 1 : 0;
    stack.setItemDamage(newMeta);
    PacketHandler.INSTANCE.sendToServer(new PacketConduitProbeMode());
  }

}

Fix Mouse Wheel Handling