package JAKJ . RedstoneInMotion ;

public class CarriageDecorationRecipe extends Recipe
{
	@Override
	public Stack Process ( StackList Stacks )
	{
		Stack Carriage = null ;

		Stack Decoration = null ;

		for ( Stack Stack : Stacks )
		{
			if ( Stack . GetId ( ) == Blocks . Carriage . GetId ( ) )
			{
				if ( Carriage != null )
				{
					return ( null ) ;
				}

				Carriage = Stack ;

				continue ;
			}

			if ( Decoration != null )
			{
				return ( null ) ;
			}

			Decoration = Stack ;
		}

		if ( Carriage == null )
		{
			return ( null ) ;
		}

		if ( ! Carriage . HasTag ( ) )
		{
			if ( Decoration == null )
			{
				return ( null ) ;
			}

			net . minecraft . item . Item Item = Decoration . Stack . getItem ( ) ;

			if ( ! ( Item instanceof net . minecraft . item . ItemBlock ) )
			{
				return ( null ) ;
			}

			Stack DecorationTest = new Stack ( Item , Item . getMetadata ( Decoration . GetDamage ( ) ) ) ;

			Carriage = new Stack ( Blocks . Carriage , Carriage . GetDamage ( ) ) ;

			Carriage . AddTag ( ) ;

			Carriage . SetStack ( "Decoration" , DecorationTest ) ;

			return ( Carriage ) ;
		}

		if ( Decoration != null )
		{
			return ( null ) ;
		}

		return ( new Stack ( Blocks . Carriage , Carriage . GetDamage ( ) ) ) ;
	}
}
