[Feature]: playerAnimator compatibility
MarioSMB opened this issue ยท 3 comments
What?
playerAnimator is a library which allows mods to easily add new player animations. It is most notably used by Better Combat.
Requesting compatibility with playerAnimator as currently the animations are very broken with Better Combat!
Mod experience
No response
Contributions
No response
Just wondering if there's anything that can be done to mitigate the issues between the two mods without needing full compatibility - the main problem making the mods unplayable together is that in first person mode the wolf body appears covering the screen while swinging weapons.
Maybe the code could look something like this - package com.example.werewolfcompat;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@mod("werewolfcompat")
public class WerewolfCompat {
public WerewolfCompat() {
// Register event listener only on the client side
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onRenderPlayer(RenderPlayerEvent.Pre event) {
if (isLocalPlayer(event.getEntity()) && isPlayerAnimatorInstalled()) {
event.setCanceled(true); // Prevent rendering werewolf model
}
}
private boolean isLocalPlayer(LocalPlayer player) {
return player == Minecraft.getInstance().player;
}
private boolean isPlayerAnimatorInstalled() {
try {
// Check if PlayerAnimator mod is loaded
Class.forName("com.playeranimator.Main");
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
} '