Many people get confused on whether to use which or that in a sentence. There is a handy rule you can use to get it right.
If the sentence doesn’t need the clause that the word in question is connecting, use which. If it does, use that. The below may illustrate this a little better.
Our spaceship, which has two cargo bays, is located near Mars.
Our spaceship that has two cargo bays is located near Mars.
These sentences are not the same. The first sentence tells us you have just one spaceship, and it’s located near Mars. The clause which has two cargo bays gives us additional information, but it doesn’t change the meaning of the sentence. Remove the clause and the location of our one spaceship would still be clear : Our spaceship is located near Mars.
The second sentence suggests that we have multiple spaceship, but the spaceship with two cargo bays is located near Mars. That phrase that has two cargo bays is known as a restrictive clause because another part of the sentence (our spaceship) depends on it. You cannot remove that clause without changing the meaning of the sentence.