seymourimadeit / Big-Brain

Improved AI for various mobs!
Other
3 stars 4 forks source link

Allows ranged mobs to use modded versions of their ranged weapons #17

Closed Thelnfamous1 closed 3 years ago

Thelnfamous1 commented 3 years ago

Adds 1 mixin for ProjectileHelper and an additional injection (w/ shadow method) to LivingEntity.

Bow/Crossbow-using mobs use ProjectileHelper.getHandWith(Item) and LivingEntity.canEquip(Item), which isn't ideal if you want them to use a modded ranged weapon. This PR converts those hardcoded item checks into checking if an item is assignable from the class of the item passed in, serving as the equivalent of an instanceof check.

Forge already added field-to-instanceof transformers for the various other hardcoded item checks as needed so these are the only two changes required.

I also plan to submit a PR that adds the equivalent of this to Forge, so use this Mixin as a temporary fix until it possibly gets merged.