promotional bannermobile promotional banner

Mannequin Swing

This mod adds support for swing animations on mannequins.

Mannequin Swing

This mod adds support for swing animations on mannequins. It does not add any new way to cause a swing animation, such as the /swing command from the 26.1 snapshots.

Technical details

LivingEntity has a method updateSwingTime that needs to be called both on the client and on the server to allow an entity to swing its arms. However, it is only used by Players and monsters. This mod adds a call in Mannequins' aiStep function, through the technique of submixins.

@Mixin(LivingEntity.class)
public class LivingEntityMixin {
	@Shadow
	protected void updateSwingTime() {};

	@WrapMethod(method = "aiStep")
	public void overrideAiStep(Operation<Void> original) {
		original.call();
	}
}

@Mixin(Mannequin.class)
public class MannequinSubMixin extends LivingEntityMixin {
	@Override
	public void overrideAiStep(Operation<Void> original) {
		super.overrideAiStep(original);
		updateSwingTime();
	}
}

The Mannequin Swing Team

profile avatar
  • 3
    Projects
  • 309.9K
    Downloads

More from RubenVerg