In the three hours I had today between waking up after oversleeping and going to church, I did some more things in the Wither-taming mod which has yet to be named. (Internally, it's named "WitherWand" but that was the first thing I thought of when I needed a package ID, it will probably not be kept.) I did a lot of looking at the wolf class and some investigation of the AI task system to see how "actions" are assigned to entities and triggered.
I applied my trick of copy/pasting entire source files on a few AI classes (specifically FollowOwner, OwnerHurtByTarget, and OwnerHurtTarget) and then changing the types to work with my Wither class. Those AI tasks have been registered in my class, causing an owned Wither to follow (and teleport to, if necessary) its owner. In addition, the Wither will give attack priority to first entities that attack the owner, then entities that the owner attacks, then entities that attack the Wither, and finally whatever entities it finds around the world and decides to destroy.
There's one bug with this arrangement: as the Wither goes around attacking whatever it wants, it may leave the player's ownership range, causing it to teleport back, but then it continues trying to attack the entity. This results in a strange rubber-band effect. I will eventually fix this when the owner is allowed to give the Wither instructions (in this case, to not destroy everything).
No comments:
Post a Comment