Skip to main content

EnchantmentDamageEffect

Trait EnchantmentDamageEffect 

pub trait EnchantmentDamageEffect:
    Send
    + Sync
    + 'static {
    // Required method
    fn apply(
        &self,
        host: &dyn ServerHost,
        context: &EnchantmentDamageContext<'_>,
        value: f32,
    ) -> f32;
}
Expand description

A registered value transformation. Called only for nodes naming this effect. The host is read-only; callbacks may be nested and must not retain hit context.

Required Methods§

fn apply( &self, host: &dyn ServerHost, context: &EnchantmentDamageContext<'_>, value: f32, ) -> f32

Transform the value at this node, in vanilla enchantment and node order. NaN retains the input. Other results, including infinities, are clamped to 0..=1024 before the next node, bounding per-unit built-in work.

Trait Implementations§

§

impl Wire for Box<dyn EnchantmentDamageEffect>

§

const MIN: usize = 8

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take( input: &mut Reader<'_>, ) -> Result<Box<dyn EnchantmentDamageEffect>, WireError>

Decodes one value, leaving any following bytes for the caller.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§