pub struct PotionEffect {
pub effect: String,
pub duration: Option<u32>,
pub amplifier: Option<u32>,
}Expand description
One entry of a potion’s custom_effects list.
Fields§
§effect: StringVanilla status-effect id (e.g. minecraft:regeneration), validated
against the pinned registry (DW0486).
duration: Option<u32>How long it lasts, in ticks (20 = one second). Required for every
effect except the two INSTANT_EFFECTS, which must NOT declare one.
amplifier: Option<u32>Amplifier, 0 = level I (vanilla’s unsigned byte, so 0–255). Absent = 0.
Implementations§
Source§impl PotionEffect
impl PotionEffect
Sourcepub fn is_instant(&self) -> bool
pub fn is_instant(&self) -> bool
True if this effect is applied once on drinking rather than over time.
Trait Implementations§
Source§impl Clone for PotionEffect
impl Clone for PotionEffect
Source§impl Debug for PotionEffect
impl Debug for PotionEffect
Source§impl<'de> Deserialize<'de> for PotionEffect
impl<'de> Deserialize<'de> for PotionEffect
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for PotionEffect
impl JsonSchema for PotionEffect
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for PotionEffect
impl PartialEq for PotionEffect
Source§impl Serialize for PotionEffect
impl Serialize for PotionEffect
impl StructuralPartialEq for PotionEffect
Auto Trait Implementations§
impl Freeze for PotionEffect
impl RefUnwindSafe for PotionEffect
impl Send for PotionEffect
impl Sync for PotionEffect
impl Unpin for PotionEffect
impl UnsafeUnpin for PotionEffect
impl UnwindSafe for PotionEffect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more