Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Trident doesn't respect AbstractArrow

Open Proximyst opened this issue 6 years ago • 9 comments

What behaviour is expected:

The trident to do no damage.

What behaviour is observed:

Trident completely ignored all of the properties.

Steps/models to reproduce:

Listen to ProjectileHitEvent (send a message or something to make sure you know it's listened to), then something along the lines of the following Kotlin snippet

        val projectile = event.entity
// code...
        if (projectile is AbstractArrow) {
            if (projectile is Arrow) {
                projectile.clearCustomEffects()
            }
            projectile.fireTicks = 0 // not known if ignored
            projectile.knockbackStrength = 0 // ignored
            projectile.damage = 0.0 // ignored
            projectile.isCritical = false // not known if ignored
            projectile.pierceLevel = 0 // not known if ignored
        }

        if (main.config.pvpMessage) {
            val msg = when {
                damagerState -> main.messages.pvpNoPvpTarget
                damagedState -> main.messages.pvpNoPvpHitter
                else -> main.messages.pvpNoPvpHitter
            }
            shooter.sendMessage(
                msg.process("target" to damaged)
                    .colour()
            )
        }

Plugin list:

Only a plugin doing this. The project isn't touched in any other way.

Paper build number:

https://owo.whats-th.is/2wJBwV6.png

Proximyst avatar Sep 06 '19 14:09 Proximyst

According to the code, all of those values are ignored. This is because a Trident does not act like an arrow at all when it hits an entity. A trident cannot be on fire so fireTicks does not make any sense. Tridents cannot have knock back enchantment so they are unable to do any knockback. The damage value is hardcoded to 8 and tridents are unable to cause critical hits. And finally Tridents cannot pierce, which also does not make much sense but is less farfetched than a flaming trident since it doesn't need any fire animation.

Most of this can be changed but I'm wondering if you only need to be able to change the damage.

kickash32 avatar Oct 09 '19 21:10 kickash32

@kickash32 Ideally, it'd just respect that I cancel the entire event altogether, and simply do not touch the player it hits (I forgot to include that part in the snippet it seems). If it has to be that way, I'm entirely fine with it not damaging the player and still applying knockback, however it would be ideal if it didn't do either.

Proximyst avatar Oct 10 '19 14:10 Proximyst

Have you tried cancelling the ProjectileCollideEvent? This event should be called before the ProjectileHitEvent and it should be cancellable.

kickash32 avatar Oct 10 '19 18:10 kickash32

That works fine, thank you @kickash32 :)

Proximyst avatar Oct 19 '19 09:10 Proximyst

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 02 '20 21:12 stale[bot]

Stale who? Stale you! Zim-zalabim, unstale! ✨✨

Sidenote, this issue is a blast from the past indeed.

Proximyst avatar Dec 02 '20 21:12 Proximyst

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 31 '21 22:01 stale[bot]

This issue has been automatically closed because it has not had activity in a long time. If the issue still applies to the most recent supported version, please open a new issue referencing this original issue.

stale[bot] avatar Feb 07 '21 23:02 stale[bot]

So this is more of a feature request, Trident's don't use the same logic as all the other AbstractArrows, so they'd have to be adjusted to use them in different places. And then ofc the impl of each of AbstractArrow's methods would be different for tridents

Machine-Maker avatar Jan 14 '22 09:01 Machine-Maker