Interface MobEffectDefinition


@NonExtendable public interface MobEffectDefinition
An effect a plugin adds to the game, created by MobEffectRegistry.define(TypedKey).

minecraft:mob_effect is baked into the client: a vanilla client only knows the vanilla effects, by their network ID, and drops the connection on an ID it does not know. So a new effect is shown to a player in one of three ways:

  • its own ID, to the players whose (modded) client knows it;
  • else the vanilla effect it falls back to, so the icon still shows;
  • else not at all: the effect only exists on the server.
Since:
0.1.0
  • Method Details

    • key

      Returns the key of the effect.
      Returns:
      the key of the effect
      Since:
      0.1.0
    • category

      Returns whether the effect helps or harms.
      Returns:
      whether the effect helps or harms
      Since:
      0.1.0
    • fallback

      Returns the vanilla effect shown to players whose client does not know this one, empty to show nothing.
      Returns:
      the vanilla effect shown to players whose client does not know this one, empty to show nothing
      Since:
      0.1.0
    • isKnownBy

      boolean isKnownBy(Player player)
      Returns true if the client of this player knows the effect, and receives its own ID.
      Parameters:
      player - the player about to be told about the effect
      Returns:
      true if the client of this player knows the effect, and receives its own ID
      Since:
      0.1.0
    • requestedNetworkId

      OptionalInt requestedNetworkId()
      Returns the network ID asked for, empty to take the next free ID after the vanilla effects.
      Returns:
      the network ID asked for, empty to take the next free ID after the vanilla effects
      Since:
      0.1.0
    • behaviour

      MobEffectBehaviour behaviour()
      Returns what the effect does.
      Returns:
      what the effect does
      Since:
      0.1.0