minecraft:not_pickable_from_inside for you with a switch.Get GodCraftOverview
minecraft:not_pickable_from_inside is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Stops players who are inside this entity's hitbox from targeting or hitting it by looking at it.
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:not_pickable_from_inside": {}
}