Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug|Crash]: BYPASS_DODGE attack trigger DodgeLeft onDodgeSuccess #1924

Open
4 tasks done
PraiseSuffering opened this issue Feb 18, 2025 · 0 comments
Open
4 tasks done

Comments

@PraiseSuffering
Copy link

Please check if a similar issue has already been reported.

  • I checked this type of issue has never been reported.

Please check you're using proper versions.

  • I checked all of them in the right version.

Please check if this issue's from out of our area

  • I understood the problem.

The name of the mod

No response

After all of these, please check if you're just pressing the ok buttons to skip this process.

  • I read the checklist and I promise I'll provide all the information that is needed to fix the issue

Minecraft Version

1.20.1

The Issue

onDodgeSuccess can be triggered by DodgeLeft, BYPASS_DODGE attack

Because DodgeLeft Hurt () is not running LivingAttackEvent, DamageSource not be replaced

I think this can be fixed:

public boolean hurt(DamageSource damageSourceSource, float amount) {
if (this.level().isClientSide()) {
return false;
}

    Entity attacker=damageSourceSource.getEntity();
    DamageSource damageSource = null;

    LivingEntityPatch<?> attackerPatch = EpicFightCapabilities.getEntityPatch(attacker, LivingEntityPatch.class);

    if (damageSourceSource instanceof EpicFightDamageSource efDamageSource) {
        damageSource = efDamageSource;
    } else if (damageSourceSource.isIndirect() && damageSourceSource.getDirectEntity() != null) {
        ProjectilePatch<?> projectilepatch = EpicFightCapabilities.getEntityPatch(damageSourceSource.getDirectEntity(), ProjectilePatch.class);

        if (projectilepatch != null) {
            damageSource = projectilepatch.getEpicFightDamageSource(damageSourceSource);
        }
    } else if (attackerPatch != null && attackerPatch.getEpicFightDamageSource() != null) {
        damageSource = attackerPatch.getEpicFightDamageSource();
    }

    if (damageSource == null) {
        damageSource = damageSourceSource;
    }



    if (!DodgeAnimation.DODGEABLE_SOURCE_VALIDATOR.apply(damageSource).dealtDamage()) {
        this.entitypatch.onDodgeSuccess(damageSource);
    }

    this.discard();
    return false;
}

Steps to Reproduce

onDodgeSuccess can be triggered by DodgeLeft, BYPASS_DODGE attack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant