Interface MobEffectRegistry


public interface MobEffectRegistry
  • Method Details

    • builder

      Returns a builder of a visible level I effect with its icon, lasting one second until changed.
      Parameters:
      type - a vanilla or registered effect, such as MobEffectKeys.SPEED
      Returns:
      a builder of a visible level I effect with its icon, lasting one second until changed
      Since:
      0.1.0
    • instance

      default MobEffectInstance instance(TypedKey<MobEffect> type, int duration, int amplifier)
      Returns a visible effect with its icon, as applied by potions and mobs.
      Parameters:
      type - a vanilla or registered effect
      duration - the duration in ticks, or MobEffectInstance.INFINITE_DURATION
      amplifier - the level minus one
      Returns:
      a visible effect with its icon, as applied by potions and mobs
      Since:
      0.1.0
    • define

      Returns a builder of a new effect, to register.
      Parameters:
      key - the key of the new effect, outside the minecraft namespace
      Returns:
      a builder of a new effect, to register
      Since:
      0.1.0
    • register

      void register(MobEffectDefinition definition, Plugin owner)
      Adds an effect to the game.
      Parameters:
      definition - the effect
      owner - the plugin adding it
      Throws:
      IllegalArgumentException - if the key is a vanilla effect or already registered, or the requested network ID is taken
      Since:
      0.1.0
    • attach

      void attach(TypedKey<MobEffect> type, MobEffectBehaviour behaviour, Plugin owner)
      Gives a behaviour to an effect, vanilla or registered, on top of the ones it already has.
      Parameters:
      type - the effect
      behaviour - what it does
      owner - the plugin attaching it
      Since:
      0.1.0
    • unregister

      boolean unregister(TypedKey<MobEffect> type)
      Drops an effect added through register(MobEffectDefinition, Plugin). Entities still running it lose it on their next tick.
      Parameters:
      type - the effect
      Returns:
      true if it was registered
      Since:
      0.1.0
    • detach

      boolean detach(TypedKey<MobEffect> type, Plugin owner)
      Drops the behaviours one plugin attached to an effect.
      Parameters:
      type - the effect
      owner - the plugin that attached them
      Returns:
      true if at least one behaviour was dropped
      Since:
      0.1.0
    • unregisterAll

      void unregisterAll(Plugin owner)
      Drops every effect and behaviour a plugin declared.
      Parameters:
      owner - the plugin to clean up after
      Since:
      0.1.0
    • definition

      Returns the definition registered under that key, empty for a vanilla effect.
      Parameters:
      type - the effect
      Returns:
      the definition registered under that key, empty for a vanilla effect
      Since:
      0.1.0
    • definitions

      Returns every effect registered by a plugin.
      Returns:
      every effect registered by a plugin
      Since:
      0.1.0
    • types

      Returns every effect that can be applied, vanilla ones included.
      Returns:
      every effect that can be applied, vanilla ones included
      Since:
      0.1.0
    • isEffect

      boolean isEffect(TypedKey<MobEffect> type)
      Returns true if the effect is vanilla or registered.
      Parameters:
      type - the effect
      Returns:
      true if the effect is vanilla or registered
      Since:
      0.1.0
    • networkId

      OptionalInt networkId(TypedKey<MobEffect> type)
      Returns the network ID of the effect: the vanilla one, or the one a registered effect was given; empty for an unknown effect.
      Parameters:
      type - the effect
      Returns:
      the network ID of the effect: the vanilla one, or the one a registered effect was given; empty for an unknown effect
      Since:
      0.1.0