PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.7k stars 2.27k forks source link

Trident doesn't respect AbstractArrow #2541

Open Proximyst opened 5 years ago

Proximyst commented 5 years ago

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

kickash32 commented 4 years ago

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.

Proximyst commented 4 years ago

@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.

kickash32 commented 4 years ago

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

Proximyst commented 4 years ago

That works fine, thank you @kickash32 :)

stale[bot] commented 3 years ago

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.

Proximyst commented 3 years ago

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

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

stale[bot] commented 3 years ago

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] commented 3 years ago

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.

Machine-Maker commented 2 years ago

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