Checking if entity is in player's screen

i've already made a post once about this and i did get my answer, but i need help modifying this.


this works 100% perfectly, i just want to know how could i make this stop working if there are blocks inbetween me and the pig?

Continue to help post