package net.shadowfacts.zcraft.block.decoration;

import java.util.Random;

import net.minecraft.block.BlockRedstoneLight;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import net.shadowfacts.zcraft.block.ZBlocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockZinchoriumLight extends BlockRedstoneLight {
	
	/** Whether this lamp block is the powered version. */
    private final boolean powered;

    public BlockZinchoriumLight(boolean par1)
    {
        super(par1);
        this.powered = par1;

        if (par1)
        {
            this.setLightValue(1.0F);
        }
    }

    @Override
    /**
     * Called whenever the block is added into the world. Args: world, x, y, z
     */
    public void onBlockAdded(World par1World, int par2, int par3, int par4)
    {
        if (!par1World.isRemote)
        {
            if (this.powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
            {
                par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 4);
            }
            else if (!this.powered && par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
            {
                par1World.setBlock(par2, par3, par4, ZBlocks.greenZinchoriumLightActive.blockID, 0, 2);
            }
        }
    }

    @Override
    /**
     * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
     * their own) Args: x, y, z, neighbor blockID
     */
    public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
    {
        if (!par1World.isRemote)
        {
            if (this.powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
            {
                par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 4);
            }
            else if (!this.powered && par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
            {
                par1World.setBlock(par2, par3, par4, ZBlocks.greenZinchoriumLightActive.blockID, 0, 2);
            }
        }
    }

    @Override
    /**
     * Ticks the block if it's been scheduled
     */
    public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
    {
        if (!par1World.isRemote && this.powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
        {
            par1World.setBlock(par2, par3, par4, ZBlocks.greenZinchoriumLightIdle.blockID, 0, 2);
        }
    }
    
    @Override
    /**
     * Returns the ID of the items to drop on destruction.
     */
    public int idDropped(int par1, Random par2Random, int par3)
    {
        return ZBlocks.greenZinchoriumLightIdle.blockID;
    }

    @SideOnly(Side.CLIENT)
    @Override
    /**
     * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
     */
    public int idPicked(World par1World, int par2, int par3, int par4)
    {
        return ZBlocks.greenZinchoriumLightIdle.blockID;
    }
}

@@ -69,16 +69,50 @@
 andom;%0A%0A
+import net.minecraft.block.Block;%0A
 import n
@@ -196,16 +196,82 @@
 terial;%0A
+import net.minecraft.init.Blocks;%0Aimport net.minecraft.item.Item;%0A
 import n
@@ -737,13 +737,13 @@
 ight
-Value
+Level
 (1.0
@@ -1169,32 +1169,24 @@
 , par4, this
-.blockID
 , 4);%0A      
@@ -1389,32 +1389,24 @@
 mLightActive
-.blockID
 , 0, 2);%0A   
@@ -1723,16 +1723,23 @@
 r4, 
-int par5
+Block par5Block
 )%0A  
@@ -1961,24 +1961,16 @@
 r4, this
-.blockID
 , 4);%0A  
@@ -2181,24 +2181,16 @@
 htActive
-.blockID
 , 0, 2);
@@ -2600,24 +2600,16 @@
 ightIdle
-.blockID
 , 0, 2);
@@ -2652,96 +2652,27 @@
     
-/**%0A     * Returns the ID of the items to drop on destruction.%0A     */%0A    public int id
+public Item getItem
 Drop
@@ -2713,38 +2713,53 @@
 nt par3)
-%0A   
  %7B%0A    
-    
+%09
 return 
+Item.getItemFromBlock(
 ZBlocks.
@@ -2782,32 +2782,25 @@
 ightIdle
-.blockID
+)
 ;%0A    %7D%0A
 %0A    @Si
@@ -2787,24 +2787,28 @@
 dle);%0A    %7D%0A
+    
 %0A    @SideOn
@@ -2845,153 +2845,27 @@
     
-/**%0A     * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)%0A     */%0A    public int idPicked
+public Item getItem
 (Wor
@@ -2929,16 +2929,38 @@
  return 
+Item.getItemFromBlock(
 ZBlocks.
@@ -2987,16 +2987,9 @@
 Idle
-.blockID
+)
 ;%0A  

Update BlockZinchoriumLight for 1.7.10