diff --git a/src/main/java/elocindev/deathknights/mixin/client/animation/AnimationSpeedPatcherMixin.java b/src/main/java/elocindev/deathknights/mixin/client/animation/AnimationSpeedPatcherMixin.java index a837a41..86ea8a5 100644 --- a/src/main/java/elocindev/deathknights/mixin/client/animation/AnimationSpeedPatcherMixin.java +++ b/src/main/java/elocindev/deathknights/mixin/client/animation/AnimationSpeedPatcherMixin.java @@ -5,15 +5,16 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable; import com.bawnorton.mixinsquared.TargetHandler; +import com.llamalad7.mixinextras.sugar.Local; import dev.kosmx.playerAnim.core.data.KeyframeAnimation; import elocindev.deathknights.DeathKnights; import elocindev.deathknights.config.Configs; import net.bettercombat.BetterCombat; import net.minecraft.client.network.AbstractClientPlayerEntity; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.player.PlayerEntity; import net.spell_engine.client.animation.AnimationRegistry; -import net.spell_engine.internals.casting.SpellCasterEntity; @Mixin(value = AbstractClientPlayerEntity.class, priority = 1500) public class AnimationSpeedPatcherMixin { @@ -22,34 +23,25 @@ public class AnimationSpeedPatcherMixin { name = "playSpellAnimation" ) @ModifyVariable(method = "@MixinSquared:Handler", at = @At("HEAD"), ordinal = 0) - private float death_knights$updateSpellCastAnimationsOnTick(float speed) { - PlayerEntity player = (PlayerEntity)(Object)this; - - var spellCaster = ((SpellCasterEntity) player); - var spell = spellCaster.getCurrentSpell(); if (spell == null) return speed; - - if (shouldPatchAnimation(spell.release.animation)) - if (DeathKnights.BETTERCOMBAT_ENABLED) { - KeyframeAnimation animation = (KeyframeAnimation)AnimationRegistry.animations.get(spell.release.animation); - - float syncedSpeed = (float) animation.endTick / (animation.getLength()); - float upswingSpeed = syncedSpeed / BetterCombat.config.getUpswingMultiplier(); - - return upswingSpeed; - } - else - return 3f; + private float death_knights$playSpellAnimation(float speed, @Local String animation) { + AbstractClientPlayerEntity player = (AbstractClientPlayerEntity) (Object) this; - return speed; - } - - public boolean shouldPatchAnimation(String animationid) { for (String anim : Configs.Client.CONFIG.patched_animations) { - if (animationid.equals(anim)) { - return true; + if (animation != null && animation.equals(anim)) { + if (DeathKnights.BETTERCOMBAT_ENABLED && Configs.Client.CONFIG.enable_bettercombat_compatibility) { + KeyframeAnimation kfAnim = (KeyframeAnimation)AnimationRegistry.animations.get(animation); + + float syncedSpeed = (float) kfAnim.endTick / (kfAnim.getLength()); + float upswingSpeed = syncedSpeed / BetterCombat.config.getUpswingMultiplier(); + + float atkSpeed = (float) ((PlayerEntity) player).getAttributeValue(EntityAttributes.GENERIC_ATTACK_SPEED); + + return upswingSpeed + atkSpeed; + } + else return 3f; } } - - return false; + + return speed; } } diff --git a/src/main/resources/data/death_knights/spells/agonizing_breath.json b/src/main/resources/data/death_knights/spells/agonizing_breath.json index 34ee2e8..cd50a7f 100644 --- a/src/main/resources/data/death_knights/spells/agonizing_breath.json +++ b/src/main/resources/data/death_knights/spells/agonizing_breath.json @@ -7,10 +7,6 @@ }, "cast": { "duration": 0.0, - "sound": { - "id": "simplyswords:elemental_sword_ice_attack_03", - "randomness": 0 - }, "particles": [ { "particle_id": "spell_engine:frost_spell", @@ -27,7 +23,8 @@ "type": "SELF" }, "sound": { - "id": "simplyswords:elemental_sword_ice_attack_03" + "id": "spell_engine:generic_frost_release", + "pitch": 1.2 }, "particles": [ { diff --git a/src/main/resources/data/death_knights/spells/obliterate.json b/src/main/resources/data/death_knights/spells/obliterate.json index c8463c7..300b2ac 100644 --- a/src/main/resources/data/death_knights/spells/obliterate.json +++ b/src/main/resources/data/death_knights/spells/obliterate.json @@ -5,8 +5,7 @@ "tier": 0 }, "cast": { - "duration": 0.0, - "animation": "spell_engine:one_handed_area_charge" + "duration": 0.0 }, "release": { "target": {