Piglin attacks those who don't have any gold equipment. When you break a gold ore or kill another pig, it provokes them to attack you. In Minecraft Legend you are not only attacked by other players but also by Piglin.