Skip to content

@minecraft/server


@minecraft/server / Potions

Class: Potions ​

Defined in: @minecraft/server/index.d.ts:18377

Used for accessing all potion effect types, delivery types, and creating potions.

Methods ​

getAllDeliveryTypes() ​

static getAllDeliveryTypes(): PotionDeliveryType[]

Defined in: @minecraft/server/index.d.ts:18386

Returns ​

PotionDeliveryType[]

Array of all registered delivery type handles.

Remarks ​

Retrieves handles for all registered potion delivery types.


getAllEffectTypes() ​

static getAllEffectTypes(): PotionEffectType[]

Defined in: @minecraft/server/index.d.ts:18394

Returns ​

PotionEffectType[]

Array of all registered effect type handles.

Remarks ​

Retrieves all type handle for all registered potion effects.


getDeliveryType() ​

static getDeliveryType(potionDeliveryId): PotionDeliveryType | undefined

Defined in: @minecraft/server/index.d.ts:18403

Parameters ​

potionDeliveryId ​

string

Returns ​

PotionDeliveryType | undefined

A type handle wrapping the valid delivery id, or undefined for an invalid delivery id.

Remarks ​

Retrieves a type handle for a specified potion delivery id.


getEffectType() ​

static getEffectType(potionEffectId): PotionEffectType | undefined

Defined in: @minecraft/server/index.d.ts:18415

Parameters ​

potionEffectId ​

string

A valid potion effect id. See @minecraft/vanilla-data.MinecraftPotionEffectTypes

Returns ​

PotionEffectType | undefined

A type handle wrapping the valid effect id, or undefined for an invalid effect id.

Remarks ​

Retrieves a type handle for a specified potion effect id.


resolve() ​

static resolve(potionEffectType, potionDeliveryType): ItemStack

Defined in: @minecraft/server/index.d.ts:18428

Parameters ​

potionEffectType ​

string | PotionEffectType

potionDeliveryType ​

string | PotionDeliveryType

Returns ​

ItemStack

Remarks ​

Creates a potion given an effect and delivery type.

Throws ​

This function can throw errors.

minecraftcommon.EngineError

InvalidPotionDeliveryTypeError

InvalidPotionEffectTypeError