package rblocks.transformer.template;

import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import rblocks.api.IRBMethods;
import rblocks.client.render.RBBlockRender;
import rblocks.core.RotationLogic;
import rblocks.transformer.annotations.RBClientMethod;
import rblocks.transformer.annotations.RBCoreCopy;

public abstract class BlockChange extends Block implements ITileEntityProvider, IRBMethods
{

	Boolean rotatableBlockSupport;

	@RBCoreCopy
	@Override
	public Boolean isRotableBlockSupported()
	{
		return rotatableBlockSupport;
	}

	@RBCoreCopy
	@Override
	public boolean setRotableBlockSupported(boolean supported)
	{
		rotatableBlockSupport = supported;
		return supported;
	}

	@Override
	@RBCoreCopy
	/**
	 * Gets appended to the top of the default method.
	 */
	public boolean hasTileEntity(int metadata)
	{
		if ( RotationLogic.instance.getEnableTile( (Block) (Object) this ) )
			return true;

		// Final return is removed.
		return false;
	}

	@RBClientMethod
	@Override
	@RBCoreCopy
	/**
	 * Gets appended to the top of the default method.
	 */
	public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s)
	{
		IIcon ico = RotationLogic.instance.getIcon( (Block) (Object) this, w, x, y, z, s );
		if ( ico != null )
			return ico;

		// Final return is removed.
		return null;
	}

	@Override
	@RBCoreCopy
	/**
	 * Gets appended to the top of the default method.
	 */
	public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis)
	{
		if ( RotationLogic.instance.isSupported( (Object) this ) )
			return RotationLogic.instance.useOrConvert( worldObj, x, y, z, axis );

		// Final return is removed.
		return false;
	}

	@Override
	@RBCoreCopy
	/**
	 * New method to overwrite renderer in render blocks.
	 */
	public int getRealRenderType()
	{
		if ( RotationLogic.instance.isSupported( (Object) this ) )
			return RBBlockRender.instance.getRenderId();

		return getRenderType();
	}

	// ignored.
	protected BlockChange(Material p_i45394_1_) {
		super( p_i45394_1_ );
	}

}

@@ -1186,24 +1186,274 @@
  false;%0A%09%7D%0A%0A
+%09@Override%0A%09@RBCoreCopy%0A%09/**%0A%09 * Gets appended to the top of the default method.%0A%09 */%0A%09protected boolean canSilkHarvest()%0A%09%7B%0A%09%09if ( RotationLogic.instance.getEnableTile( (Block) (Object) this ) )%0A%09%09%09return renderAsNormalBlock();%0A%0A%09%09return false;%0A%09%7D%0A%0A
 %09@RBClientMe

Fix Silk Touch.