function MyEntity:on_punch(hitter, time_from_last_punch, tool_capabilities, dir, damage)
    local hitter_name = hitter:get_player_name()
    local hitter_pos = hitter:get_pos()
    local object_pos = self.object:get_pos()
    local face_dir = minetest.dir_to_facedir(dir)

    if not ( face_dir == 0 or face_dir == 2 ) then
        minetest.chat_send_player(hitter_name, ("face %d is not valid use one for the numbered/colored faces!"):format(face_dir))
        return true
    end    

    local ray = minetest.raycast(object_pos, hitter_pos, true, true)
    local pointed_thing = ray:next()
    pointed_thing = ray:next()

    while pointed_thing do
        minetest.log(dump(pointed_thing))
        local ip_pos = pointed_thing.intersection_point

        local number = -1

        local face_pos = minetest.pointed_thing_to_face_pos(hitter, {
            above = vector.add(object_pos, pointed_thing.intersection_normal),
            under = object_pos
        })
    
        minetest.log(dump(face_pos))
    
        self.last_run = self.last_run + 1
        local adjusted_pos = vector.subtract(object_pos, face_pos)
        local number = -1

        local updown = adjusted_pos.z
        local leftright = adjusted_pos.x
        local cutoff = 0.15
        local cutoff_n = cutoff * (-1)

        local diff_to_prev = vector.subtract(adjusted_pos, self.previous_punch_facepos)

        if face_dir == 0 or face_dir == 2 then
            updown = adjusted_pos.y
            leftright = adjusted_pos.x          
        end

        if face_dir == 2 then
            leftright = leftright * (-1)
        end
    
        if(leftright > cutoff and updown < cutoff_n) then
            number = 1
        elseif(leftright < cutoff and leftright > cutoff_n and  updown < cutoff_n) then
            number = 2        
        elseif(leftright < cutoff_n and updown < cutoff_n) then
            number = 3
        elseif(leftright > cutoff and updown < cutoff and updown > cutoff_n) then
            number = 4
        elseif(leftright < cutoff and leftright > cutoff_n and updown < cutoff and updown > cutoff_n) then
            number = 5        
        elseif(leftright < cutoff_n and updown < cutoff and updown > cutoff_n) then
            number = 6
        elseif(leftright > cutoff and updown > cutoff) then
            number = 7
        elseif(leftright < cutoff and leftright > cutoff_n and updown > cutoff) then
            number = 8        
        elseif(leftright < cutoff_n and updown > cutoff) then
            number = 9
        end
    
        local msg = ("%s %d dir %d hpos %s opos %s fpos %s norm %s diff %s number: %d"):format(hitter_name, self.last_run, face_dir, minetest.pos_to_string(hitter_pos, 3), minetest.pos_to_string(object_pos, 4), minetest.pos_to_string(face_pos, 4), minetest.pos_to_string(adjusted_pos, 4), minetest.pos_to_string(diff_to_prev, 4), number)
        minetest.chat_send_player(hitter_name, msg)
        minetest.log(msg)
    
        self.previous_punch_facepos = adjusted_pos

        self:flipnumber(number)
        self:set_number_texture()

        pointed_thing = ray:next()
    end

    return true
end