Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5553

Ability to get the velocity added to the entity in EntityDamageEvent

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • git-Spigot-037559e-5c6b0dc (MC: 1.15.1) (Implementing API version 1.15.1-R0.1-SNAPSHOT)
    • Yes

      A suggested method for EntityDamageEvent:
      getAddedVelocity(): Vector

      This represents the velocity that was added to the victim's velocity when they were damaged.

      I suggest this method since I am working on a plugin that involves consistently multiplying the knock-back that one player does to another. I want to multiply the knock-back because:

      • The player will have a power-level
      • They can have various weapons that contribute to the knock-back
      • The victim can have an attribute modifier that reduces their knock-back

      If John acquires a Knockback-2 sword and his "power level" multiplies his abilities by 10, his power level will enhance the knock-back energy delivered by the sword by ten-times. It will not add. This is why it can sometimes be important to know how much velocity is added to the entity when it is damaged.

      I am unsure as to how this can apply to EntityDamageEvent aside from EntityDamageByEntityEvent. I have tried to think about cases where anything that isn't an entity can knock an entity back by damaging it, but I don't seem to recall any. Damage sources such as lava, magma blocks, sweet berry bushes, etc will just return 0 for this method? Maybe in the future these causes might contribute knockback for some reason.

            Unassigned Unassigned
            Perzan Perzan
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: