Hello everyone!
I have the following code snippet that's supposed to make a "robot" called _scriptedEntity in-game turn to face a given Entity called "entity" and attack the entity if the _scriptedEntity is within range.. I can not for the life of me how ever understand what .swingarm is supposed to do? my thought was that I could use the method to achieve the swinging arm animation of _scriptedEntity.. how ever I don't understand what actual parameters .swingarm is supposed to have and why?
_scriptedEntity extends entityCreature
tl:dr;
How do I animate _scriptedEntity to swing his arm?
@Override
public void attack(Entity entity){
//turn and face entity
this._scriptedEntity.faceEntity(entity,360.0f,360.0f);
//attack target
if (this.getDistanceTo(entity) <3.0) {
//swing animation.... wait wat?
this._scriptedEntity.swingArm();
//give damage
entity.getWrappedEntity().attackEntityFrom(DamageSource.GENERIC, 1.0f);
}
}