Package org.bukkit.potion
Class PotionEffectType
java.lang.Object
org.bukkit.potion.PotionEffectType
- All Implemented Interfaces:
FeatureDependant,Keyed,Translatable,Keyed,Translatable
- Direct Known Subclasses:
PotionEffectTypeWrapper
public abstract class PotionEffectType
extends Object
implements Keyed, Translatable, Translatable, FeatureDependant
Represents a type of potion and its effect on an entity.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PotionEffectTypeIncreases the maximum health of an entity with health that cannot be regenerated, but is refilled every 30 seconds.static final PotionEffectTypeTriggers an ominous event when the player enters a village or trial chambers.
oof.static final PotionEffectTypeBlinds an entity.static final PotionEffectTypeEffects granted by a nearby conduit.static final PotionEffectTypeCauses the player's vision to dim occasionally.static final PotionEffectTypeIncreses underwater movement speed.
Squee'ek uh'k kk'kkkk squeek eee'eek.static final PotionEffectTypeStops fire damage.static final PotionEffectTypeOutlines the entity so that it can be seen from afar.static final PotionEffectTypeIncreases dig speed.static final PotionEffectTypeIncreases the maximum health of an entity.static final PotionEffectTypeReduces the cost of villager trades.
\o/.static final PotionEffectTypeIncreases hunger.static final PotionEffectTypeChance of spawning silverfish when hurt.static final PotionEffectTypeHurts an entity.static final PotionEffectTypeHeals an entity.static final PotionEffectTypeGrants invisibility.static final PotionEffectTypeIncreases jump height.static final PotionEffectTypeCauses the entity to float into the air.static final PotionEffectTypeLoot table luck.static final PotionEffectTypeDecreases dig speed.static final PotionEffectTypeWarps vision on the client.static final PotionEffectTypeAllows an entity to see in the dark.static final PotionEffectTypeCauses slimes to spawn upon death.static final PotionEffectTypeDeals damage to an entity over time.static final PotionEffectTypeTriggers a raid when a player enters a village.static final PotionEffectTypeRegenerates health.static final PotionEffectTypeDecreases damage dealt to an entity.static final PotionEffectTypeIncreases the food level of an entity each tick.static final PotionEffectTypeSlows entity fall rate.static final PotionEffectTypeDecreases movement speed.static final PotionEffectTypeIncreases movement speed.static final PotionEffectTypeIncreases damage dealt.static final PotionEffectTypeCauses trial spawners to become ominous.static final PotionEffectTypeLoot table unluck.static final PotionEffectTypeAllows breathing underwater.static final PotionEffectTypeDecreases damage dealt by an entity.static final PotionEffectTypeCreates cobwebs upon death.static final PotionEffectTypeEmits a wind burst upon death.static final PotionEffectTypeDeals damage to an entity over time and gives the health to the shooter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract @NotNull PotionEffectcreateEffect(int duration, int amplifier) Creates a PotionEffect from this PotionEffectType, applying duration modifiers and checks.abstract doublegetAttributeModifierAmount(Attribute attribute, int effectAmplifier) Gets the true modifier amount based on the effect amplifier.static @Nullable PotionEffectTypegetById(int id) Gets the effect type specified by the unique id.static @Nullable PotionEffectTypeDeprecated.static @Nullable PotionEffectTypeDeprecated.only for backwards compatibility, useRegistry.get(NamespacedKey)instead.abstract @NotNull PotionEffectTypeCategoryReturns thecategoryof this effect type.getColor()Returns the color of this effect type.abstract doubleDeprecated, for removal: This API element is subject to removal in a future version.unused, always 1.0abstract Map<Attribute, AttributeModifier> Gets the effect attributes in an immutable map.abstract PotionEffectType.CategoryGets the category of this effectabstract intgetId()Deprecated, for removal: This API element is subject to removal in a future version.useKeyed.key()getName()Deprecated.only for backwards compatibility, useKeyed.getKey()instead.abstract booleanReturns whether the effect of this type happens once, immediately.static @NotNull PotionEffectType[]values()Deprecated.useIterable.iterator().Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.papermc.paper.world.flag.FeatureDependant
requiredFeaturesMethods inherited from interface net.kyori.adventure.translation.Translatable
translationKeyMethods inherited from interface org.bukkit.Translatable
getTranslationKey
-
Field Details
-
SPEED
Increases movement speed. -
SLOWNESS
Decreases movement speed. -
HASTE
Increases dig speed. -
MINING_FATIGUE
Decreases dig speed. -
STRENGTH
Increases damage dealt. -
INSTANT_HEALTH
Heals an entity. -
INSTANT_DAMAGE
Hurts an entity. -
JUMP_BOOST
Increases jump height. -
NAUSEA
Warps vision on the client. -
REGENERATION
Regenerates health. -
RESISTANCE
Decreases damage dealt to an entity. -
FIRE_RESISTANCE
Stops fire damage. -
WATER_BREATHING
Allows breathing underwater. -
INVISIBILITY
Grants invisibility. -
BLINDNESS
Blinds an entity. -
NIGHT_VISION
Allows an entity to see in the dark. -
HUNGER
Increases hunger. -
WEAKNESS
Decreases damage dealt by an entity. -
POISON
Deals damage to an entity over time. -
WITHER
Deals damage to an entity over time and gives the health to the shooter. -
HEALTH_BOOST
Increases the maximum health of an entity. -
ABSORPTION
Increases the maximum health of an entity with health that cannot be regenerated, but is refilled every 30 seconds. -
SATURATION
Increases the food level of an entity each tick. -
GLOWING
Outlines the entity so that it can be seen from afar. -
LEVITATION
Causes the entity to float into the air. -
LUCK
Loot table luck. -
UNLUCK
Loot table unluck. -
SLOW_FALLING
Slows entity fall rate. -
CONDUIT_POWER
Effects granted by a nearby conduit. Includes enhanced underwater abilities. -
DOLPHINS_GRACE
Increses underwater movement speed.
Squee'ek uh'k kk'kkkk squeek eee'eek. -
BAD_OMEN
Triggers an ominous event when the player enters a village or trial chambers.
oof. -
HERO_OF_THE_VILLAGE
Reduces the cost of villager trades.
\o/. -
DARKNESS
Causes the player's vision to dim occasionally. -
TRIAL_OMEN
Causes trial spawners to become ominous. -
RAID_OMEN
Triggers a raid when a player enters a village. -
WIND_CHARGED
Emits a wind burst upon death. -
WEAVING
Creates cobwebs upon death. -
OOZING
Causes slimes to spawn upon death. -
INFESTED
Chance of spawning silverfish when hurt.
-
-
Constructor Details
-
PotionEffectType
public PotionEffectType()
-
-
Method Details
-
createEffect
Creates a PotionEffect from this PotionEffectType, applying duration modifiers and checks.- Parameters:
duration- time in ticksamplifier- the effect's amplifier- Returns:
- a resulting potion effect
- See Also:
-
isInstant
public abstract boolean isInstant()Returns whether the effect of this type happens once, immediately.- Returns:
- whether this type is normally instant
-
getCategory
Returns thecategoryof this effect type.- Returns:
- the category
-
getColor
Returns the color of this effect type.- Returns:
- the color
-
getDurationModifier
Deprecated, for removal: This API element is subject to removal in a future version.unused, always 1.0Returns the duration modifier applied to effects of this type.- Returns:
- duration modifier
-
getId
Deprecated, for removal: This API element is subject to removal in a future version.useKeyed.key()Returns the unique ID of this type.- Returns:
- Unique ID
-
getName
Deprecated.only for backwards compatibility, useKeyed.getKey()instead.Returns the name of this effect type.- Returns:
- The name of this effect type
-
getByKey
@Contract("null -> null") @Nullable @Deprecated(since="1.20.3") public static @Nullable PotionEffectType getByKey(@Nullable @Nullable NamespacedKey key) Deprecated.only for backwards compatibility, useRegistry.get(NamespacedKey)instead.Gets the PotionEffectType at the specified key- Parameters:
key- key to fetch- Returns:
- Resulting PotionEffectType, or null if not found
-
getById
Gets the effect type specified by the unique id.- Parameters:
id- Unique ID to fetch- Returns:
- Resulting type, or null if not found.
- API Note:
- Internal Use Only
-
getByName
@Nullable @Deprecated(since="1.20.3") public static @Nullable PotionEffectType getByName(@NotNull @NotNull String name) Deprecated.only for backwards compatibility, useRegistry.get(NamespacedKey)instead.Gets the effect type specified by the given name.- Parameters:
name- Name of PotionEffectType to fetch- Returns:
- Resulting PotionEffectType, or null if not found.
-
values
Deprecated.useIterable.iterator().- Returns:
- an array of all known PotionEffectTypes.
-
getEffectAttributes
Gets the effect attributes in an immutable map.- Returns:
- the attribute map
-
getAttributeModifierAmount
public abstract double getAttributeModifierAmount(@NotNull Attribute attribute, int effectAmplifier) Gets the true modifier amount based on the effect amplifier.- Parameters:
attribute- the attributeeffectAmplifier- the effect amplifier (0 indexed)- Returns:
- the modifier amount
- Throws:
IllegalArgumentException- if the supplied attribute is not present in the map fromgetEffectAttributes()
-
getEffectCategory
Gets the category of this effect- Returns:
- the category
-
Registry.get(NamespacedKey)instead.