SmushyTaco / Neutral-Animals

This mod makes chickens, cows, pigs, rabbits, sheep, and villagers fight back!
GNU Lesser General Public License v3.0
4 stars 1 forks source link

Actually fixed it this time #4

Closed CleverNucleus closed 2 years ago

CleverNucleus commented 2 years ago

Rather than inserting the damage attribute the first time LivingEntity#getAttributes is called, we insert it when the entity is first constructed. This is a safer and faster solution: the logic to determine whether we insert attack damage or not is performed only once when the entity is constructed, instead of every time we want to get the entity's attributes. More importantly, this should actually fix the compatibility issue between DataAttributes and Neutral Animals (sorry about that!).

Additionally, this implementation gives you more opportunities to be specific or abstract about what entities get to be a neutral mob further down the line by giving you native access to the entity's EntityType; lots of potential for greater control/configurability in the future if needed/wanted.