local dye_table = dye.dyes

for i in ipairs(dye_table) do
   local name = dye_table[i][1]
   local desc = dye_table[i][2]
   local hex = dye_table[i][3]

   minetest.register_node('furniture:bed1_'..name, {
      _doc_items_crafting = 'This is crafted in the Woodworking Station.',
      description = 'Bed with '..desc..' Blankets',
      drawtype = 'mesh',
      mesh = 'furniture_bed1.obj',
      tiles = {'furniture_bed1_wood.png', 'furniture_bed1_sheets.png'},
      overlay_tiles = {{name = '(furniture_bed1_sheets.png^[multiply:'..hex..')^furniture_bed1_mask.png', color = 'white'}},
      paramtype = 'light',
      paramtype2 = 'colorfacedir',
      palette = 'furniture_stain_palette.png',
      selection_box = {
         type = 'fixed',
         fixed = {{-.5, -.5, -.5, .5, 0, 1.5},
                  {-.5, 0, 1.35, .5, .5, 1.5}}
               },
      collision_box = {
         type = 'fixed',
         fixed = {{-.5, -.5, -.5, .5, 0, 1.5},
                  {-.5, 0, 1.35, .5, .5, 1.5}}
               },
      groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
      after_place_node = function(pos, placer, itemstack)
         if not epic.space_to_front(pos) then
            minetest.remove_node(pos)
            return itemstack
         end
      end,
      after_dig_node = function(pos, oldnode)
         epic.remove_front_node(pos, oldnode)
      end,
      on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
         beds.on_rightclick(pos, clicker)
         return itemstack
      end,
      on_rotate = function(pos, node)
         return false
      end,
   })

end
