Interface MobEffectRegistry
public interface MobEffectRegistry
-
Method Summary
Modifier and TypeMethodDescriptionvoidattach(TypedKey<MobEffect> type, MobEffectBehaviour behaviour, Plugin owner) Gives a behaviour to an effect, vanilla or registered, on top of the ones it already has.Returns a builder of a visible level I effect with its icon, lasting one second until changed.Returns a builder of a new effect, toregister.definition(TypedKey<MobEffect> type) Returns the definition registered under that key, empty for a vanilla effect.Returns every effect registered by a plugin.booleanDrops the behaviours one plugin attached to an effect.default MobEffectInstanceReturns a visible effect with its icon, as applied by potions and mobs.booleanReturnstrueif the effect is vanilla or registered.Returns the network ID of the effect: the vanilla one, or the one a registered effect was given; empty for an unknown effect.voidregister(MobEffectDefinition definition, Plugin owner) Adds an effect to the game.types()Returns every effect that can be applied, vanilla ones included.booleanunregister(TypedKey<MobEffect> type) Drops an effect added throughregister(MobEffectDefinition, Plugin).voidunregisterAll(Plugin owner) Drops every effect and behaviour a plugin declared.
-
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 asMobEffectKeys.SPEED- Returns:
- a builder of a visible level I effect with its icon, lasting one second until changed
- Since:
- 0.1.0
-
instance
Returns a visible effect with its icon, as applied by potions and mobs.- Parameters:
type- a vanilla or registered effectduration- the duration in ticks, orMobEffectInstance.INFINITE_DURATIONamplifier- the level minus one- Returns:
- a visible effect with its icon, as applied by potions and mobs
- Since:
- 0.1.0
-
define
-
register
Adds an effect to the game.- Parameters:
definition- the effectowner- 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
Gives a behaviour to an effect, vanilla or registered, on top of the ones it already has.- Parameters:
type- the effectbehaviour- what it doesowner- the plugin attaching it- Since:
- 0.1.0
-
unregister
Drops an effect added throughregister(MobEffectDefinition, Plugin). Entities still running it lose it on their next tick.- Parameters:
type- the effect- Returns:
trueif it was registered- Since:
- 0.1.0
-
detach
-
unregisterAll
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
Collection<MobEffectDefinition> definitions()Returns every effect registered by a plugin.- Returns:
- every effect registered by a plugin
- Since:
- 0.1.0
-
types
-
isEffect
-
networkId
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
-