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

Add instant effect potion break to the Effect enum

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • git-Spigot-2f5d615-d07a78b
    • Yes

      Contextualization

      Since the addition of custom potion colors (1.11), the client now receives an integer-encoded RGB color as extra data for the potion break effect, instead of the old potion id.

      The old potion id system mapped every potion effect combination (type, level etc.) to single id, but limited the colors available to only the existing ones.

      The new system allows for a wider range of colors, but doesn't carry any extra information. While this may not seem like a problem, it makes it impossible for the client to differentiate between normal and instant effects. Normal effects have a swirly-like pattern (left), while instant ones are cross-shaped (right), as shown in the figure below.

      The old potion id allowed this differentiation because certain effects types were explicitly instant (Instant Health, Instant Damage), and the client would render the correct particles.

      Due to that, two different effects are now implemented on the client: one for the break of normal potion type effects (the current Effect.POTION_BREAK, id 2002), and one for instant potion type effects (id 2007).

      Problem

      There's currently no enum entry on Effect corresponding to the break of potions with instant potion effects, making it impossible to play the Effect using the API.

      Solution

      Implement the appropriate enum entry.

      Additional concerns

      The current entry for normal potion break effects, Effect.POTION_BREAK, utilizes data from a deprecated API class, Potion. It utilizes a method from this class that used to calculate its corresponding potion id, but not only it no longer functions, the client no longer uses the potion ids. Due to this, some questions arise:

      1. Should this new enum entry be also dependent on Potion, or should it use the preferred PotionMeta (or even a Color)?
      2. What should be done with Effect.POTION_BREAK? Will it keep using the deprecated class, or will it also be changed to reflect on the addition of the new enum entry?
      3. Should Effect.POTION_BREAK be marked as deprecated and left with its data type, and two new entries with the correct ones be created?

            Unassigned Unassigned
            WinX64 Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: