Examples - ZigyTheBird/ZigysPlayerAnimatorAPI GitHub Wiki
Java
public static final ResourceLocation wave = new ResourceLocation("playeranimatorapi", "wave");
public static void example(ServerLevel level, Player player) { PlayerAnimAPI.playPlayerAnim(level, player, wave); }
Command
/playPlayerAnimation @p playeranimatorapi:wave
You can see vanilla animations apply to the left arm!
Java
public static final ResourceLocation wave = new ResourceLocation("playeranimatorapi", "wave"); public static final PlayerParts partsWithoutLeftArm() { PlayerParts part = new PlayerParts(); part.leftArm.setEnabled(false); return part; }
public static void example(ServerLevel level, Player player) { PlayerAnimAPI.playPlayerAnim(level, player, wave, partsWithoutLeftArm(), null, -1); }
Command
/playPlayerAnimation @p playeranimatorapi:wave -1 -1 -1 false "axq5j8jrytibv8jj" null
Java
public static final ResourceLocation wave = new ResourceLocation("playeranimatorapi", "wave"); public static final PlayerParts partsInsisible() { PlayerParts part = new PlayerParts(); part.leftArm.isVisible(false); return part; }
public static void example(ServerLevel level, Player player) { PlayerAnimAPI.playPlayerAnim(level, player, wave, partsInvisible(), null, -1); }
Command
/playPlayerAnimation @p playeranimatorapi:wave -1 -1 -1 false "axq5j8k4d6a163gf" null
You can see the wave animation now applies to the right arm instead of the left arm.
Java
public static final ResourceLocation wave = new ResourceLocation("playeranimatorapi", "wave"); public static final ResourceLocation MIRROR = new ResourceLocation("player-animator", "mirror"); public static final List MODIFIERS = new ArrayList<>(){{add(new CommonModifier(MIRROR, null));}};
public static void example(ServerLevel level, Player player) { PlayerAnimAPI.playPlayerAnim(level, player, wave, null, MODIFIERS, -1); }
Command
/playPlayerAnimation @p playeranimatorapi:wave -1 -1 -1 false null "player-animator:mirror"
This one contains two examples to see both the rotation and the movement of the camera affected.
Java
public static final ResourceLocation posboundtest = new ResourceLocation("playeranimatorapi", "posboundtest"); public static final ResourceLocation geckoaxischecky = new ResourceLocation("playeranimatorapi", "geckoaxischecky"); public static final ResourceLocation HEADPOSBOUNDCAMERA = new ResourceLocation("playeranimatorAPI", "headposboundcamera"); public static final ResourceLocation HEADROTBOUNDCAMERA = new ResourceLocation("playeranimatorAPI", "headrotboundcamera"); public static final List MODIFIERS = new ArrayList<>(){{add(new CommonModifier(HEADPOSBOUNDCAMERA, null)); add(new CommonModifier(HEADROTBOUNDCAMERA, null));}};
public static void example(ServerLevel level, Player player) { PlayerAnimAPI.playPlayerAnim(level, player, posboundtest, null, MODIFIERS, -1); }public static void example2(ServerLevel level, Player player) { PlayerAnimAPI.playPlayerAnim(level, player, geckoaxischecky, null, MODIFIERS, -1); }
Command
/playPlayerAnimation @p playeranimatorapi:posboundtest -1 -1 -1 false null "playeranimatorapi:headrotboundcamera;playeranimatorapi:headposboundcamera" /playPlayerAnimation @p playeranimatorapi:geckoaxischecky -1 -1 -1 false null "playeranimatorapi:headrotboundcamera;playeranimatorapi:headposboundcamera"