bradsk88 Posted July 19, 2024 Posted July 19, 2024 (edited) I have a mob that uses the HumanoidMobRenderer. It is meant to look like another player. public class VisitorMobRenderer extends HumanoidMobRenderer<VisitorMobEntity, PlayerModel<VisitorMobEntity>> { I have basically no custom rendering code. Just some logic for loading custom skins. https://github.com/bradsk88/Questown/blob/0d913c9bf06bb6b2de981717d2a38e182d9669ca/src/main/java/ca/bradj/questown/mobs/visitor/VisitorMobRenderer.java#L14 I've tried to call the "swing" method from the server side, which should publish a message to the client side. But I'm not seeing any animation. ((LivingEntity)mcExtra.entity()).swing(InteractionHand.MAIN_HAND); https://github.com/bradsk88/Questown/blob/0770d0d161a92d69f0749832552671b781360a64/src/main/java/ca/bradj/questown/jobs/declarative/RealtimeWorldInteraction.java#L284 Any suggestions to get my mob's arm swinging? Edited May 8 by bradsk88 Quote
bradsk88 Posted February 18 Author Posted February 18 (edited) Bumping this. I've tried to solve it a few times, but I can't find anything that works Edited May 8 by bradsk88 Quote
WipoDev Posted May 7 Posted May 7 I managed to do it by overriding the "doHurtTarget" method. @Override public boolean doHurtTarget(Entity target) { this.swing(InteractionHand.MAIN_HAND); return super.doHurtTarget(target); } Quote
bradsk88 Posted May 8 Author Posted May 8 (edited) Finally solved this after looking a bit closer at the `Monster` class. I needed to override the `aiStep` method, adding a call to `updateSwingTime`. This makes `entity.swing()` trigger an animation. @Override public void aiStep() { this.updateSwingTime(); super.aiStep(); } Edited May 8 by bradsk88 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.