HomeJavaModsMannequin Swing

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();
	}
}
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more