package nuclearcontrol;

import forge.ITextureProvider;
import ic2.api.ElectricItem;
import net.minecraft.server.EntityHuman;
import net.minecraft.server.Item;
import net.minecraft.server.ItemStack;
import net.minecraft.server.TileEntity;
import net.minecraft.server.World;
import net.minecraft.server.mod_IC2NuclearControl;

public class ItemToolThermometer extends Item implements ITextureProvider
{
    public ThermometerVersion thermometerVersion;

    public ItemToolThermometer(int var1, int var2, ThermometerVersion var3)
    {
        super(var1);
        this.d(var2);
        this.setMaxDurability(102);
        this.e(1);
        this.thermometerVersion = var3;
    }

    public boolean canTakeDamage(ItemStack var1, int var2)
    {
        return true;
    }

    public String getTextureFile()
    {
        return "/img/texture_thermo.png";
    }

    public boolean onItemUseFirst(ItemStack var1, EntityHuman var2, World var3, int var4, int var5, int var6, int var7)
    {
        if (!this.canTakeDamage(var1, 2))
        {
            return false;
        }
        else
        {
            TileEntity var8 = NuclearHelper.getReactorAt(var3, var4, var5, var6);

            if (var8 == null)
            {
                TileEntity var9 = NuclearHelper.getReactorChamberAt(var3, var4, var5, var6);

                if (var9 != null)
                {
                    var8 = NuclearHelper.getReactorAroundCoord(var3, var4, var5, var6);
                }
            }

            if (var8 != null)
            {
                if (!var3.isStatic)
                {
                    this.messagePlayer(var2, var8);
                    this.damage(var1, 1, var2);
                }

                return true;
            }
            else
            {
                return false;
            }
        }
    }

    public void messagePlayer(EntityHuman var1, TileEntity var2)
    {
        int var3 = NuclearHelper.getReactorHeat(var2);

        switch (thermometerVersion)
        {
            case ANALOG:
                mod_IC2NuclearControl.chatMessage(var1, "ic2:nc:c7518eb6:Thermo:" + var3);
                break;

            case DIGITAL:
                int var4 = NuclearHelper.getMaxHeat(var2);
                mod_IC2NuclearControl.chatMessage(var1, "ic2:nc:c7518eb6:ThermoDigital:" + var3 + ":" + var4 * 50 / 100 + ":" + var4 * 85 / 100);
        }
    }

    public void damage(ItemStack var1, int var2, EntityHuman var3)
    {
        switch (thermometerVersion)
        {
            case ANALOG:
                var1.damage(10, var3);
                break;

            case DIGITAL:
                ElectricItem.use(var1, 50 * var2, var3);
        }
    }
}

@@ -74,24 +74,81 @@
 ectricItem;%0A
+import ic2.api.IReactor;%0Aimport ic2.api.IReactorChamber;%0A
 import net.m
@@ -253,48 +253,8 @@
 ck;%0A
-import net.minecraft.server.TileEntity;%0A
 impo
@@ -1118,34 +1118,32 @@
             
-TileEntity
+IReactor
  var8 = Nucl
@@ -1251,26 +1251,31 @@
         
-TileEntity
+IReactorChamber
  var9 = 
@@ -1417,66 +1417,24 @@
 8 = 
-NuclearHelper.getReactorAroundCoord(var3, var4, var5, var6
+var9.getReactor(
 );%0A 
@@ -1869,18 +1869,16 @@
 r1, 
-TileEntity
+IReactor
  var
@@ -1909,41 +1909,21 @@
 3 = 
-NuclearHelper.getReactor
+var2.get
 Heat(
-var2
 );%0A%0A
@@ -2161,29 +2161,20 @@
  var4 = 
-NuclearHelper
+var2
 .getMaxH
@@ -2177,20 +2177,16 @@
 MaxHeat(
-var2
 );%0A     

Update ItemToolThermometer to clean 1.1.11